UNPKG

@bubblewrap/cli

Version:

CLI tool to Generate TWA projects from a Web Manifest

200 lines (184 loc) 10.7 kB
"use strict"; /* * Copyright 2020 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.enUS = void 0; const colors_1 = require("colors"); exports.enUS = { errorAssetLinksGeneration: 'Error generating "assetlinks.json"', errorFailedToRunQualityCriteria: colors_1.yellow('\nFailed to run the PWA Quality Criteria checks. Skipping.'), errorMaxLength: (maxLength, actualLength) => { return `Maximum length is ${maxLength} but input is ${actualLength}.`; }, errorMinLength: (minLength, actualLength) => { return `Minimum length is ${minLength} but input is ${actualLength}.`; }, errorRequireHttps: 'Url must be https.', errorInvalidUrl: (url) => { return `Invalid URL: ${url}`; }, errorInvalidColor: (color) => { return `Invalid Color ${color}. Try using hexadecimal representation. eg: #FF3300`; }, errorInvalidDisplayMode: (displayMode) => { return `Invalid display mode: ${displayMode}`; }, errorUrlMustBeImage: (mimeType) => { return `URL must resolve to an image/* mime-type, but resolved to ${mimeType}.`; }, errorUrlMustNotBeSvg: 'SVG images are not supported yet.', messageAndroidAppDetails: colors_1.underline(`\nAndroid app details ${colors_1.green('(2/5)')}`), messageAndroidAppDetailsDesc: ` Please, enter details regarding how the Android app will look when installed into a device: \t- ${colors_1.bold('Application name:')} the name used in most places, \t including the App information screen and on the Play Store. \t- ${colors_1.bold('Short name:')} an alternate name for the app, limited to \t 12 characters, used on a device launch screen. \t- ${colors_1.bold('Application ID:')} also known as ${colors_1.italic('Package Name')}, this is \t the unique identifier for the application on an Android device or \t the Play Store. The name must contain at least two segments, \t separated by dots, each segment must start with a letter and all \t characters must be alphanumeric or an underscore (_). \t- ${colors_1.bold('Display mode:')} how the app will be displayed on the \t device screen when started. The default mode, used by most apps, \t is ${colors_1.cyan('standalone')}. ${colors_1.cyan('fullscreen')} causes the device status bar and \t navigation bars to be removed and is suitable for games or media \t players. For more information on the status bars and navigation \t bar on Android, go to: \t - ${colors_1.cyan('https://material.io/design/platform-guidance/android-bars.html')}. \t- ${colors_1.bold('Status bar color:')} sets the status bar color used when the \t application is in foreground. Example: ${colors_1.cyan('#7CC0FF')}\n`, messageApkSucess: (filename) => { return `\t- Generated Android APK at ${colors_1.cyan(filename)}`; }, messageAppBundleSuccess: (filename) => { return `\t- Generated Android App Bundle at ${colors_1.cyan(filename)}`; }, messageBuildingApp: '\nBuilding the Android App...', messageDigitalAssetLinksSuccess: (filename) => { return `\t- Generated Digital Asset Links file at ${colors_1.cyan(filename)} \nRead more about setting up Digital Asset Links at: \t` + colors_1.cyan('https://developers.google.com/web/android/trusted-web-activity/quick-start#creating' + '-your-asset-link-file'); }, messageEnterPasswords: (keypath, keyalias) => { return `Please, enter passwords for the keystore ${colors_1.cyan(keypath)} and alias \ ${colors_1.cyan(keyalias)}.\n`; }, messageGeneratedNewVersion: (appVersionName, appVersionCode) => { return `Generated new version with versionName: ${appVersionName} and ` + `versionCode: ${appVersionCode}`; }, messageGeneratingAndroidProject: 'Generating Android Project.', messageInstallingBuildTools: 'Installing Android Build Tools. Please, read and accept the ' + 'license agreement.', messageLauncherIconAndSplash: colors_1.underline(`\nLauncher icons and splash screen ${colors_1.green('(3/5)')}`), messageLauncherIconAndSplashDesc: ` The Android app requires an image for the launcher icon. It also displays a splash screen while the web content is loading, to avoid displaying a flash of a blank white page to users. \t- ${colors_1.bold('Splash screen color:')} sets the background colour used for the \t splash screen. Example: ${colors_1.cyan('#7CC0FF')} \t- ${colors_1.bold('Icon URL:')} URL to an image that is at least 512x512px. Used to \t generate the launcher icon for the application and the image for \t the splash screen. \t- ${colors_1.bold('Maskable Icon URL (Optional):')} URL to an image that is at least \t 512x512px to be used when generating maskable icons. Maskable \t icons should look good when their edges are removed by an icon \t mask. They will be used to display adaptive launcher icons on the \t Android home screen.\n`, messageInitializingWebManifest: (manifestUrl) => { return `Initializing application from Web Manifest:\n\t- ${colors_1.cyan(manifestUrl)}`; }, messageOptionFeatures: colors_1.underline(`\nOptional Features ${colors_1.green('(4/5)')}`), messageOptionalFeaturesDesc: ` \t- ${colors_1.bold('Include app shortcuts:')} This question is only prompted if a \t 'shortcuts' section is available on the input Web Manifest. When \t answered “yes”, Bubblewrap uses the information to generate \t shortcuts on the Android app. Read more about app shortcuts at \t ${colors_1.cyan('https://web.dev/app-shortcuts/')}. \t- ${colors_1.bold('Monochrome icon URL:')} URL to an image that is at least 48x48px to \t be used when generating monochrome icons. Monochrome icons should \t look good when displayed with a single color, the PWA's \t ${colors_1.italic('theme_color')}. They will be used for notification icons.\n`, messageProjectGeneratedSuccess: '\nProject generated successfully. Build it by running ' + colors_1.cyan('bubblewrap build'), messageSha256FingerprintNotFound: 'Could not find SHA256 fingerprint. Skipping generating ' + '"assetlinks.json"', messageSigningKeyCreation: colors_1.underline('\nSigning key creation'), messageSigningKeyInformation: colors_1.underline(`\nSigning key information ${colors_1.green('(5/5)')}`), messageSigningKeyInformationDesc: ` Please, enter information about the key store containing the keys that will be used to sign the application. If a key store does not exist on the provided path, Bubblewrap will prompt for the creation of a new keystore. \t- ${colors_1.bold('Key store location:')} The location of the key store in the file \t system. \t- ${colors_1.bold('Key name:')} The alias used on the key. Read more about Android signing keys at: \t ${colors_1.cyan('https://developer.android.com/studio/publish/app-signing')}\n`, messageSigningKeyNotFound: (path) => { return `\nAn existing key store could could not be found at "${path}".\n`; }, messageUsingPasswordsFromEnv: 'Using passwords set in the BUBBLEWRAP_KEYSTORE_PASSWORD and ' + 'BUBBLEWRAP_KEY_PASSWORD environmental variables.', messageWebAppDetails: colors_1.underline(`\nWeb app details ${colors_1.green('(1/5)')}`), messageWebAppDetailsDesc: ` The application generated by Bubblewrap will open a Progressive Web App when started from the Android launcher. Please enter the following details about the PWA: \t- ${colors_1.bold('Domain:')} the domain / origin where the PWA is hosted. \t Example: ${colors_1.cyan('example.com')} \t- ${colors_1.bold('URL path:')} an URL path relative to the root of the origin, \t opened when the application is started from the home screen. \t Examples: \t\t- To open ${colors_1.italic('https://example.com/')}: ${colors_1.cyan('/')} \t\t- To open ${colors_1.italic('https://example.com/path-to-pwa/')}: ${colors_1.cyan('/path-to-pwa/')}\n`, promptHostMessage: 'Domain:', promptName: 'Application name:', promptLauncherName: 'Short name:', promptDisplayMode: 'Display mode:', promptThemeColor: 'Status bar color:', promptBackgroundColor: 'Splash screen color:', promptStartUrl: 'URL path:', promptIconUrl: 'Icon URL:', promptMaskableIconUrl: 'Maskable icon URL:', promptMonochromeIconUrl: 'Monochrome icon URL:', promptShortcuts: 'Include app shortcuts?', promptPackageId: 'Application ID:', promptKeyPath: 'Key store location:', promptKeyAlias: 'Key name:', promptCreateKey: 'Do you want to create one now?', promptKeyFullName: 'First and Last names (eg: John Doe):', promptKeyOrganizationalUnit: 'Organizational Unit (eg: Engineering Dept):', promptKeyOrganization: 'Organization (eg: Company Name):', promptKeyCountry: 'Country (2 letter code):', promptKeystorePassword: 'Password for the Key Store:', promptKeyPassword: 'Password for the Key:', promptNewAppVersionName: 'versionName for the new App version:', warnPwaFailedQuality: colors_1.red('PWA Quality Criteria check failed.'), updateConfigUsage: 'Usage\n\n:[--jdk <path-to-jdk>] [--androidSdk <path-to-android-sdk>]' + '(You can insert one or both of them)', jdkPathIsNotCorrect: 'The jdkPath isn\'t correct, please run the following command to update ' + 'it:\nbubblewrap updateConfig --jdkPath <path-to-jdk>, such that the folder "here" contains' + ' the file "release". Then run bubblewrap doctor again.', jdkIsNotSupported: 'Unsupported jdk version. Please download "OpenJDK 8(LTS)" at the link ' + 'below:\nhttps://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=hotspot.', androidSdkPathIsNotCorrect: 'The androidSdkPath isn\'t correct, please run the following ' + 'command to update it:\nbubblewrap updateConfig --androidSdkPath <path-to-sdk>, such that ' + 'the folder of the path contains the folder "build-tools". Then run bubblewrap doctor again.', bothPathsAreValid: 'Your jdkpath and androidSdkPath are valid.', };