The usage of `npm link`
CMCDragonkai opened this issue · comments
Roger Qiu commented
The npm link
can be useful when developing multiple packages together without having to go through publishing overhead. The exact steps for our system is a bit complicated.
Tasks
- 1. Add
export npm_config_prefix=~/.npm
toshell.nix
, this ensures that~/.npm
is used for these links, and so it doesn't try to write it to the read-only path in/nix/store
. - 2. Provide instructions that you must then provide tsconfig paths for the relevant package like with the package
@matrixai/db
(this unfortunately must be done manually)"paths": { "@": ["index"], "@/*": ["*"], "@matrixai/db": ["../node_modules/@matrixai/db/src"], "@matrixai/db/*": ["../node_modules/@matrixai/db/src/*"] },
- 3. Explain how you now use
npm link ../js-db
, or usenpm link
in thejs-db
, then go back tojs-polykey
and usenpm link @matrixai/db
Then you don't need to use npm run build
, and you can reload window in vscode in case types must be updated.
Roger Qiu commented
@tegefaulkes this is what I'm doing right now with testnetprep
.
Roger Qiu commented
Important that once your development process is over, to remove those properties from tsconfig.json
as they no longer apply.