Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): add definitions #1255

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"test:cov": "vitest --coverage.enabled true",
"demo:bld": "node ./tests/fixtures/demo.js",
"demo:exe": "./tests/fixtures/out/nwapp.app/Contents/MacOS/nwapp",
"demo:cli": "nwbuild --mode run ./src ./app/**"
"demo:cli": "nwbuild --mode=run --glob=false --cacheDir=./node_modules/nw ./tests/fixtures/app"
},
"devDependencies": {
"@eslint/js": "^9.12.0",
Expand Down
37 changes: 20 additions & 17 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@
import nwbuild from './index.js';

program
.option('--mode', 'get, run or build mode')
.option('--version', 'NW.js version')
.option('--flavor', 'NW.js build flavor')
.option('--platform', 'NW.js supported platform')
.option('--arch', 'NW.js supported architecture')
.option('--downloadUrl', 'NW.js download server')
.option('--manifestUrl', 'NW.js version info')
.option('--cacheDir', 'Cache NW.js binaries')
.option('--outDir', 'NW.js build artifacts')
.option('--app', 'Platform specific app metadata. Refer to docs for more info')
.option('--cache', 'Flag to enable/disable caching')
.option('--ffmpeg', 'Flag to enable/disable downloading community ffmpeg')
.option('--glob', 'Flag to enable/disable globbing')
.option('--logLevel', 'Specify log level')
.option('--zip', 'Flag to enable/disable compression')
.option('--managedManifest', 'Managed manifest mode')
.option('--nodeAddon', 'Download NW.js Node headers');
.argument('<string>', 'File path(s) to project')
.option('--mode <string>', 'get, run or build mode', 'build')
.option('--version <string>', 'NW.js version', 'latest')
.option('--flavor <string>', 'NW.js build flavor', 'normal')
.option('--platform <string>', 'NW.js supported platform')
.option('--arch <string>', 'NW.js supported architecture')
.option('--downloadUrl <string>', 'NW.js download server')
.option('--manifestUrl <string>', 'NW.js version info')
.option('--cacheDir <string>', 'Cache NW.js binaries')
.option('--outDir <string>', 'NW.js build artifacts')
.option('--app <object>', 'Platform specific app metadata. Refer to docs for more info')
.option('--cache <boolean>', 'Flag to enable/disable caching', true)
.option('--ffmpeg <boolean>', 'Flag to enable/disable downloading community ffmpeg', false)
.option('--glob <boolean>', 'Flag to enable/disable globbing', true)
.option('--logLevel <string>', 'Specify log level')
.option('--zip <string>', 'Flag to enable/disable compression', false)
.option('--managedManifest <string>', 'Managed manifest mode', false)
.option('--nodeAddon <boolean>', 'Download NW.js Node headers', false);

program.parse();

console.log(program.args.join(' '))

Check failure on line 29 in src/cli.js

View workflow job for this annotation

GitHub Actions / tests (macos-14)

Missing semicolon

Check failure on line 29 in src/cli.js

View workflow job for this annotation

GitHub Actions / tests (ubuntu-22.04)

Missing semicolon

Check failure on line 29 in src/cli.js

View workflow job for this annotation

GitHub Actions / tests (windows-2022)

Missing semicolon
console.log(program.opts())

Check failure on line 30 in src/cli.js

View workflow job for this annotation

GitHub Actions / tests (macos-14)

Missing semicolon

Check failure on line 30 in src/cli.js

View workflow job for this annotation

GitHub Actions / tests (ubuntu-22.04)

Missing semicolon

Check failure on line 30 in src/cli.js

View workflow job for this annotation

GitHub Actions / tests (windows-2022)

Missing semicolon
nwbuild({
...program.opts(),
srcDir: program.args.join(' '),
Expand Down
Loading