Skip to content

Commit

Permalink
fix script for clean machine
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-kebets-sonarsource committed Oct 30, 2023
1 parent 605d9c6 commit 09739a8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/fetch-node/scripts/directories.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
import * as url from 'node:url';
import * as path from 'node:path';
import * as fs from 'node:fs';
import fs from 'fs-extra';
import { DISTROS } from '../node-distros.mjs';
// replace __dirname in module
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
Expand Down Expand Up @@ -57,8 +57,9 @@ export function getRuntimePaths() {
const runtimeDirectories = [];
for (const distro of DISTROS) {
const sourceDir = path.join(RUNTIMES_DIR, distro.id);
// we know that there is a single compressed archive per distro
const filename = fs.readdirSync(sourceDir).filter(filename => filename.endsWith('.xz'))[0];
// needed in case the script is run on a clean machine (no cache)
fs.mkdirpSync(sourceDir);
const filename = distro.id.startsWith('win') ? 'node.exe.xz' : 'node.xz';
const sourceFilename = path.join(sourceDir, filename);
const targetDir = path.join(TARGET_DIR, distro.id);
const targetFilename = path.join(targetDir, filename);
Expand Down

0 comments on commit 09739a8

Please sign in to comment.