nw-builder 4.5.0 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/cli.js +1 -1
- package/src/get.js +31 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nw-builder",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NW.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"lint": "eslint src/get.js",
|
|
46
46
|
"docs": "jsdoc -d docs ./src/get.js ./src/run.js ./src/bld.js",
|
|
47
|
-
"test": "node test/
|
|
47
|
+
"test": "node test/get.pre.js && node --test test/get.test.js",
|
|
48
48
|
"demo": "cd test/fixture && node demo.js"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
package/src/cli.js
CHANGED
package/src/get.js
CHANGED
|
@@ -84,6 +84,9 @@ import util from "./util.js";
|
|
|
84
84
|
* });
|
|
85
85
|
*/
|
|
86
86
|
async function get(options) {
|
|
87
|
+
if (fs.existsSync(options.cacheDir) === false) {
|
|
88
|
+
await fsm.mkdir(options.cacheDir, { recursive: true });
|
|
89
|
+
}
|
|
87
90
|
await getNwjs(options);
|
|
88
91
|
if (options.ffmpeg === true) {
|
|
89
92
|
await getFfmpeg(options);
|
|
@@ -123,7 +126,12 @@ const getNwjs = async (options) => {
|
|
|
123
126
|
});
|
|
124
127
|
} else {
|
|
125
128
|
fs.createReadStream(out)
|
|
126
|
-
.pipe(unzipper.Extract({ path: options.cacheDir }))
|
|
129
|
+
.pipe(unzipper.Extract({ path: options.cacheDir }))
|
|
130
|
+
.on("finish", async () => {
|
|
131
|
+
if (options.platform === "osx") {
|
|
132
|
+
await createSymlinks(options);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
127
135
|
}
|
|
128
136
|
return;
|
|
129
137
|
}
|
|
@@ -194,7 +202,12 @@ const getNwjs = async (options) => {
|
|
|
194
202
|
});
|
|
195
203
|
} else {
|
|
196
204
|
fs.createReadStream(out)
|
|
197
|
-
.pipe(unzipper.Extract({ path: options.cacheDir }))
|
|
205
|
+
.pipe(unzipper.Extract({ path: options.cacheDir }))
|
|
206
|
+
.on("finish", async () => {
|
|
207
|
+
if (options.platform === "osx") {
|
|
208
|
+
await createSymlinks(options);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
198
211
|
}
|
|
199
212
|
}
|
|
200
213
|
|
|
@@ -346,4 +359,20 @@ const getNodeHeaders = async (options) => {
|
|
|
346
359
|
);
|
|
347
360
|
}
|
|
348
361
|
|
|
362
|
+
const createSymlinks = async (options) => {
|
|
363
|
+
const frameworksPath = path.join(process.cwd(), options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, "nwjs.app", "Contents", "Frameworks", "nwjs Framework.framework");
|
|
364
|
+
const symlinks = [
|
|
365
|
+
path.join(frameworksPath, "Helpers"),
|
|
366
|
+
path.join(frameworksPath, "Libraries"),
|
|
367
|
+
path.join(frameworksPath, "nwjs Framework"),
|
|
368
|
+
path.join(frameworksPath, "Resources"),
|
|
369
|
+
path.join(frameworksPath, "Versions", "Current"),
|
|
370
|
+
];
|
|
371
|
+
for await (const symlink of symlinks) {
|
|
372
|
+
const link = String(await fsm.readFile(symlink));
|
|
373
|
+
await fsm.rm(symlink);
|
|
374
|
+
await fsm.symlink(link, symlink);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
349
378
|
export default get;
|