Skip to content

Commit 5299b37

Browse files
committed
Added npm linking instructions, fixes #36
1 parent f86591a commit 5299b37

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,27 @@ Due to https://github.com/microsoft/TypeScript/issues/10866, you cannot use path
8383

8484
However, we have left the path alias configuration in `tsconfig.json`, `jest.config.js` and in the tests we are making use of the `@` alias.
8585

86+
### Local Package Linking
87+
88+
When developing on multiple NPM packages, it can be easier to use `npm link` so that changes are immediately reflected rather than repeatedly publishing packages. To do this, you need to use `npm link`. After linking a local directory, you need to provide `tsconfig.json` paths so TypeScript compiler can find the right files.
89+
90+
For example when linking `@matrixai/db` located in `../js-db`:
91+
92+
```sh
93+
npm link ../js-db
94+
```
95+
96+
You would need to add these paths to `tsconfig.json`:
97+
98+
```
99+
"paths": {
100+
"@": ["index"],
101+
"@/*": ["*"],
102+
"@matrixai/db": ["../node_modules/@matrixai/db/src"],
103+
"@matrixai/db/*": ["../node_modules/@matrixai/db/src/*"]
104+
},
105+
```
106+
86107
### Native Module Toolchain
87108

88109
There are some nuances when packaging with native modules.

shell.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ in
1919
set +o allexport
2020
set -v
2121
22+
# Enables npm link
23+
export npm_config_prefix=~/.npm
24+
2225
export PATH="$(pwd)/dist/bin:$(npm bin):$PATH"
2326
2427
# pkg is installed in package.json

0 commit comments

Comments
 (0)