0.0.10 • Published 3 years ago
nslm v0.0.10
nslm - Node Symbolic Link Manager
Symbolically link node packages en masse for local development
NOTE: Some features have not been documented yet!
Installation
Ensure you have node version 14 or above:
node -vInstall globally with npm:
sudo npm install -g nslmUsage
Register
nslm registerwill recursively search all directories in the current working directory for node modules, saving their locations to~/.nslm/modules.json- The locations registered will be what's used as the source for the given modules when linking.
- As the command searches recursively, you may only need to run it once to capture all of your node projects. For example if you keep all of your node projects within a directory named
Git repos, you can simply runnslm registerin that folder and it'll register everything. - You'll only need to run the command again you wish to register a brand new module or move the location of any of them.
- No additional arguments are required for this command.
Link
nslm linkneeds arguments. You have a few options:--pathscontainingwill link every single module that contains one or more given strings in its path (separated by spaces). For example you can runnslm link --pathscontaining my-directory-1 my-directory-2and it will attempt link every module which contains eithermy-directory-1ormy-directory-2in their paths.--moduleswill only link modules that match the exact name given. For examplenslm link --modules my-node-projectwill only link the package with the namemy-node-project.--aor--allwill link every single module you registered with nslm register. This probably won't be what you want to do most of the time!
- By default it will only link modules that you've already installed. For example let's say you want to link everything in
my-directory-1tomy-node-project. If you haven't runnpm installoryarn install(ie. the package isn't yet included in package.json), it will not link anything. To bypass this and link it anyway, add the--allowmissingargument. For examplenslm link --pathscontaining my-directory-1 my-directory-2 --allowmissing - Be careful about running
npm installoryarn installafter you've linked a module to something, as this may unlink one or more modules. To fix, simply relink the module again.
Delink
nslm delinkworks in the same way asnpm link, with most of the same arguments, but in reverse. Use it to put things back to normal. The--allowmissingargument won't do anything here.- You may want to use the
--allargument most of the time to ensure everything has been reset in the given directory, rather than removing modules one at a time. It'll not only remove the symbolic links but will also try to restore your original local copy of the given module.- For example let's say you're working in
my-node-projectand you've nslm linked a module calledexcellent-project. When I runnslm delink --allit'll remove that link and replace it with the module that was installed before you linked anything. If the module was missing to begin with (ie. you used the--allowmissingarg onnslm link) then nothing will be restored as nothing would've been there to back up in the first place.
- For example let's say you're working in