Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Handle file: protocol modules #81

Closed

Conversation

suprememoocow
Copy link

This pull request attempts to solve #61.

We're using file: protocols for "local" modules: in other words, modules that are not published to a registry, and are in the same repository as the main code base. Doing this gives us better dependency management and the ability to break the modules out into full-blown npm modules at a later stage without having to untangle dependencies, etc.

In the package.json we declare a dependency like:

  "dependencies": {
   "local-module-xyz": "file:modules/xyz" 
  }

In our code, we can then reference this module like so

var xyz = require("local-module-xyz");

Currently npm-shrinkwrap doesn't support file protocol modules but I'd really like it if it did.

Feedback would be appreciated.

Note that I've updated the npm dependency to 2.12.0. I'm not sure if you're using such an old npm version for any reason?

@suprememoocow
Copy link
Author

I've just noticed that #80 allows adds the ability to use the global npm via a switch. This would probably be preferable to changing the version packaged with npm-shrinkwrap (and would fix the broken test which I've yet to sort out).

Do you think it would be worth rebasing my changes onto PR #80 and dropping the npm version change?

@ghost
Copy link

ghost commented Jul 15, 2015

Hi, I've tried your changes in my project and still had some problems with nested file modules.
If we declare the following dependency in our main package.json

"name": "main",
"dependencies": {
  "local-module-a": "file:modules/a" 
}

and have a nested dependency in modules/a like

"name": "a",
"dependencies": {
  "local-module-b": "file:../b" 
}

the npm install gets a false relative path to the nested module.

robario added a commit to robario/npm-shrinkwrap that referenced this pull request Aug 16, 2016
robario added a commit to robario/npm-shrinkwrap that referenced this pull request Aug 16, 2016
robario added a commit to robario/npm-shrinkwrap that referenced this pull request Aug 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant