Skip to content

Commit ae4bd8a

Browse files
demurgosNoahDragon
authored andcommitted
Remove postinstall step (#28)
Use a `prepare` hook instead of a `postinstall` hook to generate the `highlight_alias.json` file. This means that the file is generated during the publication of package to npm or when manually running `npm install` in the project directory. The previous behavior was to generate this step on the consumer side: this was the cause of numerous hard-to-reproduce issues due to the variety of environments. Closes #20 Closes #23 Closes #24
1 parent f8e237a commit ae4bd8a

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ coverage/
77
gulpfile.js
88
.idea/
99
appveyor.yml
10-
highlight_alias.json

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ node_js:
1212
- "node"
1313

1414
script:
15+
# For older versions of npm (ie. the one bundled with Node 6), we need to manually run `prepare`
16+
# to build the project. You can still install and consume the package without any issue.
17+
- if [[ "$TRAVIS_NODE_VERSION" == "6" ]]; then npm run prepare; fi
1518
- npm run eslint
1619
- npm run jscs
1720
- npm run test-cov

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Next
2+
3+
- **[Fix]** Remove postinstall step, fixes installations issues for some systems. [#24](https://github.com/hexojs/hexo-util/issues/24)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"test": "mocha test/index.js",
1010
"test-cov": "istanbul cover --print both _mocha -- test/index.js",
1111
"build:highlight": "node scripts/build_highlight_alias.js > highlight_alias.json",
12-
"postinstall": "npm run build:highlight"
12+
"prepare": "npm run build:highlight"
1313
},
1414
"directories": {
1515
"lib": "./lib"
@@ -24,7 +24,7 @@
2424
"author": "Tommy Chen <tommy351@gmail.com> (http://zespia.tw)",
2525
"maintainers": [
2626
"Abner Chou <hi@abnerchou.me> (http://abnerchou.me)"
27-
],
27+
],
2828
"license": "MIT",
2929
"devDependencies": {
3030
"chai": "^3.5.0",

0 commit comments

Comments
 (0)