Skip to content

Commit ab5d769

Browse files
author
Adam Spiers
committed
chore: add a prepare step so that git dependencies build
It is convenient to be able to specify dependencies in package.json which point to particular git commits. One use case is allowing dependencies on PRs which are not yet merged and published to npm.org, such as probil#1 in order to obtain functioning ESM support. In theory this should be achievable via: "vitest-chrome": "probil/vitest-chrome#5fb1634b" https://docs.npmjs.com/cli/v8/configuring-npm/package-json#git-urls-as-dependencies states: > When installing from a git repository, the presence of certain fields > in the package.json will cause npm to believe it needs to perform a > build. To do so your repository will be cloned into a temporary > directory, all of its deps installed, relevant scripts run, and the > resulting directory packed and installed. > > This flow will occur if your git dependency uses workspaces, or if > any of the following scripts are present: > > - `build` > - `prepare` > - `prepack` > - `preinstall` > - `install` > - `postinstall` However it seems that, at least with pnpm, the presence of a `build` step is not sufficient. So add a `prepare` step which just dispatches to the `build` step. This makes vitest-chrome installable via a git dependency.
1 parent 4bcd16e commit ab5d769

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"vitest-chrome.d.ts"
2727
],
2828
"scripts": {
29+
"prepare": "run-s build",
2930
"build": "run-s build:clean build:pro build:types build:copy",
3031
"build:clean": "rm -rf lib types",
3132
"build:copy": "copyfiles -f src/vitest-chrome.d.ts types",

0 commit comments

Comments
 (0)