Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c98ea5

Browse files
authored
chore(stack update): update the whole docsearch stack (#173)
* chore(stack update): update the whole docsearch stack In an effort to reduce our stack diversity I am moving docsearch to: - latest eslint - prettier - webpack 2 - babel 6 (babel 7 is soon to be released, we were on babel 5) - babel-preset-env (support: IE >=9, Two latest version of evergreen browsers). - jest * chore(contrib): remove develop branch, cc @redox
1 parent 25dbb4d commit 3c98ea5

29 files changed

+3842
-2259
lines changed

.babelrc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
{
2+
"presets": [
3+
["env", {
4+
"targets": {
5+
"browsers": ["last 2 versions", "ie >= 9"]
6+
}
7+
}],
8+
"stage-3"
9+
],
210
"env": {
311
"test": {
412
"plugins": ["babel-plugin-rewire"]
5-
}
6-
},
7-
"stage": 2
13+
},
14+
}
815
}

.eslintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['algolia'],
3+
};

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ before_install:
55
- git config --global user.name "algobot"
66
- rvm install 2.2.0
77
- rvm use 2.2.0
8-
before_cache: npm prune
98
script: "./scripts/test-ci"
10-
after_script: "./scripts/travis-after-script"
119
branches:
1210
only:
1311
- master
14-
- develop
1512
sudo: false
1613
cache:
1714
yarn: true

CONTRIBUTING.md

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Hi (future) collaborator!
22

