Skip to content
Merged
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
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ $ npm run ts-build
$ node dist/standalone/executable.js
$ node dist/standalone/executable.js --config ./my-config.yaml
$ node dist/standalone/executable.js -c ./my-config.yaml
$ node dist/standalone/executable.js --debug --no-wait
```
The `--config` (or `-c`) option allows you to specify a custom configuration file instead of the default `config.json`. Both JSON and YAML files are supported. You can also use the form `--config=<path>`.
The `--config` (or `-c`) option allows you to specify a custom configuration file instead of the default `config.json`. Both JSON and YAML files are supported. You can also use the form `--config=<path>`. Use `--debug` to enable debug output and `--no-wait` to exit without waiting for a keypress.

#### Running on Linux/macOS

Expand All @@ -60,6 +61,7 @@ Once the project adds support for these platforms the steps are the same:
npm run ts-build
node dist/standalone/executable.js --config ./my-config.yaml
node dist/standalone/executable.js --config=./my-config.yaml
node dist/standalone/executable.js --debug --no-wait
```
The build pipeline will skip the signing step on non-Windows systems.
#### npm scripts
Expand Down
19 changes: 17 additions & 2 deletions source/standalone/executable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Patcher from '../index.js';
import Patcher, { Debug } from '../index.js';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';

Expand All @@ -10,6 +10,16 @@ const argv = yargs(hideBin(process.argv))
type: 'string',
describe: 'Path to configuration file',
})
.option('debug', {
type: 'boolean',
describe: 'Enable debug mode',
default: false,
})
.option('wait', {
type: 'boolean',
describe: 'Wait for keypress before exiting',
default: true,
})
.help()
.version()
.strict()
Expand All @@ -22,7 +32,12 @@ const argv = yargs(hideBin(process.argv))

/** Just run the patcher */
try {
await runPatcher({ configFilePath: argv.config as string | undefined });
if (argv.debug) Debug.enable({ logging: argv.debug });

await runPatcher({
configFilePath: argv.config as string | undefined,
waitForExit: argv.wait as boolean,
});
} catch (error) {
console.error(error);
process.exitCode = 1;
Expand Down
Loading