0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix(create-astro): TypeScript installation failure with yarn (#8939)

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
This commit is contained in:
wktk 2023-10-30 20:22:18 +09:00 committed by GitHub
parent 46d3043a3f
commit 71455c16c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'create-astro': patch
---
Fixes TypeScript installation issue with yarn

View file

@ -82,12 +82,12 @@ const FILES_TO_UPDATE = {
try { try {
// add required dependencies for astro check // add required dependencies for astro check
if (options.ctx.install) if (options.ctx.install)
await shell(options.ctx.packageManager, ['install', '@astrojs/check', 'typescript'], { await shell(options.ctx.packageManager, ['add', '@astrojs/check', 'typescript'], {
cwd: path.dirname(file), cwd: path.dirname(file),
stdio: 'ignore', stdio: 'ignore',
}); });
// inject addtional command to build script // inject additional command to build script
const data = await readFile(file, { encoding: 'utf-8' }); const data = await readFile(file, { encoding: 'utf-8' });
const indent = /(^\s+)/m.exec(data)?.[1] ?? '\t'; const indent = /(^\s+)/m.exec(data)?.[1] ?? '\t';
const parsedPackageJson = JSON.parse(data); const parsedPackageJson = JSON.parse(data);