run() — astro Function Reference
Architecture documentation for the run() function in markdown-cc1.js from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 36d60e90_523e_9935_96f7_fef33bb4dfbe["run()"] e1baa224_3f0c_7975_19a6_0a67b46c87c3["markdown-cc1.js"] 36d60e90_523e_9935_96f7_fef33bb4dfbe -->|defined in| e1baa224_3f0c_7975_19a6_0a67b46c87c3 style 36d60e90_523e_9935_96f7_fef33bb4dfbe fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
benchmark/make-project/markdown-cc1.js lines 7–83
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}.md`, 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';
export default defineConfig({
});`,
'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/markdown-cc1.js.
Where is run() defined?
run() is defined in benchmark/make-project/markdown-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