Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27181] CLI: add ability to install native modules via npm

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2019-10-02T14:32:11.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsCLI, iOS
Labelsn/a
ReporterBrenton House
AssigneeEwan Harris
Created2019-06-22T19:00:50.000+0000
Updated2019-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
  }

Comments

  1. Christopher Williams 2019-06-28

    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?
  2. Brenton House 2019-06-28

    [~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.

JSON Source