From f1b4f807d859c2ee27096efccc1be70ec2c023d0 Mon Sep 17 00:00:00 2001 From: Dan Groshev Date: Mon, 11 Mar 2024 17:52:58 +0000 Subject: [PATCH] Don't import package.json in scripts/refresh-assets.ts, just read it (#3116) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per #3018, the `import` causes `scripts/refresh-assets.ts` to fail on Windows. This PR applies @SomeHats's suggestions cleanly on top of the current `main`. Thank you @cscxj for the original report! Describe what your pull request does. If appropriate, add GIFs or images showing the before and after. ### Change Type - [x] `internal` — Any other changes that don't affect the published package --- scripts/refresh-assets.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/refresh-assets.ts b/scripts/refresh-assets.ts index 81217565d..650719a0b 100644 --- a/scripts/refresh-assets.ts +++ b/scripts/refresh-assets.ts @@ -402,9 +402,9 @@ async function writeAssetDeclarationDTSFile() { } async function copyVersionToDotCom() { - const packageVersion = await import(join(REPO_ROOT, 'packages', 'tldraw', 'package.json')).then( - (pkg) => pkg.version - ) + const packageJson = await readJsonIfExists(join(REPO_ROOT, 'packages', 'tldraw', 'package.json')) + const packageVersion = packageJson.version + const file = `export const version = '${packageVersion}'` await writeCodeFile( 'scripts/refresh-assets.ts',