run() — astro Function Reference
Architecture documentation for the run() function in mdx-cc1.js from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 7ec09cab_2be2_4aa1_d0b6_626dff223a0c["run()"] 93de5177_11f9_1559_b75c_16706ae7d2c2["mdx-cc1.js"] 7ec09cab_2be2_4aa1_d0b6_626dff223a0c -->|defined in| 93de5177_11f9_1559_b75c_16706ae7d2c2 style 7ec09cab_2be2_4aa1_d0b6_626dff223a0c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
benchmark/make-project/mdx-cc1.js lines 7–86
export async function run(projectDir) {
await fs.rm(projectDir, { recursive: true, force: true });
await fs.mkdir(new URL('./src/pages/blog', projectDir), { recursive: true });
await fs.mkdir(new URL('./src/content/blog', projectDir), { recursive: true });
await fs.copyFile(
new URL('./image.jpg', import.meta.url),
new URL('./src/image.jpg', projectDir),
);
const promises = [];
for (let i = 0; i < 10000; i++) {
const content = `\
# Article ${i}
${loremIpsumMd}

`;
promises.push(
fs.writeFile(new URL(`./src/content/blog/article-${i}.mdx`, projectDir), content, 'utf-8'),
);
}
await fs.writeFile(
new URL(`./src/pages/blog/[...slug].astro`, projectDir),
`\
---
import { getCollection, render } from 'astro:content';
export async function getStaticPaths() {
const blogEntries = await getCollection('blog');
return blogEntries.map(entry => ({
params: { slug: entry.id }, props: { entry },
}));
}
const { entry } = Astro.props;
const { Content } = await render(entry);
---
<h1>{entry.data.title}</h1>
<Content />
`,
'utf-8',
);
await Promise.all(promises);
await fs.writeFile(
new URL(`./src/content.config.ts`, projectDir),
`\
import { defineCollection } from 'astro:content';
import { z } from 'astro/zod';
import { glob } from 'astro/loaders';
const blog = defineCollection({
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
schema: z.object({
title: z.string(),
}),
});
export const collections = { blog };
`,
'utf-8',
);
await fs.writeFile(
new URL('./astro.config.js', projectDir),
`\
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
export default defineConfig({
integrations: [mdx()],
});`,
'utf-8',
);
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does run() do?
run() is a function in the astro codebase, defined in benchmark/make-project/mdx-cc1.js.
Where is run() defined?
run() is defined in benchmark/make-project/mdx-cc1.js at line 7.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free