[TIMOB-27181] CLI: add ability to install native modules via npm
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-10-02T14:32:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | CLI, iOS |
Labels | n/a |
Reporter | Brenton House |
Assignee | Ewan Harris |
Created | 2019-06-22T19:00:50.000+0000 |
Updated | 2019-10-02T14:32:11.000+0000 |
Description
Related to TIMOB-26352 because both would take advantage of npm and node_modules in the root directory of the project.
Specifically for native modules, the directories would not get copied to Resources directory like normal commonjs Titanium packages but would instead get "installed" by copying to the modules directory and modifying the
tiapp.xml file
to add those modules to the app.
One way of doing this would be to add a "titanium" property to the package.json
of the npm package that contains the native modules.
Possibly something like this:
"titanium": {
"nativeModules": true
}
As you're now aware, we already have this done: https://github.com/appcelerator/node-appc/pull/148 The larger issues that we don't have tickets for: - I limited it to only scan top-level modules, not nested to try and avoid native module collisions. native modules are "singletons" - you can't make use of multiple versions of the same module. I don't know that our tooling will see that and enforce it especially when looking at an app that may have multiple installs under the node_modules folder - We do not yet publish any of our native modules to npm. We need to modify our Jenkins builds to support it - When we do publish them, should we do so under a scoped name like
@titanium
,@appcelerator
,@appcelerator-modules
? - There's duplication of effort on the user's point in that just installing a native module through npm does not modify the tiapp.xml for them - they need to add it there themselves and make sure the versions match up. Maybe we can do some magic in some npm script hook that'd run post install and do it for them? - Our native modules with multiple platforms often have wildly varying versions between the Ones. What do we publish the npm package as? The higher of the two? Publish separate packages for each platform? - The npm package name and the module id do not have to match. Do we want to begin moving that way?[~cwilliams] - We can go ahead and close this one. I wasn't aware of the changes in node-appc when I created this ticket. We can just create separate tickets for the features in your list that we want to include.