-
Notifications
You must be signed in to change notification settings - Fork 19
Working on NMP modules
You can have instant, live changes to an npm module imported into your project's node_modules
directory. This can be done using npm link
Example usage: making changes to a local input plugin (input-plugin-foo), while seeing those changes live in your CMS (punchcard-instance-bar)
-
In the root of your module's directory (input-plugin-foo), type:
npm link
-
In the project (punchcard-instance-bar) that wants to use the local module (input-plugin-foo), delete
node_modules
rm -rf ./node_modules
-
In the project
package.json
(punchcard-instance-bar) remove references to the local module (input-plugin-foo) -
In the root of your project (punchcard-instance-bar) that wants to use the local module (input-plugin-foo), type:
npm link {{name-of-module}}
as in:npm link input-plugin-foo
-
Once that is complete, re-install all other npm modules
npm install
-
Add the local module back to the project's
package.json
file - making sure to use the version number of your local module"input-plugin-foo": "^0.0.2",
-
If you need to reinstall all node modules, or you're doing a fresh install, then your
npm link
may be lost -
Make sure to read the npm page on how to use npm link - it is very helpful
-
Make sure that module-a is still in package.json. You may need to change the url location, to the version number. So you would go from something like this:
"devDependencies": { "ava": "^0.12.0", "eslint": "2.2.0", "eslint-config-yourcompany": "git+ssh://git@github.yourcompany.com:user/javascript-style-guides.git#v1.1.0", "nyc": "^6.0.0", "tap-diff": "^0.1.1" },
to this:
```
"devDependencies": {
"ava": "^0.12.0",
"eslint": "2.2.0",
"eslint-config-company": "^1.1.0",
"nyc": "^6.0.0",
"tap-diff": "^0.1.1"
},
```
IBM has implemented a private npm repository for deploying out npm modules. However, there are a lot of issues with that system, not least of which is the inability for our CI tool, Travis, to use our private repository. SO, we're forced to reference non-npmjs-based node modules in our package.json files directly from our GitHub Enterprise repositories.
See the npm install information for an expanded version on how to install from various sources other than npmjs.
-
Get the ssh url for the module you want to use
-
In
package.json
, add module name and the full url, preceded bygit+ssh://
. Example:"input-plugin-text": "git+ssh://git@github.yourcompany.com:snath/input-plugin-text.git",
-
Modules gets installed when you run:
npm install
Working on Punchcard
Org Maintenance
Architecture Planning
These architectural discussions may be out-of-date given the current state of Punchcard.