Skip to content

Commit

Permalink
feat: noSync flag for astro check (#11482)
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh authored Jul 18, 2024
1 parent e7bfbf8 commit 7c9ed71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-dolphins-jump.md
Original file line number Diff line number Diff line change
@@ -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
18 changes: 10 additions & 8 deletions packages/astro/src/cli/check/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7c9ed71

Please sign in to comment.