33
**tl;dr;**
4-
- submit pull requests to develop branch
4+
- submit pull requests to master branch
55
- use [conventional changelog](https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md) commit style messages
66
- squash your commits
77
- have fun
@@ -26,20 +26,13 @@ Hi (future) collaborator!
2626
- [Releasing](#releasing)
2727
- [Releasing v1](#releasing-v1)
2828
- [Beta releases](#beta-releases)
29-
- [Hotfixes](#hotfixes)
30-
- [Releasing hotfixes](#releasing-hotfixes)
31-
- [Documentation updates](#documentation-updates)
3229

3330
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3431

3532
# Where to start?
3633

3734
Have a fix or a new feature? [Search for corresponding issues](https://github.com/algolia/docsearch/issues) first then create a new one.
3835

39-
Always check the status of the [develop branch](https://github.com/algolia/docsearch/tree/develop) for the freshest code.
40-
41-
Always submit pull requests to the develop branch.
42-
4336
# Development workflow
4437

4538
## Local example
@@ -141,7 +134,7 @@ Example:
141134

142135
# When are issues closed?
143136

144-
Once the a fix is done, having the fix in the `develop` branch is not sufficient, it needs to be part of a release for us to close the issue.
137+
Once the a fix is done, having the fix in the `master` branch is not sufficient, it needs to be part of a release for us to close the issue.
145138

146139
So that you never ask yourself "Is this released?".
147140

@@ -159,8 +152,6 @@ You must be on the master branch.
159152
npm run release
160153
```
161154

162-
This task will merge develop into master.
163-
164155
## Releasing v1
165156

166157
```sh
@@ -169,40 +160,21 @@ git pull
169160
npm run release
170161
```
171162

172-
We use the `v1` branch as a way to push fixes to the first version of DocSearch. Never merge `master` or `develop` into `v1` and
163+
We use the `v1` branch as a way to push fixes to the first version of DocSearch. Do not merge `master` into `v1` and
173164
vice versa.
174165

175166
## Beta releases
176167

177-
You must be on the develop branch.
168+
You must be on the master branch.
178169

179170
```sh
180171
npm run release:beta
181172
```
182173

183-
This task will release a beta version of what is currently in develop branch.
174+
This task will release a beta version of what is currently in master branch.
184175

185176
It will not update the `latest` tag of the npm release nor update jsDelivr /2/.
186177

187-
# Hotfixes
188-
189-
All our work is done on the develop branch but it could be necessary to push a hotfix to the master
190-
branch and do a patch release. To fix a very important bug.
191-
192-
For this, you should:
193-
- add `hotfix` to the commit message **body**
194-
- submit your pull request to the master branch
195-
196-
## Releasing hotfixes
197-
198-
You must be on the master branch.
199-
200-
This task will not merge develop in master, only release current master.
201-
202-
```sh
203-
HOTFIX=1 npm run release
204-
```
205-
206178
## Documentation updates
207179

208180
If you have important documentation update to release without wanting to release

dev/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ docsearch({
44
apiKey: 'e3d767b736584dbe6d4c35f7cf7d4633',
55
indexName: 'react-native',
66
inputSelector: '#search-input',
7-
debug: true
7+
debug: true,
88
});
99

1010
document.getElementById('search-input').focus();

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
/* eslint-disable import/no-commonjs */
12
module.exports = require('./src/lib/main.js');

package.json

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,65 @@
1515
"release": "./scripts/release",
1616
"release:beta": "./scripts/release-beta",
1717
"lint": "eslint .",
18-
"test": "BABEL_ENV=test mocha --timeout 6000 --reporter dot ./test/helpers.js ./test/*-test.js",
19-
"test:watch": "BABEL_ENV=test mocha --reporter min --watch ./test/helpers.js ./test/*-test.js",
20-
"test:coverage": "./scripts/test-coverage",
21-
"gh-pages": "./scripts/gh-pages"
18+
"test": "jest --coverage",
19+
"test:watch": "jest --watch",
20+
"gh-pages": "./scripts/gh-pages",
21+
"precommit": "lint-staged"
2222
},
23+
"lint-staged": {
24+
"*.js": [
25+
"prettier --write --single-quote --trailing-comma es5",
26+
"git add"
27+
]
28+
},
29+
"files": [
30+
"dist/"
31+
],
2332
"author": "Algolia <[email protected]> (https://github.com/algolia/)",
2433
"license": "MIT",
2534
"repository": "algolia/docsearch",
2635
"devDependencies": {
27-
"autoprefixer": "^6.3.6",
28-
"babel": "^5.8.29",
29-
"babel-core": "^5.8.29",
30-
"babel-eslint": "^4.1.3",
31-
"babel-istanbul": "^0.5.9",
32-
"babel-loader": "^5.3.2",
33-
"babel-plugin-rewire": "^0.1.22",
34-
"conventional-changelog": "^0.5.1",
35-
"coveralls": "^2.11.9",
36+
"autoprefixer": "^6.7.7",
37+
"babel-cli": "^6.24.0",
38+
"babel-core": "^6.24.0",
39+
"babel-eslint": "^7.1.1",
40+
"babel-istanbul": "^0.12.2",
41+
"babel-loader": "^6.4.1",
42+
"babel-plugin-rewire": "^1.0.0",
43+
"babel-preset-env": "^1.2.2",
44+
"babel-preset-stage-3": "^6.22.0",
45+
"conventional-changelog-cli": "^1.3.1",
3646
"cssnano": "^3.7.0",
37-
"doctoc": "^0.15.0",
38-
"eslint": "^1.6.0",
39-
"eslint-config-airbnb": "^0.1.0",
40-
"eslint-config-algolia": "^4.7.0",
47+
"doctoc": "^1.3.0",
48+
"eslint": "^3.17.1",
49+
"eslint-config-algolia": "^6.0.1",
50+
"eslint-config-prettier": "^1.5.0",
51+
"eslint-import-resolver-webpack": "^0.8.1",
4152
"eslint-plugin-algolia": "^1.5.0",
42-
"eslint-plugin-react": "^3.5.1",
53+
"eslint-plugin-import": "^2.2.0",
54+
"eslint-plugin-jest": "^19.0.1",
4355
"expect": "^1.20.1",
4456
"gh-pages": "^0.12.0",
45-
"jsdom": "^7.1.1",
46-
"json": "^9.0.4",
47-
"mocha": "^2.5.3",
48-
"mocha-jsdom": "^1.1.0",
49-
"mocha-lcov-reporter": "^1.2.0",
57+
"jest": "^19.0.2",
58+
"jsdom": "^9.12.0",
59+
"json": "^9.0.6",
5060
"mversion": "^1.10.1",
5161
"nd": "^1.2.0",
52-
"node-sass": "^3.7.0",
53-
"onchange": "^2.5.0",
54-
"postcss-cli": "^2.5.2",
55-
"pretty-bytes": "^2.0.1",
62+
"node-sass": "^4.5.0",
63+
"onchange": "^3.2.1",
64+
"postcss-cli": "^3.0.0",
65+
"prettier": "^0.22.0",
66+
"pretty-bytes-cli": "^2.0.0",
5667
"semver": "^5.1.0",
57-
"sinon": "^1.17.4",
58-
"uglify-js": "^2.6.2",
59-
"webpack": "^1.13.1",
60-
"webpack-dev-server": "^1.14.1"
68+
"sinon": "^2.0.0",
69+
"uglify-js": "^2.8.13",
70+
"webpack": "^2.2.1",
71+
"webpack-dev-server": "^2.4.2"
6172
},
6273
"peerDependencies": {},
6374
"dependencies": {
64-
"algoliasearch": "^3.18.0",
65-
"autocomplete.js": "^0.25.0",
75+
"algoliasearch": "^3.22.1",
76+
"autocomplete.js": "^0.27.0",
6677
"hogan.js": "^3.0.2",
6778
"to-factory": "^1.0.0"
6879
}

scripts/build-css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ LICENSE="/*! ${NAME} ${VERSION:-UNRELEASED} | © Algolia | github.com/algolia/do
77
DIST_DIR="dist/cdn"
88
DIST_FILE="$DIST_DIR/${NAME}.css"
99
DIST_FILE_MIN="$DIST_DIR/${NAME}.min.css"
10+
DIST_FILE_MAP="$DIST_DIR/${NAME}.min.css.map"
1011

1112
mkdir -p "$DIST_DIR"
1213

1314
# ./dist/cdn/docsearch.css
1415
echo "$LICENSE" > "$DIST_FILE";
1516
node-sass --output-style expanded ./src/styles/main.scss \
16-
| postcss --use autoprefixer \
17-
>> "$DIST_FILE"
17+
| postcss --use autoprefixer -o "$DIST_FILE"
1818

1919
# ./dist/cdn/docsearch.min.css
20-
postcss --use cssnano "$DIST_FILE" \
21-
>> "$DIST_FILE_MIN"
20+
postcss "$DIST_FILE" --use cssnano --map "$DIST_FILE_MAP" -o "$DIST_FILE_MIN"
2221

2322
gzip_size=$(gzip -9 < $DIST_FILE_MIN | wc -c | pretty-bytes)
2423
echo "=> $DIST_FILE_MIN gzipped will weight $gzip_size-bytes"

scripts/bump-package-version.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,30 @@ import semver from 'semver';
88
import currentVersion from '../src/lib/version.js';
99

1010
if (!process.env.VERSION) {
11-
throw new Error('bump: Usage is VERSION=MAJOR.MINOR.PATCH scripts/bump-package-version.js');
11+
throw new Error(
12+
'bump: Usage is VERSION=MAJOR.MINOR.PATCH scripts/bump-package-version.js'
13+
);
1214
}
13-
let newVersion = process.env.VERSION;
15+
const newVersion = process.env.VERSION;
1416

1517
if (!semver.valid(newVersion)) {
16-
throw new Error('bump: Provided new version (' + newVersion + ') is not a valid version per semver');
18+
throw new Error(
19+
`bump: Provided new version (${newVersion}) is not a valid version per semver`
20+
);
1721
}
1822

1923
if (semver.gte(currentVersion, newVersion)) {
20-
throw new Error('bump: Provided new version is not higher than current version (' + newVersion + ' <= ' + currentVersion + ')');
24+
throw new Error(
25+
`bump: Provided new version is not higher than current version (${newVersion} <= ${currentVersion})`
26+
);
2127
}
2228

23-
console.log('Bumping ' + newVersion);
29+
console.log(`Bumping ${newVersion}`);
2430

2531
console.log('..Updating src/lib/version.js');
2632

27-
let versionFile = path.join(__dirname, '../src/lib/version.js');
28-
let newContent = "export default '" + newVersion + "';\n";
33+
const versionFile = path.join(__dirname, '../src/lib/version.js');
34+
const newContent = `export default '${newVersion}';\n`;
2935
fs.writeFileSync(versionFile, newContent);
3036

3137
console.log('..Updating package.json, npm-shrinwrap.json');

0 commit comments

Comments
 (0)