Skip to content

eger-geger/symlink-modules

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

linkpkg

Fork of symlink-modules. Purpose remained the same – create symbolic links to resolved packages in given folder.

Compared to original version following was changed:

  • create directory junction on windows;
  • extended command-line interface;
  • added input validation;
  • added resolution root argument.

Motivation

Packages with frontend code often contain resources in addition to javascript code. Those resources are usually being referenced via relative path and everything works fine until we do not install package which references resources from other packages as dependency. At that point npm flatterns dependency tree and resources are no longer where they used to be.

linkpkg resolves referenced packages and creates symbolic links for them in predictable location. Sugested usage is linkink referenced packages in postinstall phase:

{
	"dependencies": {
		"minimist": "^1.2.0",
		"rimraf": "^2.6.2",
		"linkpkg": "^1.0.0"
	},

	"scripts": {
		"postinstall": "linkpkg -d resources minimist rimraf"
	}

}

Installation

npm install --save linkpkg

Usage

linkpkg [(-d|--dir) FOLDER] [(-r|--root) ROOT] [PKG ...]

Arguments:
   PKG            list of packages to link separated with space
   -d, --dir      path to linked packages folder (default: linked_modules)
   -r, --root     path used as staring point for package resolution (default: current working directory)

Create a my_modules folder and symlink installed minimist and rimraf pckages there:

linkpkg -d my_modules minimist rimraf

About

Link dependent package in predictable location

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 60.0%
  • Batchfile 21.2%
  • Shell 18.8%