blob: f8e63d24cd363d9b3a03ac47a9f8db9ab9cc512c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
export const createConfig = ({ integrations }: { integrations: string[] }) => {
if (integrations.length === 0) {
return `import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({});
`;
}
const rendererImports = integrations.map((r: string) => ` import ${r} from '@astrojs/${r === 'solid' ? 'solid-js' : r}';`);
const rendererIntegrations = integrations.map((r: string) => ` ${r}(),`);
return [
`import { defineConfig } from 'astro/config';`,
...rendererImports,
`// https://astro.build/config`,
`export default defineConfig({`,
` integrations: [`,
...rendererIntegrations,
` ]`,
`});`,
].join('\n');
};
|