prelink

2019-06-12 admin

prelink是什么

什么是prelink,Symlink your module to keep clean and separate sources from project usage

prelink使用教程帮助文档

postlink

auto npm link your npm packages after npm install

Reminder about npm link

A bar package depends on a foo package and you want node_modules/foo to stay in sync with ${HOME}/foo. To achieve this goal you run the command : npm link ${HOME}/foo. Because you want to automate this npm link command a common practice consist into adding it in the scripts, postinstall section, of your package.json.

What postlink does ?

It prevents you from having to maintain npm link calls in your package.json. It read dependencies from package.json and npm link all packages found in a folder you can define.

How to use

In your package.json add postlink as dependency and run it postinstall

{
    "dependencies": {
        "postlink": "*"
    },
    "scripts": {
        "postinstall": "postlink"
    }
}

Define the folder containing your npm packages : npm config set postlink_path "${HOME}". postlink now runs after npm install ensuring node_modules/* packages are in sync with ${HOME}/*

Defining the folder containing npm packages

This config value is set using : npm config set postlink_path {value}. You can define many folders : npm config set postlink_path "${HOME}/GitHub;${HOME}/npm_packages"

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-67130.html

文章标题:prelink

回到顶部