Home / File/ markdown-cc1.js — astro Source File

markdown-cc1.js — astro Source File

Architecture documentation for markdown-cc1.js, a javascript file in the astro codebase. 2 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  e1baa224_3f0c_7975_19a6_0a67b46c87c3["markdown-cc1.js"]
  2ec933b1_5eb0_6df7_64be_172f9299459c["_util.js"]
  e1baa224_3f0c_7975_19a6_0a67b46c87c3 --> 2ec933b1_5eb0_6df7_64be_172f9299459c
  5d6d1861_a18d_b246_cd94_08889ab7e74c["promises"]
  e1baa224_3f0c_7975_19a6_0a67b46c87c3 --> 5d6d1861_a18d_b246_cd94_08889ab7e74c
  style e1baa224_3f0c_7975_19a6_0a67b46c87c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs/promises';
import { loremIpsumMd } from './_util.js';

/**
 * @param {URL} projectDir
 */
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}

![image ${i}](../../image.jpg)


`;
		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',
	);
}

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does markdown-cc1.js do?
markdown-cc1.js is a source file in the astro codebase, written in javascript. It belongs to the PerformanceBenchmarking domain, ProjectGenerator subdomain.
What functions are defined in markdown-cc1.js?
markdown-cc1.js defines 1 function(s): run.
What does markdown-cc1.js depend on?
markdown-cc1.js imports 2 module(s): _util.js, promises.
Where is markdown-cc1.js in the architecture?
markdown-cc1.js is located at benchmark/make-project/markdown-cc1.js (domain: PerformanceBenchmarking, subdomain: ProjectGenerator, directory: benchmark/make-project).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free