Skip to content

Commit 03c4a3e

Browse files
bors[bot]bidoubiwa
andauthored
Merge #342
342: Upgrade playground r=bidoubiwa a=bidoubiwa Upgrade playground: - Remove old playground that had to be refreshed before for it to work - Add 2 new playgrounds, one with HTML build and one with JS build - Updated readme and information about styling Co-authored-by: Charlotte Vermandel <[email protected]> Co-authored-by: cvermand <[email protected]>
2 parents 213be40 + 481537b commit 03c4a3e

File tree

12 files changed

+10887
-20
lines changed

12 files changed

+10887
-20
lines changed

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,29 @@ updates:
1515
- dependency-name: "*eslint*"
1616
- dependency-name: "babel-eslint"
1717
- dependency-name: "*prettier*"
18+
- package-ecosystem: npm
19+
directory: "/playground/javascript"
20+
schedule:
21+
interval: weekly
22+
time: "04:00"
23+
open-pull-requests-limit: 10
24+
labels:
25+
- skip-changelog
26+
- dependencies
27+
versioning-strategy: increase
28+
rebase-strategy: disabled
29+
ignore:
30+
- dependency-name: "parcel-bundler"
31+
- package-ecosystem: npm
32+
directory: "/playground/html"
33+
schedule:
34+
interval: weekly
35+
time: "04:00"
36+
open-pull-requests-limit: 10
37+
labels:
38+
- skip-changelog
39+
- dependencies
40+
versioning-strategy: increase
41+
rebase-strategy: disabled
42+
ignore:
43+
- dependency-name: "parcel-bundler"

.gitignore

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,126 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port
105+
106+
# misc
107+
.DS_Store
108+
109+
# parcel
110+
.parcel_cache/
111+
112+
############################
113+
# CYPRESS
114+
############################
115+
cypress/screenshots
116+
cypress/videos
117+
cypress/support
118+
cypress/plugins
119+
cypress/fixtures
120+
121+
122+
123+
1124
.DS_Store
2125
coverage/
3126
node_modules/

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,25 @@ _Your documentation content is not indexed yet? Check out [this tutorial](https:
100100
**WARNING: We recommend providing the MeiliSearch public key, which is enough to perform search requests.<br>
101101
Read more about [MeiliSearch authentication](https://docs.meilisearch.com/reference/features/authentication.html).**
102102

103+
#### Styling
104+
105+
`docs-searchbar.js` comes with a css template. It has to be added in your project in the following way:
106+
107+
In an ES+ environment:
108+
109+
```js
110+
import "docs-searchbar.js/dist/cdn/docs-searchbar.css";
111+
```
112+
113+
In a `HTML` file, the `link` tag should be added in your header:
114+
115+
```html
116+
<link
117+
rel="stylesheet"
118+
href="https://cdn.jsdelivr.net/npm/docs-searchbar.js@latest/dist/cdn/docs-searchbar.min.css"
119+
/>
120+
```
121+
103122
### Customization
104123

105124
The default behavior of this library fits perfectly for a documentation search bar, but you might need some customizations.
@@ -169,7 +188,7 @@ docsSearchBar({
169188

170189
##### More Examples <!-- omit in toc -->
171190

172-
Here is a basic [HTML file](scripts/playground.html) used in the playground of this repository.
191+
Here is a basic [HTML file](playground/index.html) used in the playground of this repository.
173192

174193
As a more concrete example, you can [check out the configuration](https://github.com/meilisearch/vuepress-plugin-meilisearch/blob/bf2210e131eb5630f632d514f35710ee6576ec7a/MeiliSearchBox.vue#L64) applied in the MeiliSearch plugin for VuePress.
175194

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"build": "./scripts/build",
1414
"build:css": "./scripts/build-css",
1515
"build:js": "./scripts/build-js",
16-
"doctoc": "doctoc --maxlevel 3 README.md",
1716
"format:scss": "prettier --write ./src/**/*.scss",
1817
"format:md": "prettier --write '**/*.md'",
18+
"playground": "yarn --cwd ./playgrounds/html && yarn --cwd ./playgrounds/html serve",
19+
"playground:js": "yarn --cwd ./playgrounds/javascript && yarn --cwd ./playgrounds/javascript serve",
1920
"lint": "eslint ./src ./*.js",
2021
"lint-fix": "eslint --fix ./src ./*.js",
2122
"prettier-ci": "prettier --check ./src/**/*.scss '**/*.md'",
22-
"serve": "./scripts/serve",
2323
"test": "./scripts/test",
2424
"test:watch": "./scripts/test-watch"
2525
},

scripts/playground.html renamed to playgrounds/html/index.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,20 @@
55
<meta name="color-scheme" content="dark light" />
66
<title>Docs SearchBar playground</title>
77
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css" />
8-
<link rel="stylesheet" href="http://127.0.0.1:8080/docs-searchbar.min.css" />
8+
<link rel="stylesheet" href="../../src/styles/main.scss" />
99
</head>
1010
<body>
1111
<div class="container">
12-
<div class="mt-1">
13-
<h1>Assets are served from http://127.0.0.1:8080/ </h1>
14-
</div>
1512
<div class="col-md-12">
1613
<div class="searchbox">
1714
<input type="search" placeholder="docs-searchbar input" class="form-control" id="q">
1815
</div>
1916
</div>
2017
</div>
2118
<!-- at the end of the BODY -->
22-
<script src="http://127.0.0.1:8080/docs-searchbar.js"></script>
19+
<script src="../../index.js"></script>
2320
<script>
24-
docsSearchBar({
21+
docsSearchBar.default({
2522
// Test with MeiliSearch Documentation
2623
hostUrl: 'https://docs-search-bar.meilisearch.com',
2724
apiKey: 'd79226ae89f29d4dadba8d0c30c240e435f584fb83a7ae573b13eb62edec35cd',

playgrounds/html/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "docs-searchbar-playground",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"serve": "parcel serve index.html --global docsSearchBar --open"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"devDependencies": {
12+
"@babel/core": "^7.14.3",
13+
"parcel-bundler": "^1.12.5"
14+
}
15+
}

0 commit comments

Comments
 (0)