Open lastmjs opened 7 years ago
Hi,
While working on https://github.com/Samsung/iotjs/issues/1441 maybe I can share some experiences.
1/ For trivial modules, I confirm that npm is usable without any tricks (use add node_modules to path)
I've been able to write and install some modules using npn and run them using iotjs:
For instance: https://github.com/rzr/mastodon-lite
2/ But I also noticed than in some cases dependencies can vary from iotjs to nodejs, so we would need to differentiate them in package.json
According to: https://docs.npmjs.com/files/package.json
dependencies: field is at top level, so we would need to override it for iotjs.
Let me illustrate this with blinkt package , https://www.npmjs.com/package/node-blinkt
I think iotjs support could be upstreamed easily
but manifest file will need to be adapted : https://github.com/Irrelon/node-blinkt/blob/master/package.json
To something like:
{
// nodejs dependencies
"dependencies:" {
"wiringpi-node": "2.4.4"
}
"engines": {
"node": "*"
"iotjs" : "*"
},
overrides: {
engines{ "iotjs": { "dependencies": {} } // will use gpio builtins
}
Or any better options, npm might be updated though I'll try to reach nodejs devs to see how we can align,
My 2c
Let me follow up to my previous comment.
I confirm that npm is totally satisfying the need (for pure JS modules at least), But in case if dependencies are differing then we can use npm to clone module from forked git (with updated dependencies for iotjs) instead of npm repo, I detailed it a bit at:
https://github.com/rzr/iotjs_modules
My earlier suggestion was for using packages from npm's repos, since dependencies will not be handled per runtime it will be hard to support several runtimes.
(well nothing is impossible, check my comments at: https://stackoverflow.com/questions/15176082/npm-package-json-os-specific-dependency/26069595#26069595 Maybe @lastmjs or other npm dev can share more insights about going trough current npm limitations ?).
The question is still open for building modules with native code (if OS support it and if not should iotjs be rebuilt ?)
Regards
I was looking at some slides from an IoT.js presentation, and one of the items under future work mentioned a package manager for IoT.js modules. I just want to say that I really hope that does not happen. Since NPM already exists, why not continue to use it and improve it, thus keeping the JS community unified and making IoT.js modules much more discoverable than they might be in a whole new package manager. I think we should keep with the existing NPM registry if at all possible.