0.0.7 • Published 3 years ago

npm-hardlink v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

npm-hardlink

Hard link npm packages between projects.

This project was developed to fix React hook issues caused by npm link.

Features

  • Super simple to use
  • Uses hard links vs symlinks
  • Uses npm’s official npm-packlist to establish which files to hard link
  • Uses trusted dependencies (chokidar, commander, fs-extra, etc…)
  • Very light codebase to audit (less than 150 lines of code)
  • Written in TypeScript

Installation

npm install -g npm-hardlink

Usage

$ npm-hardlink -h
Usage: npm-hardlink [options]
Options:
  --src <source>        path to package (default: process.cwd())
  --dest <destination>  path to project
  --copy                copy files instead of using hard links
  --install-deps        install package dependencies
  --install-deps-prod   install package production dependencies
  --watch               watch package for changes
  --yes                 skip confirmation prompt
  -h, --help            display help for command

Example

In following example, we are developing a React component called react-cms (packaged as @sunknudsen/react-cms) that we are planning to publish to npm.

Before publishing @sunknudsen/react-cms, we would like to import component from project called sunknudsen-website to see if everything is working (we tried npm link and things were broken).

$ pwd
/Users/sunknudsen/Code/sunknudsen/react-cms

$ npm-hardlink --dest /Users/sunknudsen/Code/sunknudsen/sunknudsen-website --install-deps --watch
Hard linking package @sunknudsen/react-cms to /Users/sunknudsen/Code/sunknudsen/sunknudsen-website/node_modules/@sunknudsen/react-cms…
[
  'lib/CMS.js',
  'package.json',
  'lib/CMS.js.map',
  'README.md',
  'lib/CMS.d.ts'
]
? Do you wish to proceed? Yes
Installing @sunknudsen/react-cms dependencies to /Users/sunknudsen/Code/sunknudsen/sunknudsen-website/node_modules/@sunknudsen/react-cms…
Dependencies installed
Watching @sunknudsen/react-cms for changes…

Contributors

Sun Knudsen

Licence

MIT

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago