Local version of npm packages?
Closed this issue · 8 comments
People who are used to local Atmosphere packages
http://guide.meteor.com/using-packages.html#atmosphere-overriding
may wonder what the closest equivalent is for npm?
Probably npm link, right? https://docs.npmjs.com/cli/link
Would be happy to accept a PR with some content about how to use that command.
Thanks, is there a dir it can go in so that it's committed to the same repo? Is packages/
fine?
cd meteor-app/
# link to ./node_modules
meteor npm link ./packages/local-npm-package
# I don't know how to add it to package.json. Manually?
# This doesn't work – overwrites with published npm version:
# meteor npm install --save local-npm-package
I think the workflow with NPM isn't as smooth as with Meteor local packages, so I honestly don't know what the right approach is. It always takes me like half an hour to get NPM link to do what I want... leading to the need for this article.
You can commit something inside node_modules/
?
On Thu, 14 Apr 2016 at 14:31 Sashko Stubailo notifications@github.com
wrote:
I think the workflow with NPM isn't as smooth as with Meteor local
packages, so I honestly don't know what the right approach is. It always
takes me like half an hour to get NPM link to do what I want... leading to
the need for this article.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#378 (comment)
Heh, that's better
- create module in
node_modules/my-local
git add -f node_modules/my-local
- manually add
my-local: ^version
topackage.json
Probably it should be my-local: version
(i.e. exact version).
I'm not really sure if this is best practice, but if it works, great!
Why exact? So that if you change the local package version, it will stop working until you also change the app/package.json
version? If this is the desired effect, it's not what actually happens:
If you specify exact version 8.4.9
in app/package.json, and change app/node_modules/pkg/package.json to version 8.4.10
, npm ll
says there's an error, but I'm still able to require it on the client.
> npm ll intl-tel-input
parlay@0.2.0
│ /Users/me/parlay
│ challenge your friends
│ git+https://github.com/parlaywithme/parlay.git
│ https://github.com/parlaywithme/parlay
└── intl-tel-input@8.4.10 invalid
A jQuery plugin for entering international telephone numbers
git+https://github.com/jackocnr/intl-tel-input.git
https://github.com/jackocnr/intl-tel-input#readme
npm ERR! invalid: intl-tel-input@8.4.10 /Users/me/parlay/node_modules/intl-tel-input
^version
looks like the default for npm i --save
.
Right, so in a sense what's in version
doesn't matter because we aren't doing an npm install
.