refactor: --perf -> env var

This commit is contained in:
bholmesdev 2023-02-27 13:52:10 -05:00
parent 34dbdad186
commit 8677aa8392
10 changed files with 14 additions and 20 deletions

View file

@ -8,19 +8,16 @@
"write:md": "node scripts/write-posts.mjs fixtures/md/src/content/generated 1000 md",
"write:mdx": "node scripts/write-posts.mjs fixtures/mdx/src/content/generated 1000 mdx",
"write:mdoc": "node scripts/write-posts.mjs fixtures/mdoc/src/content/generated 1000 mdoc",
"build": "run-s build:*",
"build:perf": "run-s build:perf:*",
"build": "cross-env ASTRO_CI_PERFORMANCE_RUN=true run-s build:*",
"build:md": "cd fixtures/md && run-s build",
"build:mdx": "cd fixtures/mdx && run-s build",
"build:mdoc": "cd fixtures/mdoc && run-s build",
"build:perf:md": "cd fixtures/md && run-s build:perf",
"build:perf:mdx": "cd fixtures/mdx && run-s build:perf",
"build:perf:mdoc": "cd fixtures/mdoc && run-s build:perf"
"build:mdoc": "cd fixtures/mdoc && run-s build"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"cross-env": "^7.0.3",
"npm-run-all": "^4.1.5"
}
}

View file

@ -1010,7 +1010,6 @@ export interface AstroSettings {
watchFiles: string[];
forceDisableTelemetry: boolean;
timer: AstroTimer;
performanceRun?: boolean;
}
export type AsyncRendererComponentFn<U> = (

View file

@ -350,7 +350,6 @@ async function generatePath(
markdown: {
...settings.config.markdown,
contentDir: getContentPaths(settings.config).contentDir,
performanceRun: settings.performanceRun,
},
mode: opts.mode,
renderers,

View file

@ -209,7 +209,6 @@ function buildManifest(
markdown: {
...settings.config.markdown,
contentDir: getContentPaths(settings.config).contentDir,
performanceRun: settings.performanceRun,
},
pageMap: null as any,
propagation: Array.from(internals.propagation),

View file

@ -27,11 +27,6 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
}
export function createSettings(config: AstroConfig, cwd?: string): AstroSettings {
// Used to test with the internal performance package
// Skips non-essential Markdown and MDX remark plugins for a fair baseline
// against other formats (ex. Markdoc).
const performanceRun = process.argv.some((arg) => arg === '--internal-ci-perf');
const tsconfig = loadTSConfig(cwd);
const settings = createBaseSettings(config);
@ -44,7 +39,6 @@ export function createSettings(config: AstroConfig, cwd?: string): AstroSettings
settings.tsConfig = tsconfig?.config;
settings.tsConfigPath = tsconfig?.path;
settings.watchFiles = watchFiles;
settings.performanceRun = performanceRun;
return settings;
}

View file

@ -25,7 +25,6 @@ export function createDevelopmentEnvironment(
markdown: {
...settings.config.markdown,
contentDir: getContentPaths(settings.config).contentDir,
performanceRun: settings.performanceRun,
},
mode,
// This will be overridden in the dev server

View file

@ -72,7 +72,6 @@ export default function markdown({ settings, logging }: AstroPluginOptions): Plu
...settings.config.markdown,
fileURL: new URL(`file://${fileId}`),
contentDir: getContentPaths(settings.config).contentDir,
performanceRun: settings.performanceRun,
frontmatter: raw.data,
});

View file

@ -55,8 +55,8 @@ export async function renderMarkdown(
smartypants = markdownConfigDefaults.smartypants,
contentDir,
frontmatter: userFrontmatter = {},
performanceRun = false,
} = opts;
const performanceRun = Boolean(process.env.ASTRO_CI_PERFORMANCE_RUN);
const input = new VFile({ value: content, path: fileURL });
const scopedClassName = opts.$?.scopedClassName;

View file

@ -62,8 +62,6 @@ export interface MarkdownRenderingOptions extends AstroMarkdownOptions {
contentDir: URL;
/** Used for frontmatter injection plugins */
frontmatter?: Record<string, any>;
/** @internal Used for performance testing */
performanceRun?: boolean;
}
export interface MarkdownHeading {

View file

@ -1130,8 +1130,10 @@ importers:
packages/astro/performance:
specifiers:
cross-env: ^7.0.3
npm-run-all: ^4.1.5
devDependencies:
cross-env: 7.0.3
npm-run-all: 4.1.5
packages/astro/performance/fixtures/md:
@ -8988,6 +8990,14 @@ packages:
resolution: {integrity: sha512-YIaY9TR5Nxeb8SMdtrU8asWVM4jqJDNDYlKV21LxtYcfNJhp1kEsgSa6qXwXgzN0WQWGODps0+TlGp2xQSHwOg==}
dev: false
/cross-env/7.0.3:
resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==}
engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'}
hasBin: true
dependencies:
cross-spawn: 7.0.3
dev: true
/cross-spawn/5.1.0:
resolution: {integrity: sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==}
dependencies: