Skip to content

Commit

Permalink
fix(cli): add missing options (#575)
Browse files Browse the repository at this point in the history
* fix(cli): add missing options

* chore(docs): update changelog

* feat(config): lint bin, lib, src and test dir

* fix(tests): address lint errors
  • Loading branch information
ayushmanchhabra authored Jun 2, 2022
1 parent 3fb8324 commit 79756ed
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions bin/nwbuild.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,24 @@ 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(
process.argv.findIndex(function firstDash(el) {
return el === "--";
}) + 1,
),
zip: argv.zip || null,
zipOptions: argv.zipOptions || null
};

// Initialize Builder
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions test/nwBuilder.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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");
});
});
Expand Down Expand Up @@ -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);
});

Expand Down
8 changes: 4 additions & 4 deletions test/utils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -154,7 +154,7 @@ test("getFileList", function (t) {
});

utils.getFileList("./test/fixtures/nwapp/images/**").then(
function (data) {},
function () {},
function (error) {
t.equal(
error,
Expand All @@ -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");
},
Expand Down Expand Up @@ -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"))
Expand Down
3 changes: 1 addition & 2 deletions test/versions.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var test = require("tape"),
nock = require("nock"),
_ = require("lodash");
nock = require("nock");

var versions = require("../lib/versions.cjs");

Expand Down

0 comments on commit 79756ed

Please sign in to comment.