Fix examples check hang (#7998)
This commit is contained in:
parent
0f637c71e5
commit
65c354969e
4 changed files with 20 additions and 5 deletions
5
.changeset/gentle-deers-yawn.md
Normal file
5
.changeset/gentle-deers-yawn.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Call `astro sync` once before calling `astro check`
|
|
@ -76,6 +76,7 @@
|
||||||
"astro-benchmark": "workspace:*"
|
"astro-benchmark": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@astrojs/check": "^0.1.0",
|
||||||
"@changesets/changelog-github": "^0.4.8",
|
"@changesets/changelog-github": "^0.4.8",
|
||||||
"@changesets/cli": "^2.26.1",
|
"@changesets/cli": "^2.26.1",
|
||||||
"@types/node": "^18.16.18",
|
"@types/node": "^18.16.18",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import type { Arguments } from 'yargs-parser';
|
import type { Arguments } from 'yargs-parser';
|
||||||
import { error, info } from '../../core/logger/core.js';
|
import { error, info } from '../../core/logger/core.js';
|
||||||
import { createLoggingFromFlags } from '../flags.js';
|
import { createLoggingFromFlags, flagsToAstroInlineConfig } from '../flags.js';
|
||||||
import { getPackage } from '../install-package.js';
|
import { getPackage } from '../install-package.js';
|
||||||
|
|
||||||
export async function check(flags: Arguments) {
|
export async function check(flags: Arguments) {
|
||||||
|
@ -24,6 +24,16 @@ export async function check(flags: Arguments) {
|
||||||
return;
|
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 { sync } = await import('../../core/sync/index.js');
|
||||||
|
const inlineConfig = flagsToAstroInlineConfig(flags);
|
||||||
|
const exitCode = await sync(inlineConfig);
|
||||||
|
if (exitCode !== 0) {
|
||||||
|
process.exit(exitCode);
|
||||||
|
}
|
||||||
|
|
||||||
const { check: checker, parseArgsAsCheckConfig } = checkPackage;
|
const { check: checker, parseArgsAsCheckConfig } = checkPackage;
|
||||||
|
|
||||||
const config = parseArgsAsCheckConfig(process.argv);
|
const config = parseArgsAsCheckConfig(process.argv);
|
||||||
|
|
|
@ -18,6 +18,9 @@ importers:
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:benchmark
|
version: link:benchmark
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@astrojs/check':
|
||||||
|
specifier: ^0.1.0
|
||||||
|
version: 0.1.0(prettier-plugin-astro@0.11.0)(prettier@3.0.1)(typescript@5.1.6)
|
||||||
'@changesets/changelog-github':
|
'@changesets/changelog-github':
|
||||||
specifier: ^0.4.8
|
specifier: ^0.4.8
|
||||||
version: 0.4.8
|
version: 0.4.8
|
||||||
|
@ -18707,25 +18710,21 @@ packages:
|
||||||
file:packages/astro/test/fixtures/css-assets/packages/font-awesome:
|
file:packages/astro/test/fixtures/css-assets/packages/font-awesome:
|
||||||
resolution: {directory: packages/astro/test/fixtures/css-assets/packages/font-awesome, type: directory}
|
resolution: {directory: packages/astro/test/fixtures/css-assets/packages/font-awesome, type: directory}
|
||||||
name: '@test/astro-font-awesome-package'
|
name: '@test/astro-font-awesome-package'
|
||||||
version: 0.0.1
|
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:packages/astro/test/fixtures/multiple-renderers/renderers/one:
|
file:packages/astro/test/fixtures/multiple-renderers/renderers/one:
|
||||||
resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/one, type: directory}
|
resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/one, type: directory}
|
||||||
name: '@test/astro-renderer-one'
|
name: '@test/astro-renderer-one'
|
||||||
version: 1.0.0
|
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:packages/astro/test/fixtures/multiple-renderers/renderers/two:
|
file:packages/astro/test/fixtures/multiple-renderers/renderers/two:
|
||||||
resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/two, type: directory}
|
resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/two, type: directory}
|
||||||
name: '@test/astro-renderer-two'
|
name: '@test/astro-renderer-two'
|
||||||
version: 1.0.0
|
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:packages/astro/test/fixtures/solid-component/deps/solid-jsx-component:
|
file:packages/astro/test/fixtures/solid-component/deps/solid-jsx-component:
|
||||||
resolution: {directory: packages/astro/test/fixtures/solid-component/deps/solid-jsx-component, type: directory}
|
resolution: {directory: packages/astro/test/fixtures/solid-component/deps/solid-jsx-component, type: directory}
|
||||||
name: '@test/solid-jsx-component'
|
name: '@test/solid-jsx-component'
|
||||||
version: 0.0.0
|
|
||||||
dependencies:
|
dependencies:
|
||||||
solid-js: 1.7.6
|
solid-js: 1.7.6
|
||||||
dev: false
|
dev: false
|
||||||
|
|
Loading…
Reference in a new issue