2022-03-18 15:35:45 -07:00
|
|
|
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}(),`);
|
2021-12-22 16:11:05 -05:00
|
|
|
return [
|
2022-03-18 15:35:45 -07:00
|
|
|
`import { defineConfig } from 'astro/config';`,
|
|
|
|
...rendererImports,
|
|
|
|
`// https://astro.build/config`,
|
|
|
|
`export default defineConfig({`,
|
|
|
|
` integrations: [`,
|
|
|
|
...rendererIntegrations,
|
|
|
|
` ]`,
|
|
|
|
`});`,
|
2021-12-22 16:11:05 -05:00
|
|
|
].join('\n');
|
2021-07-07 20:10:09 +00:00
|
|
|
};
|