From 79756ed0b2733653e94492303427d95e14e660cd Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra Date: Fri, 3 Jun 2022 00:06:06 +0530 Subject: [PATCH] fix(cli): add missing options (#575) * fix(cli): add missing options * chore(docs): update changelog * feat(config): lint bin, lib, src and test dir * fix(tests): address lint errors --- .github/CHANGELOG.md | 4 ++++ bin/nwbuild.cjs | 5 +++++ package.json | 2 +- test/nwBuilder.cjs | 6 +++--- test/utils.cjs | 8 ++++---- test/versions.cjs | 3 +-- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 5770834be..0b947cf16 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## Added + +- Added options `buildType`, `macCredits`, `macPlist`, `zip`, `zipOptions` to CLI [#575](https://github.com/nwjs-community/nw-builder/pull/575) + ## [3.7.1] - 2022-06-02 ## Changed diff --git a/bin/nwbuild.cjs b/bin/nwbuild.cjs index 6d2c29f3f..1483907eb 100755 --- a/bin/nwbuild.cjs +++ b/bin/nwbuild.cjs @@ -62,12 +62,15 @@ const options = { platforms: argv.platforms ? argv.platforms.split(",") : [currentPlatform], currentPlatform: currentPlatform, version: argv.version, + macCredits: argv.macCredits || false, + macPlist: argv.macPlist || false, macIcns: argv.macIcns || false, winIco: argv.winIco || false, cacheDir: argv.cacheDir ? path.resolve(process.cwd(), argv.cacheDir) : path.resolve(__dirname, "..", "cache"), buildDir: path.resolve(process.cwd(), argv.buildDir), + buildType: argv.buildType || 'default', forceDownload: argv.forceDownload, // get all argv arguments after -- argv: process.argv.slice( @@ -75,6 +78,8 @@ const options = { return el === "--"; }) + 1, ), + zip: argv.zip || null, + zipOptions: argv.zipOptions || null }; // Initialize Builder diff --git a/package.json b/package.json index 0a8c86c3d..a7b923991 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "scripts": { "format": "prettier --write ./bin ./lib ./src ./test", - "lint": "eslint ./src", + "lint": "eslint ./bin/**.cjs ./lib/**.cjs ./src/**.js ./test/**.cjs ", "test": "pnpm test:unit && tape './test/*.cjs'", "test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js", "demo": "cd ./test/demo && pnpm start", diff --git a/test/nwBuilder.cjs b/test/nwBuilder.cjs index 7f84476bf..0d9737ea8 100644 --- a/test/nwBuilder.cjs +++ b/test/nwBuilder.cjs @@ -34,7 +34,7 @@ test("Should check if we have some files", function (t) { files: "./test/fixtures/nwapp/**/*", }); - x.checkFiles().then(function (data) { + x.checkFiles().then(function () { t.deepEqual(x._appPkg, { name: "nw-demo", version: "0.1.0", @@ -52,7 +52,7 @@ test("Should take the option name if provided", function (t) { appName: "somename", }); - x.checkFiles().then(function (data) { + x.checkFiles().then(function () { t.equal(x.options.appName, "somename"); }); }); @@ -253,7 +253,7 @@ test("Should find latest version", function (t) { version: "latest", }); - x.resolveLatestVersion().then(function (data) { + x.resolveLatestVersion().then(function () { t.ok(semver.valid(x.options.version), "Version: " + x.options.version); }); diff --git a/test/utils.cjs b/test/utils.cjs index c984f9d5c..6bfe8c4e8 100644 --- a/test/utils.cjs +++ b/test/utils.cjs @@ -32,7 +32,7 @@ test("getPackageInfo invalid", function (t) { test("getPackageInfo valid", function (t) { t.plan(2); - var pkg = utils + utils .getPackageInfo("./test/fixtures/nwapp/package.json") .then(function (pkg) { t.equal(pkg.name, "nw-demo", "get package name"); @@ -154,7 +154,7 @@ test("getFileList", function (t) { }); utils.getFileList("./test/fixtures/nwapp/images/**").then( - function (data) {}, + function () {}, function (error) { t.equal( error, @@ -165,7 +165,7 @@ test("getFileList", function (t) { ); utils.getFileList("./test/fixtures/nwapp/images/*.js").then( - function (data) {}, + function () {}, function (error) { t.equal(error, "No files matching"); }, @@ -272,7 +272,7 @@ testSetup({ var unzipper = new DecompressZip(nwfile), unzipDestination = "test/temp/platform-specific-unzipped"; - unzipper.on("extract", function (log) { + unzipper.on("extract", function () { t.equal( fs .readFileSync(path.join(unzipDestination, "package.json")) diff --git a/test/versions.cjs b/test/versions.cjs index 772b783ef..7a157ee39 100644 --- a/test/versions.cjs +++ b/test/versions.cjs @@ -1,6 +1,5 @@ var test = require("tape"), - nock = require("nock"), - _ = require("lodash"); + nock = require("nock"); var versions = require("../lib/versions.cjs");