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

Zip module issue #32

Closed inakiabt closed 9 years ago

inakiabt commented 9 years ago

I don't know if is my environment, but somehow when unzipping the zip file generated by titaniumifier with grunt-zip I get all files empty: _users_inakiabt_src_titanium_reste

Unzipping manually with unzip cli works as expected.

Here's my Gruntfile.js

    grunt.initConfig({
        unzip: {
            mod: {
                src: [
                    'dist/reste-commonjs-1.0.0.zip'
                ],
                dest: '.'
            }
        },
        titaniumifier: {
            "build": {
                files: {
                    'dist': ['.']
                },
                options: {
                    bundle: true,
                    module: true
                }
            }
        },
    });
    grunt.loadNpmTasks('grunt-titaniumifier');
    grunt.loadNpmTasks('grunt-zip');

    grunt.registerTask('app:setup', [
        'titaniumifier:build',
        'unzip:mod'
    ]);

I found that unzipping it with unzip cli, zip the result module folder with zip cli and then unzip it again with grunt unzip:mod works as expected too.

Also I tried your Gruntfile.js from https://github.com/smclab/grunt-titaniumifier/blob/master/Gruntfile.js and I get empty files too after run grunt test:ios.

Could be an incompatibility between adm-zip (used by titaniumifier) and jszip (used by grunt-zip)? I found this adm-zip issue https://github.com/cthackers/adm-zip/issues/102 but I guess is not related.

Unzipping the zip file generated by titaniumifier programmatically with adm-zip works as expected:

var AdZip = require('adm-zip');
var zip = new AdZip('./reste-commonjs-1.0.0.zip');
zip.extractAllTo('.');
yuchi commented 9 years ago

That‘s very strange. See here.

I’ll look into it.

inakiabt commented 9 years ago

Yep. I'm also getting empty files for module-a and module-c. Are you getting empty files too?

yuchi commented 9 years ago

Argh. Yes.

yuchi commented 9 years ago

The ‘culprit’ is in fact v0.4.7 of adm-zip. If you install v0.4.6 it works perfectly. I’ll look into it.

yuchi commented 9 years ago

I’ll just fix the version to 0.4.6. adm-zip is not enough solid.

jszip looks way less naïve, with actually working tests. I’ll move titaniumifier ASAP.

In the meanwhile you can work by running npm install adm-zip 0.4.6

inakiabt commented 9 years ago

That worked :+1:

yuchi commented 9 years ago

A clean install should work.

$ git clone git@github.com:smclab/titaniumifier.git
$ cd titaniumifier
$ npm install
$ grunt titanium # opens the iOS simulator

I also release v1.3.3 with the pinned adm-zip so you can rm -rf node_modules && npm i in the project you were working on and everything should work correctly.

Please let me know.