From a7def3a3566592b2753d7be110ca07f9507d6084 Mon Sep 17 00:00:00 2001 From: "Sander.Schutten@athora.nl" Date: Thu, 22 Feb 2024 11:05:21 +0100 Subject: [PATCH] feat: skipUpdateCheck option --- node-src/lib/checkForUpdates.ts | 5 +++++ node-src/lib/getOptions.ts | 1 + node-src/lib/parseArgs.ts | 1 + node-src/types.ts | 3 +++ 4 files changed, 10 insertions(+) diff --git a/node-src/lib/checkForUpdates.ts b/node-src/lib/checkForUpdates.ts index fb0c01a38..2fa93839c 100644 --- a/node-src/lib/checkForUpdates.ts +++ b/node-src/lib/checkForUpdates.ts @@ -10,6 +10,11 @@ const withTimeout = (promise: Promise, ms: number): Promise => Promise.race([promise, rejectIn(ms)]); export default async function checkForUpdates(ctx: InitialContext) { + if (ctx.extraOptions.skipUpdateCheck === true) { + ctx.log.info(`Skipping update check`); + return; + } + if (!semver.valid(ctx.pkg.version)) { ctx.log.warn(`Invalid semver version in package.json: ${ctx.pkg.version}`); return; diff --git a/node-src/lib/getOptions.ts b/node-src/lib/getOptions.ts index e4a026a30..7f1e37e69 100644 --- a/node-src/lib/getOptions.ts +++ b/node-src/lib/getOptions.ts @@ -69,6 +69,7 @@ export default function getOptions({ forceRebuild: undefined, junitReport: undefined, zip: undefined, + skipUpdateCheck: undefined, ignoreLastBuildOnBranch: undefined, preserveMissingSpecs: undefined, diff --git a/node-src/lib/parseArgs.ts b/node-src/lib/parseArgs.ts index 579024413..bce879b8b 100644 --- a/node-src/lib/parseArgs.ts +++ b/node-src/lib/parseArgs.ts @@ -39,6 +39,7 @@ export default function parseArgs(argv: string[]) { --storybook-config-dir Relative path from where you run Chromatic to your Storybook config directory ('.storybook'). Use with --only-changed and --storybook-build-dir when using a custom --config-dir (-c) flag for Storybook. [.storybook] --untraced Disregard these files and their dependencies when tracing dependent stories for TurboSnap. Globs are supported via picomatch. This flag can be specified multiple times. Requires --only-changed. --zip Publish your Storybook to Chromatic as a single zip file instead of individual content files. + --skipUpdateCheck Skip checking for Chromatic update. Debug options --debug Output verbose debugging information. This option implies --no-interactive, --diagnostics-file, --log-file. diff --git a/node-src/types.ts b/node-src/types.ts index 16a89084e..f63eb85d4 100644 --- a/node-src/types.ts +++ b/node-src/types.ts @@ -37,6 +37,7 @@ export interface Flags { storybookConfigDir?: string; untraced?: string[]; zip?: boolean; + skipUpdateCheck?: boolean; // Debug options debug?: boolean; @@ -140,6 +141,8 @@ export interface Options extends Configuration { /** Environment variables */ env?: Env; + + skipUpdateCheck: Flags['skipUpdateCheck']; } export { Configuration };