2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-12-22 10:08:55 +00:00

Allow setting default app destination with env. var. NATIVEFIER_APPS_DIR (PR #1339, #1336)

This commit is contained in:
Matthew Ruzzi 2022-01-31 13:59:23 -08:00 committed by GitHub
parent f8bd696e32
commit c6debd72e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

4
API.md
View File

@ -115,7 +115,9 @@ The url to point the application at.
#### [dest]
Specifies the destination directory to build the app to, defaults to the current working directory.
Specifies the destination directory to build the app to, defaults to `NATIVEFIER_APPS_DIR` environment variable, or the current working directory if it is not set.
**Tip:** Add `export NATIVEFIER_APPS_DIR=~/Applications/` to your `~/.bashrc` , `~/.zshrc`, or similar file to set the default app destination if none is passed. This lets you run `nativefier example.com` and have it automatically save it to your Applications folder on macOS.
#### Help

View File

@ -45,7 +45,8 @@ export function initArgs(argv: string[]): yargs.Argv<RawOptions> {
type: 'string',
})
.positional('outputDirectory', {
defaultDescription: 'current directory',
defaultDescription:
'NATIVEFIER_APPS_DIR environment variable, or current directory if not set',
description: 'the directory to generate the app in',
normalize: true,
type: 'string',
@ -667,6 +668,10 @@ if (require.main === module) {
checkInternet();
if (!options.out && process.env.NATIVEFIER_APPS_DIR) {
options.out = process.env.NATIVEFIER_APPS_DIR;
}
buildNativefierApp(options).catch((error) => {
log.error('Error during build. Run with --verbose for details.', error);
});