From 58a4f3c224d7641abb7b7fb718f6226d77e39cea Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Mon, 6 Jan 2025 13:00:39 +0800 Subject: [PATCH] Update index.js --- dist/setup/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dist/setup/index.js b/dist/setup/index.js index 74ed7592..f940f83b 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -93687,10 +93687,30 @@ const semver_1 = __importDefault(__nccwpck_require__(1383)); const os_1 = __importDefault(__nccwpck_require__(2037)); const base_distribution_1 = __importDefault(__nccwpck_require__(7)); const core = __importStar(__nccwpck_require__(2186)); +const fs_1 = __importDefault(__nccwpck_require__(7147)); +const path = __importStar(__nccwpck_require__(1017)); class BasePrereleaseNodejs extends base_distribution_1.default { constructor(nodeInfo) { super(nodeInfo); } + copyFolder(srcDir, destDir) { + if (!fs_1.default.existsSync(destDir)) { + fs_1.default.mkdirSync(destDir, { recursive: true }); + } + + fs_1.default.readdirSync(srcDir).forEach(file => { + const srcFile = path.join(srcDir, file); + const destFile = path.join(destDir, file); + + const stat = fs_1.default.statSync(srcFile); + + if (stat.isDirectory()) { + copyFolder(srcFile, destFile); + } else if (stat.isFile()) { + fs_1.default.copyFileSync(srcFile, destFile); + } + }); + } findVersionInHostedToolCacheDirectory() { let toolPath = ''; let nodeInstallationPath = core.getInput('node-installation-path');