diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 547ebe2c4..170409c07 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -14,6 +14,7 @@ jobs: node-version: "18" - run: npm ci + - run: npm run cjs - uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5e2e53bb..47cdde291 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: volta-cli/action@v1 - with: - node-version: ${{ matrix.node-version }} - npm-version: '8.5.0' - run: npm ci - run: npm run format - run: npm run lint - - run: npm run test + - run: npm run test:unit + - run: npm run cjs + - run: npm run test:e2e diff --git a/.gitignore b/.gitignore index f436c33a1..7f944ee39 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,6 @@ coverage # project files build cache +dist *.zip nwbuild.log diff --git a/README.md b/README.md index 691702b26..d5d9a5810 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ Build [NW.js](https://github.com/nwjs/nw.js) applications for Mac, Windows and Linux. +> Please note that the latest stable version is [v3.8.6](https://github.com/nwutils/nw-builder/tree/v3.8.6). + ## Contributing 1. Pick and install a Node version manager diff --git a/package.json b/package.json index babcedd69..55ac2e8e5 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "main": "./src/nwbuild.js", "exports": { "import": "./src/nwbuild.js", - "require": "./nwbuild.cjs" + "require": "./dist/nwbuild.cjs" }, "type": "module", "homepage": "https://github.com/nwutils/nw-builder", @@ -26,14 +26,16 @@ "url": "https://github.com/nwutils/nw-builder.git" }, "scripts": { - "format": "prettier --write \"./**/*.{js,md}\"", + "format": "prettier --write \"./**/*.{js,cjs,md}\"", "lint": "eslint ./src", - "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js", "docs": "jsdoc ./src/nwbuild.js -d docs", - "demo:cli": "cd ./test/demo && nwbuild ./nwapp --mode=build --version=0.70.1 --flavour=normal --platform=win --arch=x64 --outDir=./build", - "demo:bld": "cd ./test/demo && node bld.cjs", - "demo:run": "cd ./test/demo && node run.cjs", - "cjs": "esbuild ./src/nwbuild.js --bundle --minify --legal-comments=inline --platform=node --outfile=./nwbuild.cjs", + "test:cli": "cd ./test/e2e && nwbuild ./nwapp --mode=build --version=0.70.1 --flavour=normal --platform=win --arch=x64 --outDir=./build", + "test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js", + "test:e2e": "npm run cjs && cd ./test/e2e && node bld.cjs", + "demo:nix": "npm run cjs && cd ./test/e2e && node nix.cjs", + "demo:osx": "npm run cjs && cd ./test/e2e && node osx.cjs", + "demo:win": "npm run cjs && cd ./test/e2e && node win.cjs", + "cjs": "esbuild ./src/nwbuild.js --bundle --minify --legal-comments=inline --platform=node --outfile=./dist/nwbuild.cjs", "checklist": "npm run cjs && npm run format && npm run lint && npm run test" }, "devDependencies": { diff --git a/src/bld/winCfg.js b/src/bld/winCfg.js index ec39f10e1..5c00d7fa8 100644 --- a/src/bld/winCfg.js +++ b/src/bld/winCfg.js @@ -1,6 +1,6 @@ import { rename } from "node:fs/promises"; -import rcedit from "rcedit"; +// import rcedit from "rcedit"; /** * Windows specific configuration steps @@ -12,17 +12,17 @@ const setWinConfig = async (pkg, outDir) => { await rename(`${outDir}/nw.exe`, `${outDir}/${pkg.name}.exe`); // https://learn.microsoft.com/en-gb/windows/win32/menurc/versioninfo-resource?redirectedfrom=MSDN#string-name - await rcedit(`${outDir}/${pkg.name}.exe`, { - "file-version": pkg.version, - "product-version": pkg.version, - "icon": pkg.icon, - "version-string": { - FileDescription: pkg.description, - LegalCopyright: pkg.copyright, - ProductName: pkg.name, - OriginalFilename: pkg.name, - }, - }); + // await rcedit(`${outDir}/${pkg.name}.exe`, { + // "file-version": pkg.version, + // "product-version": pkg.version, + // "icon": pkg.icon, + // "version-string": { + // FileDescription: pkg.description, + // LegalCopyright: pkg.copyright, + // ProductName: pkg.name, + // OriginalFilename: pkg.name, + // }, + // }); }; export { setWinConfig }; diff --git a/test/demo/bld.cjs b/test/e2e/bld.cjs similarity index 75% rename from test/demo/bld.cjs rename to test/e2e/bld.cjs index b5885195b..44f6f9496 100644 --- a/test/demo/bld.cjs +++ b/test/e2e/bld.cjs @@ -1,7 +1,8 @@ +const { platform } = require("node:process"); const { nwbuild } = require("nw-builder"); -const bld = async () => { - await nwbuild({ +if (platform === "linux") { + nwbuild({ srcDir: "./nwapp", mode: "build", version: "0.70.1", @@ -10,7 +11,10 @@ const bld = async () => { arch: "x64", outDir: "./build/nix", }); - await nwbuild({ +} + +if (platform === "darwin") { + nwbuild({ srcDir: "./nwapp", mode: "build", version: "0.70.1", @@ -19,7 +23,10 @@ const bld = async () => { arch: "x64", outDir: "./build/osx", }); - await nwbuild({ +} + +if (platform === "win32") { + nwbuild({ srcDir: "./nwapp", mode: "build", version: "0.70.1", @@ -28,6 +35,4 @@ const bld = async () => { arch: "x64", outDir: "./build/win", }); -}; - -bld(); +} diff --git a/test/e2e/nix.cjs b/test/e2e/nix.cjs new file mode 100644 index 000000000..19c7aff46 --- /dev/null +++ b/test/e2e/nix.cjs @@ -0,0 +1,11 @@ +const { nwbuild } = require("nw-builder"); + +nwbuild({ + srcDir: "./nwapp", + mode: "build", + version: "0.70.1", + flavour: "normal", + platform: "linux", + arch: "x64", + outDir: "./build/nix", +}); diff --git a/test/demo/nwapp/index.html b/test/e2e/nwapp/index.html similarity index 100% rename from test/demo/nwapp/index.html rename to test/e2e/nwapp/index.html diff --git a/test/demo/nwapp/package.json b/test/e2e/nwapp/package.json similarity index 100% rename from test/demo/nwapp/package.json rename to test/e2e/nwapp/package.json diff --git a/test/e2e/osx.cjs b/test/e2e/osx.cjs new file mode 100644 index 000000000..507a5ed64 --- /dev/null +++ b/test/e2e/osx.cjs @@ -0,0 +1,11 @@ +const { nwbuild } = require("nw-builder"); + +nwbuild({ + srcDir: "./nwapp", + mode: "build", + version: "0.70.1", + flavour: "normal", + platform: "linux", + arch: "x64", + outDir: "./build/osx", +}); diff --git a/test/demo/run.cjs b/test/e2e/win.cjs similarity index 50% rename from test/demo/run.cjs rename to test/e2e/win.cjs index b40d36939..78807c610 100644 --- a/test/demo/run.cjs +++ b/test/e2e/win.cjs @@ -2,7 +2,10 @@ const { nwbuild } = require("nw-builder"); nwbuild({ srcDir: "./nwapp", - mode: "run", + mode: "build", version: "0.70.1", - flavour: "sdk", + flavour: "normal", + platform: "win", + arch: "x64", + outDir: "./build/win", });