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

Support for newer node versions #52

Closed Astrovic closed 2 years ago

Astrovic commented 3 years ago

I know this tool is old now, however I use it successfully to generate this module https://github.com/Astrovic/TiDropboxAPIv2 There is only one problem: every time I have to switch to node 8.x to make it work. If I use a higher version, I get the error attached below. Would it be possible to fix it? Thanks anyway đź‘Ť

  âś–  errors!
/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/bluebird/js/main/promise.js:680
            throw e;
            ^

RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 2792807700
    at checkInt (internal/buffer.js:68:11)
    at writeU_Int32LE (internal/buffer.js:688:3)
    at Buffer.writeInt32LE (internal/buffer.js:857:10)
    at Object.entryHeaderToBinary (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/adm-zip/headers/entryHeader.js:216:18)
    at Object.packHeader (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/adm-zip/zipEntry.js:260:39)
    at /Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/adm-zip/zipFile.js:198:41
    at Array.forEach (<anonymous>)
    at Object.compressToBuffer (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/adm-zip/zipFile.js:182:23)
    at Object.toBuffer (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/adm-zip/adm-zip.js:472:25)
    at writeModule (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/lib/packer-build.js:112:59)
    at /Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/bin/titaniumifier:48:16
    at tryCatcher (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/bluebird/js/main/promise.js:510:31)
    at Promise._settlePromiseAt (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/bluebird/js/main/promise.js:584:18)
    at Async._drainQueue (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (/Users/astrovic/.nvm/versions/node/v12.22.1/lib/node_modules/titaniumifier/node_modules/bluebird/js/main/async.js:133:10) {
  code: 'ERR_OUT_OF_RANGE'
}
ULSashido commented 2 years ago

Having same issue, I assume the bluebird npm needs a newer version

yuchi commented 2 years ago

As you can see it has nothing to do with Bluebird (which is just the Promises implementation) but with adm-zip:

/…/titaniumifier/node_modules/adm-zip/headers/entryHeader.js:216:18
                              ^^^^^^^

There’s a relatively easy solution, that is to upgrade adm-zip to the latest 0.5.x version. Everything should work (tests are passing on my machine). @Robbe92 Can you take care of it?

yuchi commented 2 years ago

This is what is required to make tests pass.

diff --git a/package.json b/package.json
index e6f560d..f4e35be 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
     "analysis"
   ],
   "dependencies": {
-    "adm-zip": "0.4.7",
+    "adm-zip": "0.5.9",
     "bluebird": "^2.5.1",
     "browserify": "^11.0.1",
     "commander": "^2.5.1",
@@ -50,12 +50,14 @@
   },
   "devDependencies": {
     "grunt": "^0.4.2",
+    "grunt-cli": "^0.1.13",
     "grunt-contrib-clean": "^0.6.0",
     "grunt-contrib-jshint": "^0.11.2",
     "grunt-mocha-test": "^0.12.4",
     "grunt-titanium": "^0.3.1",
     "grunt-zip": "^0.17.0",
     "longjohn": "^0.2.4",
+    "mocha": "^1.20.0",
     "moment": "^2.5.1",
     "reduce": "^1.0.1",
     "reduce-component": "^1.0.1",
yuchi commented 2 years ago

(By the way adding grunt-cli and mocha is required because both npm and Yarn nowadays do not install peer dependencies automatically for you)

yuchi commented 2 years ago

@Astrovic @ULSashido please use version 1.5.2. I briefly tested them on node 12 and 14, and tests passed.

Astrovic commented 2 years ago

Thanks a lot @yuchi!