0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00

feat: remove online editor configs (#3175)

This commit is contained in:
Ben Holmes 2022-04-22 15:01:16 -04:00 committed by GitHub
parent 7ccda57c1d
commit eda4979997
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,6 +36,7 @@ const { version } = JSON.parse(
fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8') fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8')
); );
const FILES_TO_REMOVE = ['.stackblitzrc', 'sandbox.config.json']; // some files are only needed for online editors when using astro.new. Remove for create-astro installs.
const POSTPROCESS_FILES = ['package.json', 'astro.config.mjs', 'CHANGELOG.md']; // some files need processing after copying. const POSTPROCESS_FILES = ['package.json', 'astro.config.mjs', 'CHANGELOG.md']; // some files need processing after copying.
export async function main() { export async function main() {
@ -179,8 +180,12 @@ export async function main() {
} }
// Post-process in parallel // Post-process in parallel
await Promise.all( await Promise.all([
POSTPROCESS_FILES.map(async (file) => { ...FILES_TO_REMOVE.map(async (file) => {
const fileLoc = path.resolve(path.join(cwd, file));
return fs.promises.rm(fileLoc);
}),
...POSTPROCESS_FILES.map(async (file) => {
const fileLoc = path.resolve(path.join(cwd, file)); const fileLoc = path.resolve(path.join(cwd, file));
switch (file) { switch (file) {
@ -232,8 +237,8 @@ export async function main() {
break; break;
} }
} }
}) }),
); ]);
// Inject framework components into starter template // Inject framework components into starter template
if (selectedTemplate?.value === 'starter') { if (selectedTemplate?.value === 'starter') {