From 68508f7e5da55ea14ad28e929f358426e0183374 Mon Sep 17 00:00:00 2001 From: Alexander Nohe Date: Fri, 2 Oct 2020 07:03:06 -0400 Subject: [PATCH] Add the Chrome OS only flag to init. (#351) It was brought to my attention that most developers pursuing bubblewrap would already know that they want to specify a ChromeOS only build. This allows those developers to specify ChromeOS only from the beginning, preventing them from needing to go back and modify the TWA-Manifest file later on. --- packages/cli/README.md | 3 ++- packages/cli/src/lib/cmds/init.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 5bfa8e59..1aae23ea 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -119,11 +119,12 @@ parse the Web manifest and generate default valuers for the Android project, whe will prompt the user to confirm or input values where one could not be generated. ``` -bubblewrap init --manifest="" [--directory=""] +bubblewrap init --manifest="" [--directory=""] [--chromeosonly] ``` Options: - `--directory`: path where to generate the project. Defaults to the current directory. + - `--chromeosonly`: this flag specifies that the build will be used for Chrome OS only and prevents non-Chrome OS devices from installing the app. ## `build` diff --git a/packages/cli/src/lib/cmds/init.ts b/packages/cli/src/lib/cmds/init.ts index 218842f0..a4227bfa 100644 --- a/packages/cli/src/lib/cmds/init.ts +++ b/packages/cli/src/lib/cmds/init.ts @@ -188,6 +188,9 @@ export async function init( args: ParsedArgs, config: Config, prompt: Prompt = new InquirerPrompt()): Promise { prompt.printMessage(messages.messageInitializingWebManifest(args.manifest)); let twaManifest = await TwaManifest.fromWebManifest(args.manifest); + if (args.chromeosonly) { + twaManifest.isChromeOSOnly = true; + } twaManifest = await confirmTwaConfig(twaManifest, prompt); const twaGenerator = new TwaGenerator(); const targetDirectory = args.directory || process.cwd();