Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/unable to check for update page 4074 #472

Merged
merged 6 commits into from
Jul 31, 2024
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
6 changes: 5 additions & 1 deletion src/bb-components-serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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}`;
Expand Down
9 changes: 7 additions & 2 deletions src/utils/serveComponentSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ const serveComponentSet = (options: ServeOptions): Promise<void> => {
});
};

export default async (options: ServeOptions): Promise<void> => {
await checkUpdateAvailableCLI();
export default async (
options: ServeOptions,
hasOfflineFlag: boolean,
): Promise<void> => {
if (!hasOfflineFlag) {
await checkUpdateAvailableCLI();
}
if (!existsSync(`${options.rootDir}/dist`)) {
throw new Error(`Directory '${options.rootDir}/dist' does not exists.`);
}
Expand Down
Loading