Skip to content

Commit

Permalink
fix(ci): use postinstall in development, prepublishOnly in publish
Browse files Browse the repository at this point in the history
Merged in from upstream.
  • Loading branch information
bericp1 committed Apr 5, 2019
2 parents 6e52388 + 0e23280 commit 5e534eb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
21 changes: 19 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "rm -rf ./dist && tsc",
"prepublishOnly": "yarn run build",
"test": "jest",
"test:watch": "jest --watch",
"lint": "eslint '{*,{src,docs}/**/*,__{tests,mocks}__/**/*}.{ts,tsx,js,jsx}' || true",
Expand All @@ -15,7 +14,8 @@
"semantic-release": "semantic-release",
"release": "yarn run semantic-release",
"release-ci": "echo 'unsafe-perm = true' > ./.npmrc && yarn run semantic-release && rm -rf ./.npmrc",
"commit": "git-cz"
"commit": "git-cz",
"postinstall": "yarn run build && echo 'Postinstall build command is replaced with prepublishOnly during semantic-release publish prep.'"
},
"repository": "https://github.com/Carimus/node-uploads",
"author": "Carimus",
Expand All @@ -24,6 +24,7 @@
"devDependencies": {
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"@semantic-release/exec": "^3.3.2",
"@types/jest": "^24.0.11",
"@typescript-eslint/eslint-plugin": "^1.5.0",
"@typescript-eslint/parser": "^1.5.0",
Expand All @@ -39,6 +40,7 @@
"eslint-plugin-standard": ">=4.0.0",
"husky": "^1.3.1",
"jest": "^24.5.0",
"json": "^9.0.6",
"lint-staged": "^8.1.5",
"prettier": "1.16.4",
"semantic-release": "^15.13.3",
Expand All @@ -48,6 +50,21 @@
"engines": {
"node": ">=10"
},
"release": {
"branch": "master",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "./scripts/prepare.sh"
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
Expand Down
9 changes: 9 additions & 0 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -e

# Update the package.json to place the build command in prepublishOnly instead of in postinstall
json -I -f package.json -e 'this.scripts.prepublishOnly = "yarn run build"; delete this.scripts.postinstall;'

# Pretty up the package.json so it's still consistent with the codebase's code style
prettier --write package.json
19 changes: 18 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,23 @@
import-from "^2.1.0"
lodash "^4.17.4"

"@semantic-release/error@^2.2.0":
"@semantic-release/error@^2.1.0", "@semantic-release/error@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@semantic-release/error/-/error-2.2.0.tgz#ee9d5a09c9969eade1ec864776aeda5c5cddbbf0"
integrity sha512-9Tj/qn+y2j+sjCI3Jd+qseGtHjOAeg7dU2/lVcqIQ9TV3QDaDXDYXcoOHU+7o2Hwh8L8ymL4gfuO7KxDs3q2zg==

"@semantic-release/exec@^3.3.2":
version "3.3.2"
resolved "https://registry.yarnpkg.com/@semantic-release/exec/-/exec-3.3.2.tgz#33fb6001ddeaed4364975fa981bfd7306db7eabb"
integrity sha512-CzJnsTXYKY4LZ16WVEq/bt4OLzoiFf0DymCeMUZ5fthPHDbKprzky4+VIwaSDbRgLVEqRVeUD4gYVmlAeaWNCA==
dependencies:
"@semantic-release/error" "^2.1.0"
aggregate-error "^2.0.0"
debug "^4.0.0"
execa "^1.0.0"
lodash "^4.17.4"
parse-json "^4.0.0"

"@semantic-release/github@^5.1.0":
version "5.2.10"
resolved "https://registry.yarnpkg.com/@semantic-release/github/-/github-5.2.10.tgz#bf325f11685d59b864c8946d7d30fcb749d89e37"
Expand Down Expand Up @@ -4229,6 +4241,11 @@ json5@2.x, json5@^2.1.0:
dependencies:
minimist "^1.2.0"

json@^9.0.6:
version "9.0.6"
resolved "https://registry.yarnpkg.com/json/-/json-9.0.6.tgz#7972c2a5a48a42678db2730c7c2c4ee6e4e24585"
integrity sha1-eXLCpaSKQmeNsnMMfCxO5uTiRYU=

jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
Expand Down

0 comments on commit 5e534eb

Please sign in to comment.