Refine vendor scripts

This commit is contained in:
Gregory Schier
2024-07-28 15:56:48 -07:00
parent b9671781d3
commit ac1181c1b4
2 changed files with 6 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
const path = require('node:path'); const path = require('node:path');
const decompress = require('decompress'); const decompress = require('decompress');
const Downloader = require("nodejs-file-downloader"); const Downloader = require("nodejs-file-downloader");
const {rmSync, unlinkSync, cpSync, mkdirSync, existsSync} = require("node:fs"); const {rmSync, cpSync, mkdirSync, existsSync} = require("node:fs");
const {execSync} = require("node:child_process"); const {execSync} = require("node:child_process");
const NODE_VERSION = 'v22.5.1'; const NODE_VERSION = 'v22.5.1';
@@ -58,7 +58,7 @@ mkdirSync(destDir, {recursive: true});
await decompress(filePath, tmpDir, {}); await decompress(filePath, tmpDir, {});
// Remove the original archive // Remove the original archive
unlinkSync(filePath); rmSync(filePath);
// Copy binary // Copy binary
const binSrc = path.join(tmpDir, SRC_BIN_MAP[key]); const binSrc = path.join(tmpDir, SRC_BIN_MAP[key]);

View File

@@ -1,8 +1,7 @@
const decompress = require('decompress'); const decompress = require('decompress');
const Downloader = require("nodejs-file-downloader"); const Downloader = require("nodejs-file-downloader");
const path = require("node:path"); const path = require("node:path");
const fs = require("node:fs"); const {rmSync, mkdirSync, cpSync} = require("node:fs");
const {rmSync, mkdirSync} = require("node:fs");
// `${process.platform}_${process.arch}` // `${process.platform}_${process.arch}`
const MAC_ARM = 'darwin_arm64'; const MAC_ARM = 'darwin_arm64';
@@ -48,17 +47,17 @@ mkdirSync(dstDir, {recursive: true});
await decompress(filePath, tmpDir, {}); await decompress(filePath, tmpDir, {});
// Remove the original archive // Remove the original archive
fs.unlinkSync(filePath); rmSync(filePath);
// Copy binary // Copy binary
const binSrc = path.join(tmpDir, SRC_BIN_MAP[key]); const binSrc = path.join(tmpDir, SRC_BIN_MAP[key]);
const binDst = path.join(dstDir, DST_BIN_MAP[key]); const binDst = path.join(dstDir, DST_BIN_MAP[key]);
fs.cpSync(binSrc, binDst); cpSync(binSrc, binDst);
// Copy other files // Copy other files
const includeSrc = path.join(tmpDir, 'include'); const includeSrc = path.join(tmpDir, 'include');
const includeDst = path.join(dstDir, 'include'); const includeDst = path.join(dstDir, 'include');
fs.cpSync(includeSrc, includeDst, {recursive: true}); cpSync(includeSrc, includeDst, {recursive: true});
rmSync(tmpDir, {recursive: true, force: true}); rmSync(tmpDir, {recursive: true, force: true});