From b9d69e1097d0526abf2127de05c976d3dbe318a1 Mon Sep 17 00:00:00 2001 From: Catherine Date: Sun, 14 Jul 2024 19:51:20 +0000 Subject: [PATCH] Fix symbolic link support in . --- bin/pack-resources.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/pack-resources.js b/bin/pack-resources.js index b2a2639..8a703b0 100644 --- a/bin/pack-resources.js +++ b/bin/pack-resources.js @@ -22,7 +22,7 @@ async function packDirectory(root, urlRoot, genRoot, dirPath = '', indent = 0) { for (const file of files) { packedData.push(`${' '.repeat(indent + 1)}${JSON.stringify(file.name)}: `); const filePath = `${dirPath}/${file.name}`; - if (file.isDirectory()) { + if (file.isDirectory() || file.isSymbolicLink()) { packedData.push(await packDirectory(root, urlRoot, genRoot, filePath, indent + 1)); } else if (file.isFile()) { const fileData = await readFile(`${root}/${filePath}`); @@ -45,9 +45,6 @@ async function packDirectory(root, urlRoot, genRoot, dirPath = '', indent = 0) { await writeFile(`${genRoot}/${urlRoot}/${filePath}`, fileData); packedData.push(`new URL(${JSON.stringify(urlRoot + filePath)}, import.meta.url)`); } - } else if (file.isSymbolicLink()) { - const linkPath = await readlink(`${root}/${filePath}`); - packedData.push(await packDirectory(root, urlRoot, genRoot, linkPath, indent + 1)); } else { packedData.push('null'); }