summaryrefslogtreecommitdiff
path: root/packages/create-astro/test/utils.js
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2023-10-24 13:48:17 -0500
committerGravatar GitHub <noreply@github.com> 2023-10-24 13:48:17 -0500
commitb236d88addc48d784bd60119fe45750dda900f16 (patch)
tree3c82195505f3514149da61a6cbb51e50aec11608 /packages/create-astro/test/utils.js
parenta86b41c852ce5c05e9bda8d29a8ba29a0502e3b0 (diff)
downloadastro-b236d88addc48d784bd60119fe45750dda900f16.tar.gz
astro-b236d88addc48d784bd60119fe45750dda900f16.tar.zst
astro-b236d88addc48d784bd60119fe45750dda900f16.zip
fix(create-astro): respect existing `package.json#scripts` (#8911)
Diffstat (limited to 'packages/create-astro/test/utils.js')
-rw-r--r--packages/create-astro/test/utils.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/create-astro/test/utils.js b/packages/create-astro/test/utils.js
index 56ef55605..f83769e0f 100644
--- a/packages/create-astro/test/utils.js
+++ b/packages/create-astro/test/utils.js
@@ -33,18 +33,22 @@ export function setup() {
const resetEmptyFixture = () =>
fs.promises.rm(new URL('./fixtures/empty/tsconfig.json', import.meta.url));
+
const resetNotEmptyFixture = async () => {
const packagePath = new URL('./fixtures/not-empty/package.json', import.meta.url);
const tsconfigPath = new URL('./fixtures/not-empty/tsconfig.json', import.meta.url);
+ const packageJsonData = JSON.parse(await fs.promises.readFile(packagePath, { encoding: 'utf-8' }));
const overriddenPackageJson = Object.assign(
- JSON.parse(await fs.promises.readFile(packagePath, { encoding: 'utf-8' })),
+ packageJsonData,
{
scripts: {
+ dev: 'astro dev',
build: 'astro build',
- },
+ preview: 'astro preview'
+ }
}
- );
+ )
return Promise.all([
fs.promises.writeFile(packagePath, JSON.stringify(overriddenPackageJson, null, 2), {