From b6ad7979c22833b43f43f7fe479bf63b291e556e Mon Sep 17 00:00:00 2001 From: Sergei Zharinov <zharinov@users.noreply.github.com> Date: Wed, 5 May 2021 07:47:43 +0400 Subject: [PATCH] fix(generate): Fix Windows paths (#9859) --- tools/generate-imports.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/generate-imports.ts b/tools/generate-imports.ts index 2a8ba9aa52..5a91d04a56 100644 --- a/tools/generate-imports.ts +++ b/tools/generate-imports.ts @@ -59,11 +59,13 @@ async function generateData(): Promise<void> { const contentMapAssignments: string[] = []; for (const file of files) { - shell.echo(`> ${file}`); + const key = file.replace(/\\/g, '/'); + const rawFileContent = await fs.readFile(file, 'utf8'); - contentMapAssignments.push( - `data.set('${file}', ${JSON.stringify(rawFileContent)});` - ); + const value = JSON.stringify(rawFileContent); + + shell.echo(`> ${key}`); + contentMapAssignments.push(`data.set('${key}', ${value});`); } await updateFile( -- GitLab