Skip to content

Commit

Permalink
Suppress report for @astrojs/check
Browse files Browse the repository at this point in the history
  • Loading branch information
risu729 committed Nov 3, 2023
1 parent a478c81 commit a6b300c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion fixtures/plugins/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"check": "astro check"
},
"dependencies": {
"@astrojs/mdx": "*",
"@astrojs/rss": "*",
"@astrojs/sitemap": "*",
"astro": "*"
},
"devDependencies": {
"@astrojs/check": "*"
}
}
10 changes: 8 additions & 2 deletions src/plugins/astro/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ export const ENTRY_FILE_PATTERNS = ['astro.config.{js,cjs,mjs,ts}', 'src/content
export const PRODUCTION_ENTRY_FILE_PATTERNS = ['src/pages/**/*.{astro,mdx,js,ts}', 'src/content/**/*.mdx'];

export const findDependencies: GenericPluginCallback = async (configFilePath, options) => {
const { config } = options;
const { config, manifest } = options;

return config.entry
const dependencies = config.entry
? config.entry.map(toProductionEntryPattern)
: [...ENTRY_FILE_PATTERNS.map(toEntryPattern), ...PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern)];

if (manifest.scripts && Object.values(manifest.scripts).some(script => /astro (--.+ )?check/.test(script))) {
dependencies.push('@astrojs/check');
}

return dependencies;
};
4 changes: 3 additions & 1 deletion test/plugins/astro.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import baseCounters from '../helpers/baseCounters.js';
const cwd = resolve('fixtures/plugins/astro');

test('Find dependencies in Astro configuration', async () => {
const { counters } = await main({
const { issues, counters } = await main({
...baseArguments,
cwd,
});

assert(!issues.devDependencies['package.json']['@astrojs/check']);

assert.deepEqual(counters, {
...baseCounters,
processed: 18,
Expand Down

0 comments on commit a6b300c

Please sign in to comment.