diff --git a/src/bb-components-serve.ts b/src/bb-components-serve.ts index 4b579ae2..0da8828e 100644 --- a/src/bb-components-serve.ts +++ b/src/bb-components-serve.ts @@ -23,6 +23,7 @@ program .option('--ssl', 'Serve using HTTPS.', false) .option('--ssl-key [ssl-key]', 'SSL certificate to use for serving HTTPS.') .option('--ssl-cert [ssl-cert]', 'SSL key to use for serving HTTPS.') + .option('--offline', 'skip update check') .parse(process.argv); const options: ServeOptions = { @@ -34,8 +35,11 @@ const options: ServeOptions = { sslCert: program.sslCert as string, }; +const arg = process.argv.slice(2); +const hasOfflineFlag = arg.includes('--offline'); + /* execute command */ -serveComponentSet(options).then( +serveComponentSet(options, hasOfflineFlag).then( () => { const scheme = options.ssl ? 'https' : 'http'; const url = `${scheme}://${options.host}:${options.port}`; diff --git a/src/utils/serveComponentSet.ts b/src/utils/serveComponentSet.ts index d42ec07d..c1b9e710 100644 --- a/src/utils/serveComponentSet.ts +++ b/src/utils/serveComponentSet.ts @@ -58,8 +58,13 @@ const serveComponentSet = (options: ServeOptions): Promise => { }); }; -export default async (options: ServeOptions): Promise => { - await checkUpdateAvailableCLI(); +export default async ( + options: ServeOptions, + hasOfflineFlag: boolean, +): Promise => { + if (!hasOfflineFlag) { + await checkUpdateAvailableCLI(); + } if (!existsSync(`${options.rootDir}/dist`)) { throw new Error(`Directory '${options.rootDir}/dist' does not exists.`); }