Skip to content

Commit 1f49cdd

Browse files
delucisbholmesdev
andauthored
Run sync as part of astro check (#5823)
Co-authored-by: Ben Holmes <[email protected]>
1 parent 982e21c commit 1f49cdd

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

.changeset/real-nails-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': minor
3+
---
4+
5+
Generate content types when running `astro check`

packages/astro/src/cli/check/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable no-console */
22
import { AstroCheck, DiagnosticSeverity } from '@astrojs/language-server';
33
import type { AstroSettings } from '../../@types/astro';
4+
import type { LogOptions } from '../../core/logger/core.js';
45

56
import glob from 'fast-glob';
67
import * as fs from 'fs';
@@ -17,9 +18,14 @@ interface Result {
1718
hints: number;
1819
}
1920

20-
export async function check(settings: AstroSettings) {
21+
export async function check(settings: AstroSettings, { logging }: { logging: LogOptions }) {
2122
console.log(bold('astro check'));
2223

24+
const { sync } = await import('../sync/index.js');
25+
const syncRet = await sync(settings, { logging, fs });
26+
// early exit on sync failure
27+
if (syncRet === 1) return syncRet;
28+
2329
const root = settings.config.root;
2430

2531
const spinner = ora(` Getting diagnostics for Astro files in ${fileURLToPath(root)}…`).start();

packages/astro/src/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ async function runCommand(cmd: string, flags: yargs.Arguments) {
206206
}
207207

208208
case 'check': {
209-
const ret = await check(settings);
209+
const ret = await check(settings, { logging });
210210
return process.exit(ret);
211211
}
212212

0 commit comments

Comments
 (0)