Skip to content

Commit b44d413

Browse files
committed
build: use npm prepare instead of prepublishOnly
In NPM, the `prepublishOnly` script is run only before running `npm publish`. However, this means that people trying to use the git version of of this project (i.e. with `npm install ferdikoomen/openapi-typescript-codegen`) won't get a working version of this project, since there will be nothing in the `dist/` folder. [NPM (since v4.0.0)][1] supports a `prepack` script, that is called: > * Runs BEFORE the package is packed > * Runs BEFORE the package is published > * Runs on local `npm install` without any arguments > * Run AFTER `prepublish`, but BEFORE `prepublishOnly` > * NOTE: If a package being installed through git contains a `prepare` > script, its `dependencies` and `devDependencies` will be installed, > and the prepare script will be run, before the package is packaged > and installed. [1]: https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-scripts
1 parent 6c75c80 commit b44d413

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"test:e2e": "jest --selectProjects E2E --runInBand --verbose",
5656
"eslint": "eslint .",
5757
"eslint:fix": "eslint . --fix",
58-
"prepublishOnly": "npm run clean && npm run release",
58+
"prepare": "npm run clean && npm run release",
5959
"codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b",
6060
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen ."
6161
},

0 commit comments

Comments
 (0)