mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-11 14:30:24 +01:00
Better tmp dir creation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const path = require('node:path');
|
||||
const {execSync} = require('node:child_process');
|
||||
const {cpSync, mkdirSync, chmodSync, unlinkSync} = require('node:fs');
|
||||
const {cpSync, mkdirSync, chmodSync, unlinkSync, mkdtempSync} = require('node:fs');
|
||||
const pluginRuntimeDir = path.join(__dirname, '..');
|
||||
const destDir = path.join(__dirname, '..', '..', 'src-tauri', 'vendored', 'plugin-runtime');
|
||||
const blobPath = path.join(pluginRuntimeDir, 'yaak-plugins.blob');
|
||||
@@ -16,7 +16,7 @@ const DST_BIN_MAP = {
|
||||
console.log('Building SEA blob');
|
||||
execSync('node --experimental-sea-config sea-config.json', {cwd: pluginRuntimeDir});
|
||||
|
||||
const tmp = path.join(__dirname, '.tmp', new Date().toISOString());
|
||||
const tmp = mkdtempSync('yaak_sea');
|
||||
mkdirSync(tmp, {recursive: true});
|
||||
|
||||
let tmpNodePath = process.platform === 'win32' ? path.join(tmp, 'node.exe') : path.join(tmp, 'node');
|
||||
|
||||
@@ -3,6 +3,7 @@ const Downloader = require("nodejs-file-downloader");
|
||||
const path = require("node:path");
|
||||
const fs = require("node:fs");
|
||||
const rimraf = require('rimraf');
|
||||
const {mkdtempSync} = require("fs");
|
||||
|
||||
// `${process.platform}_${process.arch}`
|
||||
const MAC_ARM = 'darwin_arm64';
|
||||
@@ -34,7 +35,7 @@ const SRC_BIN_MAP = {
|
||||
(async function () {
|
||||
const key = `${process.platform}_${process.env.NODE_ARCH ?? process.arch}`;
|
||||
const url = URL_MAP[key];
|
||||
const tmpDir = path.join(__dirname, '.tmp', `${Math.random()}`);
|
||||
const tmpDir = mkdtempSync('yaak_protoc');
|
||||
const dstDir = path.join(__dirname, `..`, 'src-tauri', 'vendored', 'protoc');
|
||||
rimraf.sync(dstDir);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user