From b44d413ec407e190e82c6a8fd3f72b37eea86a8c Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Mon, 15 May 2023 21:21:02 +0100 Subject: [PATCH] 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 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8903b348f..bc275f92d 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "test:e2e": "jest --selectProjects E2E --runInBand --verbose", "eslint": "eslint .", "eslint:fix": "eslint . --fix", - "prepublishOnly": "npm run clean && npm run release", + "prepare": "npm run clean && npm run release", "codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b", "docker": "docker build -t eeelenbaas/openapi-typescript-codegen ." },