diff options
author | 2023-10-24 13:48:17 -0500 | |
---|---|---|
committer | 2023-10-24 13:48:17 -0500 | |
commit | b236d88addc48d784bd60119fe45750dda900f16 (patch) | |
tree | 3c82195505f3514149da61a6cbb51e50aec11608 /packages/create-astro/test/utils.js | |
parent | a86b41c852ce5c05e9bda8d29a8ba29a0502e3b0 (diff) | |
download | astro-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.js | 10 |
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), { |