0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/create-astro/src/config.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
700 B
TypeScript
Raw Normal View History

import type { Integration } from './frameworks';
export const createConfig = ({ integrations }: { integrations: Integration[] }) => {
if (integrations.length === 0) {
return `import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({});
`;
}
const rendererImports = integrations.map((r) => ` import ${r.id} from '${r.packageName}';`);
const rendererIntegrations = integrations.map((r) => ` ${r.id}(),`);
2021-07-07 15:10:09 -05:00
return [
`import { defineConfig } from 'astro/config';`,
...rendererImports,
`// https://astro.build/config`,
`export default defineConfig({`,
` integrations: [`,
...rendererIntegrations,
` ]`,
`});`,
2021-07-07 15:10:09 -05:00
].join('\n');
};