mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
1fdb63b5d0
* Install dependencies automatically * Added spinners * Updated lockfile * changeset * Sort dependencies * Reverted autoinstall * Updated changeset
23 lines
700 B
TypeScript
23 lines
700 B
TypeScript
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}(),`);
|
|
return [
|
|
`import { defineConfig } from 'astro/config';`,
|
|
...rendererImports,
|
|
`// https://astro.build/config`,
|
|
`export default defineConfig({`,
|
|
` integrations: [`,
|
|
...rendererIntegrations,
|
|
` ]`,
|
|
`});`,
|
|
].join('\n');
|
|
};
|