Skip to content

Commit fc2eea8

Browse files
authoredNov 3, 2023
Suppress report for @astrojs/check (#332)
* Suppress report for `@astrojs/check` * Fix test * Remove unnecessary assertion
1 parent 548270d commit fc2eea8

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
 

‎fixtures/plugins/astro/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@
77
"start": "astro dev",
88
"build": "astro build",
99
"preview": "astro preview",
10-
"astro": "astro"
10+
"astro": "astro",
11+
"check": "astro check"
1112
},
1213
"dependencies": {
1314
"@astrojs/mdx": "*",
1415
"@astrojs/rss": "*",
1516
"@astrojs/sitemap": "*",
1617
"astro": "*"
18+
},
19+
"devDependencies": {
20+
"@astrojs/check": "*"
1721
}
1822
}

‎src/plugins/astro/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ export const ENTRY_FILE_PATTERNS = ['astro.config.{js,cjs,mjs,ts}', 'src/content
1818
export const PRODUCTION_ENTRY_FILE_PATTERNS = ['src/pages/**/*.{astro,mdx,js,ts}', 'src/content/**/*.mdx'];
1919

2020
export const findDependencies: GenericPluginCallback = async (configFilePath, options) => {
21-
const { config } = options;
21+
const { config, manifest } = options;
2222

23-
return config.entry
23+
const dependencies = config.entry
2424
? config.entry.map(toProductionEntryPattern)
2525
: [...ENTRY_FILE_PATTERNS.map(toEntryPattern), ...PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern)];
26+
27+
if (manifest.scripts && Object.values(manifest.scripts).some(script => /astro (--.+ )?check/.test(script))) {
28+
dependencies.push('@astrojs/check');
29+
}
30+
31+
return dependencies;
2632
};

0 commit comments

Comments
 (0)
Please sign in to comment.