@ogre-tools/linkable
v17.11.1
Published
Like 'npm link', but doesn't trip over with symlinks and local node_modules of linking target.
Downloads
1,881
Readme
Linkable
A substitute for $ npm link
which extends library yalc with ability to link to multiple modules using wildcard-paths.
Reinventing $ npm link
is necessary, because it stumbles when symlinks created by it lead to places which have their local node_modules
, which will unnaturally take precedence over peerDependencies
causing poisonous multiple instances in runtime.
The downside of linkable
is that, unlike npm link
, linkable
requires linkable-push
to "refresh" the targets of linking to those linking.
Usage
- In linking source:
$ npm install --save-dev @ogre-tools/linkable
- Add
scripts: { "postinstall": "linkable" }
topackage.json
. - Add lines to
.gitignore
for new stuff related only for local development:- .linkable.json
- .yalc
- yalc.lock
- Create a configuration file:
.linkable.json
to project root with your preference of paths to local module directories under development, eg.:
[
"../some-module",
"/some-monorepo/packages/**"
]
In linking target:
- Also
$ npm install --save-dev @ogre-tools/linkable
- Add
scripts: { "postbuild": "linkable-push" }
topackage.json
. $ npm build
- Also
$ npm install
in linking source will now create "live" yalc-links to packages defined in.linkable.json
. When the target packages arelinkable-push
:ed as result from being built, the source(s) will pick up the changes.