I'm confused by the documentation for npm-scripts as it relates to the prepare and prepublish steps and which one is best for a package that is installed from Git/GitHub.
Specifically, we have two TypeScript projects:
Project A depends on Project B.
Project A specifies the dependency as a Git URL in its package.json, for example:
"dependencies": {
"project-b": "git+ssh://git@<path to project b>.git",
...
}
Now, running npm install from the project root of Project A will essentially download the un-transpiled version of Project B.
We want tsc for Project B to be run as part of npm install when npm install is run from the root of Project A. What is the best script step to do this?
The NPM docs seem to give conflicting guidance between prepare and prepublish:
prepare: "Run ... when installing git dependencies."prepublish: "use a prepublish script. This includes tasks such as ... Compiling CoffeeScript source code into JavaScript." (source)
So, which one is it?