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

fix(packages/create-astro): wait for writeFile to complete in updateFiles (#10487)

* fix(packages/create-astro): wait for writeFile to complete in updateFiles

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>

* changeset

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
This commit is contained in:
Satya Rohith 2024-03-19 13:37:42 +05:30 committed by GitHub
parent 7eac778cce
commit 2330f22d6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"create-astro": patch
---
Fixes a case where a promise wasn't awaited, causing an issue in Deno.

View file

@ -59,7 +59,7 @@ const FILES_TO_UPDATE = {
fs.promises.readFile(file, 'utf-8').then((value) => { fs.promises.readFile(file, 'utf-8').then((value) => {
// Match first indent in the file or fallback to `\t` // Match first indent in the file or fallback to `\t`
const indent = /(^\s+)/m.exec(value)?.[1] ?? '\t'; const indent = /(^\s+)/m.exec(value)?.[1] ?? '\t';
fs.promises.writeFile( return fs.promises.writeFile(
file, file,
JSON.stringify( JSON.stringify(
Object.assign(JSON.parse(value), Object.assign(overrides, { private: undefined })), Object.assign(JSON.parse(value), Object.assign(overrides, { private: undefined })),