thom4parisot / grunt-crx

Grunt task used to package private Chrome Extensions.
https://npmjs.com/grunt-crx
MIT License
118 stars 21 forks source link

Excludes applied too late #37

Closed joscha closed 9 years ago

joscha commented 9 years ago

When trying to package the chrome extension with a node_modules folder on the same level as the manifest, the task fails with

Running "crx:dev" (crx) task
Verifying property crx.dev exists in config...OK
Files: ./ -> ../mailfred-chrome-extension-2.0.0-dev.crx
Reading /Users/joscha/Development/xyz/extension/chrome/node_modules/grunt-crx/lib/../data/config-default.json...OK
Parsing /Users/joscha/Development/xyz/extension/chrome/node_modules/grunt-crx/lib/../data/config-default.json...OK
Reading ../chrome.pem...OK
Reading manifest.json...OK
Parsing manifest.json...OK
Reading package.json...OK
Parsing package.json...OK
Fatal error: ENAMETOOLONG, open 'tmp/crx-crq0kc1aalw/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/node_modules/grunt-contrib-less/node_modules/less/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js'

probably due to copying the node_modules folder as I can see from the created tmp-XXXXXXX directory. Even though I have defined the node_modules folder to be an exclusion glob:

        "exclude": [
          "js/src/*",
          "js/build/*.coffee.js",
          "**/*.map",
          "node_modules/**"
        ]
joscha commented 9 years ago

@oncletom how about we pass the exclude list into the load method of the crx module and pass them on to wrench - that way we don't have to delete files afterwards, we are just not copying them in the first place. Would you merge a combined PR effort on those two projects?

thom4parisot commented 9 years ago

Hey :-)

Yes of course it would make sense. Although have a look at #36: the globbing has been improved by matching grunt src/dest configuration. I think it would solve this issue.

It just needs to be tested against a real world project before being merged.

What do you think?

joscha commented 9 years ago

ah, nice - yes, that is much better - also goes hand in hand that I actually also need a zip file (for the Chrome webstore) with the same contents as the CRX. What is still missing for #36? Only a test?

thom4parisot commented 9 years ago

Glad to know it works better :-) Thanks for the rebase!

Aso related to your zip need, follow up the thoughts on #19 and it should not be that hard: it's about using src.loadContents and providing to forward the resulting buffer twice, to crx.pack() and fs.writeFile.

A tiny chunk of work is required to be able to untight loadContents from pack, as captured by oncletom/crx#23.

thom4parisot commented 9 years ago

And oncletom/crx#23 will do the unsigned archive job.

joscha commented 9 years ago

Thanks @oncletom. I just tried integrating crx#2.0.0 into grunt-crx - there are some errors in the tests I am not sure how to handle, yet. I will create a PR that references this issue once I got it working.