nw-builder 3.8.7 → 3.8.9

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021-2023 NW.js Utilities
4
+ Copyright (c) 2014-2021 Steffen Müller
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ the Software, and to permit persons to whom the Software is furnished to do so,
11
+ subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # nw-builder
2
2
 
3
- [![npm](https://img.shields.io/npm/v/nw-builder/stable)](https://www.npmjs.com/package/nw-builder)
4
- [![Join the chat at https://gitter.im/nwjs/nw-builder](https://badges.gitter.im/nwjs/nw-builder.svg)](https://gitter.im/nwjs/nw-builder?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
+ [![npm](https://img.shields.io/npm/v/nw-builder/stable)](https://www.npmjs.com/package/nw-builder/v/stable)
4
+ [![Join the chat at https://gitter.im/nwjs/nw-builder](https://badges.gitter.im/repo.svg)](https://app.gitter.im/#/room/#nwjs_nw-builder:gitter.im)
5
5
 
6
6
  Build [NW.js](https://github.com/nwjs/nw.js) applications for Mac, Windows and Linux.
7
7
 
@@ -12,6 +12,7 @@ For version 4, please go to the [corresponding branch](https://github.com/nwutil
12
12
  - [Installation](https://github.com/nwutils/nw-builder#installation)
13
13
  - [Usage](https://github.com/nwutils/nw-builder#usage)
14
14
  - [API Reference](https://github.com/nwutils/nw-builder#api-reference)
15
+ - [Migration Guide v3->v4](https://github.com/nwutils/nw-builder#migration)
15
16
  - [Contributing](https://github.com/nwutils/nw-builder#contributing)
16
17
  - [License](https://github.com/nwutils/nw-builder#license)
17
18
 
@@ -327,6 +328,209 @@ To get around it, run `ulimit -n 1024` (or add it to your `~/.bash_profile`). Fo
327
328
 
328
329
  This project was created by [Steffen Müller](https://github.com/steffenmllr) and has been maintained by [Gabe Paez](https://github.com/gabepaez), [Andy Trevorah](https://github.com/trevorah), [Adam Lynch](https://github.com/adam-lynch) and [Rémy Boulanouar](https://github.com/DblK) in the past. This project is currently maintained by [Ayushman Chhabra](https://github.com/ayushmxn).
329
330
 
331
+ ## Migration
332
+
333
+ ## Migration Guide (v3 -> v4)
334
+
335
+ > We are working on making the migration process smoother. If you encounter any issues with the current guide, please open an issue or start a discussion.
336
+
337
+ ### Update `nw-builder`
338
+
339
+ With npm:
340
+
341
+ ```shell
342
+ npm update nw-builder@latest
343
+ ```
344
+
345
+ With yarn:
346
+
347
+ ```shell
348
+ yarn upgrade nw-builder@latest
349
+ ```
350
+
351
+ With pnpm:
352
+
353
+ ```shell
354
+ pnpm update nw-builder@latest
355
+ ```
356
+
357
+ ### Update options
358
+
359
+ Let's take an example of v3 code and migrate it to v4.
360
+
361
+ ```javascript
362
+ const NwBuilder = require("nw-builder");
363
+
364
+ const nw = new NwBuilder({
365
+ files: ["./nwapp/**/*", "./other/**/*.js"],
366
+ version: "latest",
367
+ flavor: "normal",
368
+ platforms: ["win32", "win64", "osx32", "osx64", "linux32", "linux64"],
369
+ cacheDir: "./cache",
370
+ buildDir: "./build",
371
+ buildType: "versioned",
372
+ forceDownload: true,
373
+ appName: "nwdemo",
374
+ appVersion: "0.1.0",
375
+ argv: "--nw-stderr-logging",
376
+ macCredits: "./nwapp/credits.html",
377
+ macIcns: "./nwapp/mac.icns",
378
+ macPlist: { ... },
379
+ winVersionString: { ... },
380
+ winIco: "./nwapp/win.ico",
381
+ zip: true,
382
+ macZip: false,
383
+ mergeZip: false,
384
+ });
385
+
386
+ nw.build();
387
+ ```
388
+
389
+ Update the import path
390
+
391
+ ```diff
392
+ -const NwBuilder = require("nw-builder");
393
+ +const nwbuild = require("nw-builder");
394
+ ```
395
+
396
+ Replace the `NwBuilder` initialization with a function
397
+
398
+ ```diff
399
+ -const nw = new NwBuilder({
400
+ +await nwbuild({
401
+ ```
402
+
403
+ The `files` property has been renamed to `srcDir`.
404
+
405
+ ```diff
406
+ - files: ["./nwapp/**/*", "./other/**/*.js"],
407
+ + srcDir: "./nwapp/**/* ./other/**/*.js",
408
+ ```
409
+
410
+ Add the `mode` option and remove the now redundant `nw.build` function call. The `build` call is made by `nwbuild` internally.
411
+
412
+ ```diff
413
+ + mode: "build",
414
+
415
+ -nw.build();
416
+ ```
417
+
418
+ The `platforms` option has been removed and replaced with `platform` and `arch`. Notice that one `nwbuild` function call now creates one build for one platform and one arch only.
419
+
420
+ ```diff
421
+ - platforms: ["win32", "win64", "osx32", "osx64", "linux32", "linux64"],
422
+ + platform: "linux", // "osx" for MacOS "win", for Windows
423
+ + arch: "x64", // "ia32" for 32 bit or "arm64" for arm based 65 bit architectures
424
+ ```
425
+
426
+ The `buildDir` option has been rename to `outDir`.
427
+
428
+ ```diff
429
+ - buildDir: "./build",
430
+ + outDir: "./build",
431
+ ```
432
+
433
+ The `buildType` option has been removed.
434
+
435
+ ```diff
436
+ - buildType: "versioned",
437
+ ```
438
+
439
+ The `forceDownload` option has been changed to `cache`.
440
+
441
+ ```diff
442
+ - forceDownload: true,
443
+ + cache: false,
444
+ ```
445
+
446
+ The `appName` option has been changed to `app.name`.
447
+
448
+ ```diff
449
+ - appName: "nwdemo",
450
+ + app: { name: "nwdemo" },
451
+ ```
452
+
453
+ The `appVersion` option has been changed to `app.version`.
454
+
455
+ ```diff
456
+ - appVersion: "0.1.0",
457
+ + app: { version: "0.1.0" },
458
+ ```
459
+
460
+ The `macCredit` option has been removed.
461
+
462
+ ```diff
463
+ - macCredits: "./nwapp/credits.html",
464
+ ```
465
+
466
+ The `macIcns` option has been replaced with `icon`.
467
+
468
+ ```diff
469
+ - macIcns: "./nwapp/mac.icns",
470
+ + icon: "./nwapp/mac.icns",
471
+ ```
472
+
473
+ The `macPlist` option has been replaced by `app.*` options. Consult the [documentation](https://nwutils.io/nw-builder/mode-build.html#osxrc-object) for valid properties.
474
+
475
+ ```diff
476
+ - macPlist: { ... },
477
+ + app: { ... },
478
+ ```
479
+
480
+ The `winVersionString` option has been replaced with `app`. Consult the [documentation](https://nwutils.io/nw-builder/mode-build.html#winrc-object) for valid properties.
481
+
482
+ ```diff
483
+ - winVersionString: {
484
+ - 'CompanyName': 'Some Company',
485
+ - 'FileDescription': 'Process Name',
486
+ - 'ProductName': 'Some Product',
487
+ - 'LegalCopyright': 'Copyright 2017',
488
+ - }
489
+ + app: {
490
+ + company: "Some Company",
491
+ + fileDescription: "Process Name",
492
+ + productName: "Some Product",
493
+ + legalCopyright: "Copyright (c) 2023",
494
+ + }
495
+ ```
496
+
497
+ The `winIco` option has been replaced by `app.icon`.
498
+
499
+ ```diff
500
+ - winIco: "./nwapp/win.ico",
501
+ + app: { icon: "./nwapp/win.ico" },
502
+ ```
503
+
504
+ The `macZip` option has been removed.
505
+
506
+ ```diff
507
+ - macZip: false,
508
+ ```
509
+
510
+ The `mergeZip` option has been removed.
511
+
512
+ ```diff
513
+ - mergeZip: false,
514
+ ```
515
+
516
+ The final code should look like this.
517
+
518
+ ```javascript
519
+ const { nwbuild } = require("nw-builder");
520
+
521
+ await nwbuild({
522
+ srcDir: "./nwapp/**/* ./other/**/*.js",
523
+ mode: "build",
524
+ version: "latest",
525
+ flavor: "normal",
526
+ platform: "linux",
527
+ arch: "x64",
528
+ outDir: "./build",
529
+ cache: false,
530
+ app: { ... },
531
+ });
532
+ ```
533
+
330
534
  ## Contributing
331
535
 
332
536
  ### Getting Started
@@ -3,7 +3,7 @@
3
3
  const yargs = require("yargs/yargs");
4
4
  const { hideBin } = require("yargs/helpers");
5
5
 
6
- const { nwbuild } = require("../lib/index.cjs");
6
+ const { nwbuild } = require("./index.cjs");
7
7
  const { detectCurrentPlatform } = require("../dist/index.cjs");
8
8
 
9
9
  const cli = yargs(hideBin(process.argv))
package/lib/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- const { basename, resolve } = require("node:path");
2
- const { version } = require("node:process");
3
- const { mkdir, cp, rm, rename } = require("node:fs/promises");
4
- const { readFileSync } = require("node:fs");
1
+ const fs = require("node:fs");
2
+ const path = require("node:path");
3
+ const process = require("node:process");
4
+
5
+ const _ = require("lodash");
5
6
  const glob = require("simple-glob");
6
- var _ = require("lodash");
7
- var fs = require("graceful-fs-extra");
8
- var path = require("path");
9
- var thenify = require("thenify");
10
- var rcedit = require("rcedit");
11
- var winresourcer = thenify(require("winresourcer"));
12
- var semver = require("semver");
13
- var platformOverrides = require("./platformOverrides.cjs");
7
+ const gfs = require("graceful-fs-extra");
8
+ const thenify = require("thenify");
9
+ const rcedit = require("rcedit");
10
+ const winresourcer = thenify(require("winresourcer"));
11
+ const semver = require("semver");
12
+ const platformOverrides = require("./platformOverrides.cjs");
13
+ const NwVersions = require("./versions.cjs");
14
+ const Utils = require("./utils.cjs");
14
15
 
15
16
  const {
16
- checkCache,
17
17
  get,
18
18
  getReleaseInfo,
19
19
  isCached,
@@ -24,23 +24,20 @@ const {
24
24
  run,
25
25
  validate,
26
26
  } = require("../dist/index.cjs");
27
- var NwVersions = require("./versions.cjs");
28
- var Version = require("./Version.cjs");
29
- var Utils = require("./utils.cjs");
30
27
 
31
28
  class NwBuilder {
32
29
  constructor(options) {
33
30
  this.init(options).then(() => {
34
- this._platforms = { ...Platforms };
35
-
36
- // clear all unused platforms
37
- for (const name in this._platforms) {
38
- if (
39
- this.options.platforms &&
40
- this.options.platforms.indexOf(name) === -1
41
- )
42
- delete this._platforms[name];
31
+ /* Make a shallow copy of the Platforms object */
32
+ this.platforms = Object.assign({}, Platforms);
33
+ /* Clear all unused platforms */
34
+ for (const platform of Object.keys(this.platforms)) {
35
+ if (!options.platforms.includes(platform)) {
36
+ delete this.platforms[platform];
37
+ }
43
38
  }
39
+ }).catch((error) => {
40
+ console.error(error);
44
41
  });
45
42
  }
46
43
 
@@ -51,8 +48,8 @@ class NwBuilder {
51
48
  options = parse(options, manifest);
52
49
 
53
50
  for (const file of glob(options.files)) {
54
- if (basename(file) === "package.json" && manifest === undefined) {
55
- manifest = JSON.parse(readFileSync(file));
51
+ if (path.basename(file) === "package.json" && manifest === undefined) {
52
+ manifest = JSON.parse(fs.readFileSync(file));
56
53
  }
57
54
  }
58
55
 
@@ -96,7 +93,7 @@ class NwBuilder {
96
93
  if (options.quiet === "debug") {
97
94
  log.debug(`Platform: ${platform}`);
98
95
  log.debug(`Archicture: ${arch}`);
99
- log.debug(`Node Version: ${version}`);
96
+ log.debug(`Node Version: ${process.version}`);
100
97
  log.debug(`NW.js Version: ${options.version}\n`);
101
98
  }
102
99
  } catch (error) {
@@ -201,84 +198,6 @@ class NwBuilder {
201
198
  });
202
199
  }
203
200
 
204
- checkVersion() {
205
- var version = this.options.version,
206
- flavor =
207
- semver.valid(version) && semver.satisfies(version, "<0.12.3")
208
- ? "sdk"
209
- : this.options.flavor,
210
- self = this;
211
-
212
- if (!semver.valid(version)) {
213
- return Promise.reject("The version " + version + " is not valid.");
214
- }
215
-
216
- var getVersionFromManifest = function () {
217
- return NwVersions.getVersion({
218
- desiredVersion: version,
219
- downloadUrl: self.options.downloadUrl,
220
- manifestUrl: self.options.manifestUrl,
221
- flavor: flavor,
222
- });
223
- };
224
- var getVersion;
225
-
226
- // if the user specified the exact version and all its platforms are cached, don't hit the manifest at all;
227
- // just trust the ones are cached and assume they're supported
228
- if (self.options.version !== "latest") {
229
- var areAllPlatformsCached = true;
230
- this._forEachPlatform(function (name, platform) {
231
- var platformToCheck = platform;
232
-
233
- if (semver.satisfies(self.options.version, ">=0.12.3")) {
234
- platformToCheck = _.clone(platform);
235
- platformToCheck.files = ["*"]; // otherwise it'll try to check cache legacy version files
236
- }
237
-
238
- if (
239
- !self.isPlatformCached(
240
- name,
241
- platformToCheck,
242
- self.options.version,
243
- flavor,
244
- )
245
- ) {
246
- areAllPlatformsCached = false;
247
- }
248
- });
249
- if (areAllPlatformsCached) {
250
- getVersion = Promise.resolve(
251
- new Version({
252
- version: version,
253
- flavors: [flavor],
254
- downloadUrl: self.options.downloadUrl,
255
- supportedPlatforms: Object.keys(this._platforms),
256
- }),
257
- );
258
- } else {
259
- // otherwise hit the manifest
260
- getVersion = getVersionFromManifest();
261
- }
262
- } else {
263
- // otherwise hit the manifest
264
- getVersion = getVersionFromManifest();
265
- }
266
-
267
- return getVersion.then(function (version) {
268
- self._version = version;
269
- self._version.flavor = flavor;
270
- log.debug(
271
- "Using v" +
272
- self._version.version +
273
- " (" +
274
- (self._version.flavor === "" ? "normal" : self._version.flavor + ")"),
275
- );
276
- if (self._version.isLegacy) {
277
- log.warn("NW.js / node-webkit versions <0.12.3 are deprecated.");
278
- }
279
- });
280
- }
281
-
282
201
  platformFilesForVersion() {
283
202
  var self = this;
284
203
 
@@ -313,7 +232,7 @@ class NwBuilder {
313
232
 
314
233
  built = await isCached(options.cacheDir);
315
234
  if (built === false) {
316
- await mkdir(options.cacheDir, { recursive: true });
235
+ await fs.promises.mkdir(options.cacheDir, { recursive: true });
317
236
  }
318
237
  for await (const os of options.platforms) {
319
238
  const platform = os.slice(0, os.length - 2);
@@ -416,10 +335,10 @@ class NwBuilder {
416
335
  );
417
336
 
418
337
  // Ensure that there is a release Folder, delete and create it.
419
- fs.remove(platform.releasePath, function (err) {
338
+ gfs.remove(platform.releasePath, function (err) {
420
339
  if (err) return reject(err);
421
340
 
422
- fs.mkdirp(platform.releasePath, function (err) {
341
+ gfs.mkdirp(platform.releasePath, function (err) {
423
342
  if (err) return reject(err);
424
343
 
425
344
  log.debug("Create release folder in " + platform.releasePath);
@@ -438,28 +357,28 @@ class NwBuilder {
438
357
  const platform = os.slice(0, os.length - 2);
439
358
  const arch = "x" + os.slice(os.length - 2);
440
359
 
441
- await rm(resolve(this.options.buildDir, this.options.appName, os), {
360
+ await fs.promises.rm(path.resolve(this.options.buildDir, this.options.appName, os), {
442
361
  recursive: true,
443
362
  force: true,
444
363
  });
445
364
 
446
- const nwDir = resolve(
365
+ const nwDir = path.resolve(
447
366
  this.options.cacheDir,
448
367
  `nwjs${this.options.flavor === "sdk" ? "-sdk" : ""}-v${
449
368
  this.options.version
450
369
  }-${platform}-${arch}`,
451
370
  );
452
371
 
453
- await cp(
372
+ await fs.promises.cp(
454
373
  nwDir,
455
- resolve(this.options.buildDir, this.options.appName, os),
374
+ path.resolve(this.options.buildDir, this.options.appName, os),
456
375
  { recursive: true },
457
376
  );
458
377
 
459
378
  for (const file of glob(this.options.files)) {
460
- await cp(
379
+ await fs.promises.cp(
461
380
  file,
462
- resolve(
381
+ path.resolve(
463
382
  this.options.buildDir,
464
383
  this.options.appName,
465
384
  os,
@@ -546,7 +465,7 @@ class NwBuilder {
546
465
  self._files,
547
466
  self,
548
467
  JSON.stringify(
549
- self._platforms[platformName].platformSpecificManifest,
468
+ self.platforms[platformName].platformSpecificManifest,
550
469
  ),
551
470
  zipOptions,
552
471
  ).then(function (file) {
@@ -657,9 +576,9 @@ class NwBuilder {
657
576
 
658
577
  var executableName = self.getExecutableName(name);
659
578
 
660
- await rename(
661
- resolve(platform.releasePath, "nw"),
662
- resolve(platform.releasePath, executableName),
579
+ await fs.promises.rename(
580
+ path.resolve(platform.releasePath, "nw"),
581
+ path.resolve(platform.releasePath, executableName),
663
582
  );
664
583
  });
665
584
  }
@@ -673,9 +592,9 @@ class NwBuilder {
673
592
 
674
593
  var executableName = self.getExecutableName(name);
675
594
 
676
- await rename(
677
- resolve(platform.releasePath, "nwjs.app"),
678
- resolve(platform.releasePath, executableName),
595
+ await fs.promises.rename(
596
+ path.resolve(platform.releasePath, "nwjs.app"),
597
+ path.resolve(platform.releasePath, executableName),
679
598
  );
680
599
 
681
600
  // Let's first handle the mac icon
@@ -769,9 +688,9 @@ class NwBuilder {
769
688
  var executableName = self.getExecutableName(name);
770
689
  var executablePath = path.resolve(platform.releasePath, executableName);
771
690
 
772
- await rename(
773
- resolve(platform.releasePath, "nw.exe"),
774
- resolve(platform.releasePath, executableName),
691
+ await fs.promises.rename(
692
+ path.resolve(platform.releasePath, "nw.exe"),
693
+ path.resolve(platform.releasePath, executableName),
775
694
  );
776
695
 
777
696
  var rcConf = {};
@@ -861,7 +780,7 @@ class NwBuilder {
861
780
  }
862
781
 
863
782
  _forEachPlatform(fn) {
864
- _.forEach(this._platforms, function (platform, name) {
783
+ _.forEach(this.platforms, function (platform, name) {
865
784
  return fn(name, platform);
866
785
  });
867
786
  }
@@ -899,15 +818,6 @@ class NwBuilder {
899
818
  }
900
819
  }
901
820
 
902
- isPlatformCached(platformName, platform, version, flavor) {
903
- this.setPlatformCacheDirectory(platformName, platform, version, flavor);
904
- if (this.options.forceDownload) {
905
- return false;
906
- }
907
- this.preparePlatformFiles(platformName, platform, version);
908
- return checkCache(platform.cache, platform.files);
909
- }
910
-
911
821
  // returns a Boolean; true if the desired platform is supported
912
822
  preparePlatformFiles(platformName, platform, version) {
913
823
  // return if platform.files is already prepared
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "3.8.7",
3
+ "version": "3.8.9",
4
4
  "description": "Build NW.js desktop applications for Mac, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -27,11 +27,10 @@
27
27
  "license": "MIT",
28
28
  "main": "./lib/index.cjs",
29
29
  "bin": {
30
- "nwbuild": "./bin/nwbuild.cjs"
30
+ "nwbuild": "./lib/cli.cjs"
31
31
  },
32
32
  "type": "module",
33
33
  "files": [
34
- "bin",
35
34
  "lib",
36
35
  "src"
37
36
  ],
@@ -42,51 +41,41 @@
42
41
  },
43
42
  "scripts": {
44
43
  "postinstall": "npm run test:prep",
45
- "fmt": "prettier --write .",
46
- "lnt": "eslint --config=cfg/eslint.config.cjs --fix src",
44
+ "lint": "eslint src test",
45
+ "lint:fix": "eslint --fix src test",
47
46
  "test:prep": "esbuild src/index.js --bundle --platform=node --outfile=./dist/index.cjs",
48
- "test:jest": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
47
+ "test:unit": "node --test test/unit/detectCurrentPlatform.js ",
49
48
  "test:tape": "tape './test/*.cjs'",
50
49
  "test:sanity": "node --test-reporter=spec --test e2e/test.js",
51
- "demo": "npm run test:prep && npm link nw-builder && cd test && node demo.cjs"
50
+ "demo": "cd test && node demo.cjs"
52
51
  },
53
52
  "devDependencies": {
54
53
  "decompress-zip": "^0.3.3",
55
- "eslint": "^8.47.0",
56
- "eslint-config-tjw-jsdoc": "^1.0.3",
57
- "jest": "^29.6.2",
58
- "jest-environment-jsdom": "^29.6.2",
59
- "jsdom": "^22.1.0",
60
- "nock": "^13.3.3",
61
- "prettier": "^3.0.2",
54
+ "eslint": "^9.3.0",
55
+ "nock": "^13.5.4",
62
56
  "redtape": "^1.0.0",
63
- "rimraf": "^3.0.2",
64
- "selenium-webdriver": "^4.11.1",
65
- "tape": "^5.6.6"
57
+ "rimraf": "^5.0.7",
58
+ "selenium-webdriver": "^4.21.0",
59
+ "tape": "^5.7.5",
60
+ "vitest": "^1.6.0"
66
61
  },
67
62
  "dependencies": {
68
- "archiver": "^6.0.0",
63
+ "archiver": "^7.0.1",
69
64
  "cli-progress": "^3.12.0",
70
- "compressing": "^1.9.1",
71
- "esbuild": "^0.19.2",
65
+ "compressing": "^1.10.1",
66
+ "esbuild": "^0.21.3",
72
67
  "graceful-fs-extra": "^2.0.0",
73
68
  "lodash": "^4.17.21",
74
69
  "plist": "^3.1.0",
75
- "rcedit": "^3.0.1",
70
+ "rcedit": "^4.0.1",
76
71
  "request": "^2.88.2",
77
- "semver": "^7.5.4",
72
+ "semver": "^7.6.2",
78
73
  "simple-glob": "^0.2.0",
79
74
  "temp": "^0.9.4",
80
75
  "thenify": "^3.3.1",
81
76
  "winresourcer": "^0.9.0",
82
- "winston": "^3.10.0",
77
+ "winston": "^3.13.0",
83
78
  "yargs": "^17.7.2"
84
79
  },
85
- "engines": {
86
- "node": "v20.5.1"
87
- },
88
- "packageManager": "npm@9.8.1",
89
- "jest": {
90
- "testEnvironment": "jsdom"
91
- }
80
+ "packageManager": "npm@10.5.2"
92
81
  }
package/src/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import Options from "./constants/Options";
2
2
  import Platform from "./constants/Platform";
3
3
  import Platforms from "./constants/Platforms";
4
- import checkCache from "./utilities/checkCache";
5
4
  import detectCurrentPlatform from "./utilities/detectCurrentPlatform";
6
5
 
7
6
  import { get } from "./get.js";
@@ -14,7 +13,6 @@ export {
14
13
  Platform,
15
14
  Platforms,
16
15
  detectCurrentPlatform,
17
- checkCache,
18
16
  get,
19
17
  getReleaseInfo,
20
18
  isCached,
package/src/log.js CHANGED
@@ -7,7 +7,7 @@ const customFormat = printf(({ level, message }) => {
7
7
  });
8
8
 
9
9
  export let log = createLogger({
10
- format: combine(errors({stack: true}), timestamp(), customFormat),
10
+ format: combine(errors({ stack: true }), timestamp(), customFormat),
11
11
  transports: [
12
12
  new transports.Console({
13
13
  level: "info",
@@ -10,9 +10,7 @@ const detectCurrentPlatform = (process) => {
10
10
  return process.arch === "x64" ? Platform.OSX_64 : Platform.OSX_32;
11
11
 
12
12
  case "win32":
13
- return process.arch === "x64" || process.env.PROCESSOR_ARCHITEW6432
14
- ? Platform.WIN_64
15
- : Platform.WIN_32;
13
+ return process.arch === "x64" ? Platform.WIN_64 : Platform.WIN_32;
16
14
 
17
15
  case "linux":
18
16
  return process.arch === "x64" ? Platform.NIX_64 : Platform.NIX_32;
@@ -1,30 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
-
4
- /**
5
- *
6
- * @param {string} filePath
7
- * @param {string[]} files
8
- * @return {boolean}
9
- */
10
- const checkCache = (filePath, files) => {
11
- let missing = false;
12
-
13
- // If NW.js is above v0.12.3, then we don't know which files we want from the archives. So just check that the folder exists and has at least 3 files in it.
14
- if (files.length === 1 && files[0] === "*") {
15
- return fs.existsSync(filePath) && fs.readdirSync(filePath).length >= 2;
16
- }
17
-
18
- for (let file of files) {
19
- if (missing) {
20
- return false;
21
- }
22
- if (!fs.existsSync(path.join(filePath, file))) {
23
- missing = true;
24
- }
25
- }
26
-
27
- return !missing;
28
- };
29
-
30
- export default checkCache;