nw 0.81.0-3-sdk → 0.81.0-4
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/bin/{nw → nw.js}
RENAMED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const { spawn } = require('node:child_process');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const process = require('node:process');
|
|
7
|
+
|
|
8
|
+
const { copyAssets } = require('../lib/app_assets.js');
|
|
9
|
+
const findpath = require('../lib/findpath.js').findpath;
|
|
7
10
|
|
|
8
11
|
function run() {
|
|
9
12
|
// Rename nw.js's own package.json as workaround for https://github.com/nwjs/nw.js/issues/1503
|
|
@@ -16,7 +19,7 @@ function run() {
|
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
// copy over any asset files (icons, etc) specified via CLI args:
|
|
19
|
-
|
|
22
|
+
copyAssets(process.platform, findpath());
|
|
20
23
|
|
|
21
24
|
// Normalize cli args
|
|
22
25
|
var args = process.argv.slice(2);
|
|
@@ -28,7 +31,7 @@ function run() {
|
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
// Spawn node-webkit
|
|
31
|
-
var nw = spawn(
|
|
34
|
+
var nw = spawn(findpath(), args, { stdio: 'inherit' });
|
|
32
35
|
nw.on('close', function() {
|
|
33
36
|
process.nextTick(function() {
|
|
34
37
|
process.exit(0);
|
|
@@ -45,7 +48,7 @@ function run() {
|
|
|
45
48
|
}, 1000);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
if (!fs.existsSync(
|
|
51
|
+
if (!fs.existsSync(findpath())) {
|
|
49
52
|
console.log('nw.js appears to have failed to download and extract. Attempting to download and extract again...');
|
|
50
53
|
var child = spawn(process.execPath, [path.resolve(__dirname, '..', 'scripts', 'install.js')], { stdio: 'inherit' });
|
|
51
54
|
child.on('close', run);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { join, resolve } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
1
|
+
const { env, platform } = require('node:process');
|
|
2
|
+
const { join, resolve } = require('node:path');
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Get the platform dependant path of the NW.js or ChromeDriver binary.
|
|
@@ -9,8 +7,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
9
7
|
* @param {'nwjs' | 'chromedriver'} executable Path to NW.js or Chromedriver executable.
|
|
10
8
|
* @return {string}
|
|
11
9
|
*/
|
|
12
|
-
|
|
13
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
function findpath(executable = 'nwjs') {
|
|
14
11
|
const nwDir = resolve(__dirname, '..', 'nwjs');
|
|
15
12
|
/**
|
|
16
13
|
* File path to executable.
|
|
@@ -56,3 +53,5 @@ export default function findpath(executable = 'nwjs') {
|
|
|
56
53
|
|
|
57
54
|
return binPath;
|
|
58
55
|
}
|
|
56
|
+
|
|
57
|
+
module.exports = { findpath };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const { createWriteStream, existsSync } = require('node:fs');
|
|
2
|
+
const { rename, rm } = require('node:fs/promises');
|
|
3
|
+
const { get } = require('node:https');
|
|
4
|
+
const { resolve } = require('node:path');
|
|
5
|
+
const { arch, env, platform, exit } = require('node:process');
|
|
6
|
+
const { URL } = require('node:url');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const compressing = require('compressing');
|
|
9
|
+
const progress = require('cli-progress');
|
|
10
|
+
const semver = require('semver');
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const nodeManifest = require('../package.json');
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
install()
|
|
15
|
+
.then(() => {})
|
|
16
|
+
.catch((error) => console.error(error));
|
|
15
17
|
|
|
16
18
|
async function install() {
|
|
17
19
|
|
|
@@ -27,8 +29,6 @@ async function install() {
|
|
|
27
29
|
arm64: 'arm64',
|
|
28
30
|
};
|
|
29
31
|
|
|
30
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
31
|
-
|
|
32
32
|
/**
|
|
33
33
|
* URL to download or get binaries from.
|
|
34
34
|
*
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nw",
|
|
3
|
-
"version": "0.81.0-
|
|
3
|
+
"version": "0.81.0-4",
|
|
4
4
|
"description": "A installer for nw.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git://github.com/nwjs/npm-installer.git"
|
|
8
8
|
},
|
|
9
|
-
"main": "lib/findpath.
|
|
9
|
+
"main": "lib/findpath.js",
|
|
10
10
|
"bin": {
|
|
11
|
-
"nw": "bin/nw"
|
|
11
|
+
"nw": "bin/nw.js"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"postinstall": "node lib/install.
|
|
15
|
-
"test": "node --test-reporter=spec --test test/index.
|
|
14
|
+
"postinstall": "node lib/install.js",
|
|
15
|
+
"test": "node --test-reporter=spec --test test/index.js",
|
|
16
|
+
"dry-run": "nw ./test/app"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"lib",
|
|
@@ -47,4 +48,4 @@
|
|
|
47
48
|
"desktop",
|
|
48
49
|
"application"
|
|
49
50
|
]
|
|
50
|
-
}
|
|
51
|
+
}
|