diff options
author | 2024-07-18 11:45:25 +0200 | |
---|---|---|
committer | 2024-07-18 11:45:25 +0200 | |
commit | 7c9ed71bf1e13a0c825ba67946b6307d06f77233 (patch) | |
tree | 4760849ba1e87a491691cca0a974680b95bf38e3 | |
parent | e7bfbf877ee8f6ef8f760a4507dbb0a2710f7c6c (diff) | |
download | astro-7c9ed71bf1e13a0c825ba67946b6307d06f77233.tar.gz astro-7c9ed71bf1e13a0c825ba67946b6307d06f77233.tar.zst astro-7c9ed71bf1e13a0c825ba67946b6307d06f77233.zip |
feat: noSync flag for astro check (#11482)
-rw-r--r-- | .changeset/grumpy-dolphins-jump.md | 5 | ||||
-rw-r--r-- | packages/astro/src/cli/check/index.ts | 18 |
2 files changed, 15 insertions, 8 deletions
diff --git a/.changeset/grumpy-dolphins-jump.md b/.changeset/grumpy-dolphins-jump.md new file mode 100644 index 000000000..3a900ef8e --- /dev/null +++ b/.changeset/grumpy-dolphins-jump.md @@ -0,0 +1,5 @@ +--- +'astro': minor +--- + +Adds a `--noSync` parameter to the `astro check` command to skip the type-gen step. This can be useful when running `astro check` inside packages that have Astro components, but are not Astro projects diff --git a/packages/astro/src/cli/check/index.ts b/packages/astro/src/cli/check/index.ts index ff7835fdc..00bc3d11a 100644 --- a/packages/astro/src/cli/check/index.ts +++ b/packages/astro/src/cli/check/index.ts @@ -24,14 +24,16 @@ export async function check(flags: Arguments) { return; } - // Run sync before check to make sure types are generated. - // NOTE: In the future, `@astrojs/check` can expose a `before lint` hook so that this works during `astro check --watch` too. - // For now, we run this once as usually `astro check --watch` is ran alongside `astro dev` which also calls `astro sync`. - const { default: sync } = await import('../../core/sync/index.js'); - try { - await sync({ inlineConfig: flagsToAstroInlineConfig(flags) }); - } catch (_) { - return process.exit(1); + if (!flags.noSync && !flags.help) { + // Run sync before check to make sure types are generated. + // NOTE: In the future, `@astrojs/check` can expose a `before lint` hook so that this works during `astro check --watch` too. + // For now, we run this once as usually `astro check --watch` is ran alongside `astro dev` which also calls `astro sync`. + const { default: sync } = await import('../../core/sync/index.js'); + try { + await sync({ inlineConfig: flagsToAstroInlineConfig(flags) }); + } catch (_) { + return process.exit(1); + } } const { check: checker, parseArgsAsCheckConfig } = checkPackage; |