From 5a9e8843cc1443d5bcc10c40c51734d161f8c94a Mon Sep 17 00:00:00 2001 From: Adam Lynch Date: Sun, 16 Nov 2014 16:02:00 +0000 Subject: [PATCH 1/6] Switching to graceful-ncp to avoid EMFILE errors, etc --- lib/downloader.js | 2 +- package.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/downloader.js b/lib/downloader.js index dd09a6967..abee9ebfe 100644 --- a/lib/downloader.js +++ b/lib/downloader.js @@ -7,7 +7,7 @@ var zlib = require('zlib'); var tar = require('tar-fs'); var temp = require('temp'); var DecompressZip = require('decompress-zip'); -var ncp = require('ncp').ncp; +var ncp = require('graceful-ncp').ncp; var rimraf = require('rimraf'); // Automatically track and cleanup files at exit diff --git a/package.json b/package.json index 0f87b11b8..671a6f669 100644 --- a/package.json +++ b/package.json @@ -31,10 +31,9 @@ "archiver": "^0.10.0", "bluebird": "~1.2.2", "decompress-zip": "0.0.8", - "fs-extra": "^0.10.0", + "fs-extra": "git://github.com/adam-lynch/node-fs-extra#graceful-fs", "inherits": "~2.0.1", "lodash": "~2.4.1", - "ncp": "^0.6.0", "optimist": "^0.6.1", "rcedit": "0.2.0", "plist": "^1.0.0", @@ -47,6 +46,7 @@ "temp": "~0.7.0", "update-notifier": "^0.1.8", "winresourcer": "^0.9.0", - "platform-overrides": "~0.3.0" + "platform-overrides": "~0.3.0", + "graceful-ncp": "0.0.1" } } From cf48aeb1ab0ab5ddcd460e8192915219e554e2f0 Mon Sep 17 00:00:00 2001 From: Adam Lynch Date: Sun, 16 Nov 2014 16:53:35 +0000 Subject: [PATCH 2/6] Switching to graceful-ncp to avoid EMFILE errors, etc --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 671a6f669..43256cdfd 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "archiver": "^0.10.0", "bluebird": "~1.2.2", "decompress-zip": "0.0.8", - "fs-extra": "git://github.com/adam-lynch/node-fs-extra#graceful-fs", + "fs-extra": "git://github.com/adam-lynch/node-fs-extra#graceful-ncp", "inherits": "~2.0.1", "lodash": "~2.4.1", "optimist": "^0.6.1", From 22e20bb80f89a97d7e6ae4123cdb678c424ecabf Mon Sep 17 00:00:00 2001 From: Felix Schlitter Date: Sun, 23 Nov 2014 12:33:28 +1300 Subject: [PATCH 3/6] Use `archive.bulk()` to avoid EMFILE errors As per the documentation, the `archive.bulk()` call promises to avoid EMFILE errors (too many open files). --- lib/utils.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 982259d25..15071b311 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -125,14 +125,20 @@ module.exports = { archive.on('error', reject); // Add the files - files.forEach(function (file) { + var filesBulk = []; + files.forEach(function(file){ if(file.dest === 'package.json' && platformSpecificManifest){ archive.append(platformSpecificManifest, {name: 'package.json'}); } - else { - archive.file(file.src, { name:file.dest }); + else + { + filesBulk.push({ + src: file.src, + data: { name: file.dest } + }); } - }); + }) + archive.bulk(filesBulk) // Some logs archive.on('entry', function (file) { From c75cf7fe157d9a2a26710f9942d2215c9be41571 Mon Sep 17 00:00:00 2001 From: Adam Lynch Date: Wed, 26 Nov 2014 19:13:57 +0000 Subject: [PATCH 4/6] Fix for Mac building typo See #100 --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index fa19af8df..4147a9e34 100644 --- a/lib/index.js +++ b/lib/index.js @@ -419,7 +419,7 @@ NwBuilder.prototype.mergeAppFiles = function () { // zip just copy the app.nw copiedFiles.push(Utils.copyFile( self.getZipFile(name), - path.resolve(platform.releasePath, self.options.appName+'.app', 'Contents', 'Resources', 'nw.icns') + path.resolve(platform.releasePath, self.options.appName+'.app', 'Contents', 'Resources', 'app.nw') )); } } else { From b69eca876c6ed4a7b8a684a86a0fce14d100d248 Mon Sep 17 00:00:00 2001 From: Adam Lynch Date: Sun, 30 Nov 2014 16:04:52 +0000 Subject: [PATCH 5/6] Fix for broken zip test --- lib/utils.js | 5 ++++- test/utils.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 15071b311..1e6b0dd77 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -134,7 +134,10 @@ module.exports = { { filesBulk.push({ src: file.src, - data: { name: file.dest } + data: { name: path.basename(file.dest) }, + expand: true, + flatten: true, + dest: path.dirname(file.dest) }); } }) diff --git a/test/utils.js b/test/utils.js index 70f70addc..39cab7822 100644 --- a/test/utils.js +++ b/test/utils.js @@ -132,7 +132,7 @@ test('should zip the app and create the app.nw file + log it', function (t) { utils.generateZipFile(files, _evt).then(function(nwfile) { var unzipper = new DecompressZip(nwfile); unzipper.on('list', function (files) { - t.deepEqual(expected, files); + t.deepEqual(files, expected); }); unzipper.list(); }); From e5e951fd9e5d97fee871229f0005b40cd6d45902 Mon Sep 17 00:00:00 2001 From: Adam Lynch Date: Fri, 12 Dec 2014 20:07:23 +0000 Subject: [PATCH 6/6] Using graceful-fs-extra & newest platform-overrides --- lib/index.js | 2 +- lib/utils.js | 2 +- package.json | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 4147a9e34..eb0cad310 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2,7 +2,7 @@ var Promise = require('bluebird'); var _ = require('lodash'); var inherits = require('inherits'); var EventEmitter = require('events').EventEmitter; -var fs = require('fs-extra'); +var fs = require('graceful-fs-extra'); var path = require('path'); var url = require('url'); var winresourcer = Promise.promisify(require('winresourcer')); diff --git a/lib/utils.js b/lib/utils.js index 1e6b0dd77..c6b96ec46 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,4 +1,4 @@ -var fs = require('fs-extra'); +var fs = require('graceful-fs-extra'); var path = require('path'); var _ = require('lodash'); var Promise = require('bluebird'); diff --git a/package.json b/package.json index 43256cdfd..956ade636 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "archiver": "^0.10.0", "bluebird": "~1.2.2", "decompress-zip": "0.0.8", - "fs-extra": "git://github.com/adam-lynch/node-fs-extra#graceful-ncp", "inherits": "~2.0.1", "lodash": "~2.4.1", "optimist": "^0.6.1", @@ -46,7 +45,8 @@ "temp": "~0.7.0", "update-notifier": "^0.1.8", "winresourcer": "^0.9.0", - "platform-overrides": "~0.3.0", - "graceful-ncp": "0.0.1" + "platform-overrides": "~1.0.0", + "graceful-ncp": "0.0.1", + "graceful-fs-extra": "~1.0.0" } }