Skip to content

Commit

Permalink
Remove postinstall step (#28)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
demurgos authored and NoahDragon committed Nov 7, 2017
1 parent f8e237a commit ae4bd8a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ coverage/
gulpfile.js
.idea/
appveyor.yml
highlight_alias.json
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ node_js:
- "node"

script:
# For older versions of npm (ie. the one bundled with Node 6), we need to manually run `prepare`
# to build the project. You can still install and consume the package without any issue.
- if [[ "$TRAVIS_NODE_VERSION" == "6" ]]; then npm run prepare; fi
- npm run eslint
- npm run jscs
- npm run test-cov
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Next

- **[Fix]** Remove postinstall step, fixes installations issues for some systems. [#24](https://github.com/hexojs/hexo-util/issues/24)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "mocha test/index.js",
"test-cov": "istanbul cover --print both _mocha -- test/index.js",
"build:highlight": "node scripts/build_highlight_alias.js > highlight_alias.json",
"postinstall": "npm run build:highlight"
"prepare": "npm run build:highlight"
},
"directories": {
"lib": "./lib"
Expand All @@ -24,7 +24,7 @@
"author": "Tommy Chen <[email protected]> (http://zespia.tw)",
"maintainers": [
"Abner Chou <[email protected]> (http://abnerchou.me)"
],
],
"license": "MIT",
"devDependencies": {
"chai": "^3.5.0",
Expand Down

0 comments on commit ae4bd8a

Please sign in to comment.