smclab / titaniumifier

Get a Titaniumâ„¢ SDK CommonJS module out of a Node package!
GNU Lesser General Public License v2.1
95 stars 15 forks source link

linking to submodules #39

Closed AppWerft closed 8 years ago

AppWerft commented 9 years ago

Hello,

how can I link modules as submodule.

https://github.com/AppWerft/Ti.YoutubeProxy

Cheers!

Rainer

yuchi commented 9 years ago

We extended the package.json spec to include references to native packages. It follows the shape of the other deps declarations:

{
  "dependencies": { "pkg": "^1.2.3" },
  "nativeDependencies": { "some.ti.module": "1.2.2" }
}

You get 2 boosts from using this notation:

  1. you can require() them and the call will pass to the Titanium implementation, therefore requiring the actual module, and
  2. once published, when your module is installed through gitTio it will also pull those modules if available.
yuchi commented 9 years ago

I hope it solves you issue. Re-open if you feel it's necessary.

AppWerft commented 9 years ago

I have embedded by

"nativeDependencies": {
       "./lib/ts.httprequest" : "*",
       "./lib/ts.videoprovider" :"*",
       "./lib/ti.promises" : "*"
  },

In my module I have to use:

ar HTTPRequest = require('./lib/ts.httprequest/ts.httprequest');
var VideoProvider = require('./lib/ts.videoprovider/ts.videoprovider');
var Promise = require('./lib/org.favo.promise');

Without this double reference the modules are not found.

videoprovider depends on twice subsubmodules and now this subsub modules are not found:

Error: Cannot find module './lib/ts.cryptojs256/ts.cryptojs256.js' from '/Users/fuerst/Documents/Appcelerator_Studio_Workspace/Ti.YoutubeProxy/lib/ts.videoprovider'

Any ideas?

yuchi commented 9 years ago

Ok. So, first of all lets force some terms in the discussion:

If you want to use Titanium modules in your titaniumified package, follow the mini-guide above. If those modules are titaniumified packages themselves you need to add theirs nativeDependencies on top of yours. Sad but required, consider it a workaround.

If those are packages (titaniumified or not) and they are published through npm (they should!) you can add them as simple deoendencies and let npm handle the installation. If they are neither available through gitTio nor npm you are left with copy paste or got sub modules. Avoid this scenario as much as possible.

yuchi commented 9 years ago

I'm reopening as I'm pretty sure I'm not hitting your scenario 😖

I'll have a look at the source and try to be more specific and on point.

yuchi commented 8 years ago

Did you solve your issue?

Please re-open if you feel this is not ‘closed’ :)