build: remove fs-extra devdep (#42533)
* build: remove fs-extra dependency from script/gen-filenames.ts * build: remove fs-extra dependency from script/spec-runner.js * build: remove fs-extra dependency from script/gn-asar.js * build: remove fs-extra dependency from spec/api-autoupdater-darwin-spec.ts * build: remove fs-extra dependency from spec/api-safe-storage-spec.ts * build: remove fs-extra dependency from spec/lib/codesign-helpers.ts * build: remove fs-extra dependency from spec/api-app-spec.ts * build: remove fs-extra dependency from spec/esm-spec.ts * build: remove fs-extra dependency from spec/lib/fs-helpers.ts * build: remove fs-extra dependency from spec/lib/api-shell-spec.ts * build: remove fs-extra dependency from spec/api-context-bridge-spec.ts * build: remove fs-extra dependency from spec/asar-integrity-spec.ts * build: remove fs-extra dependency from spec/node-spec.ts * build: remove fs-extra devdiv * fixup! build: remove fs-extra dependency from spec/api-context-bridge-spec.ts * fix: use force: true when removing directories * chore: reduce diffs to main
This commit is contained in:
parent
8e8ea3ee8b
commit
dad6e130f5
15 changed files with 55 additions and 80 deletions
|
@ -1,5 +1,5 @@
|
|||
import * as cp from 'node:child_process';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as fs from 'node:fs';
|
||||
import * as os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
|
||||
|
@ -48,7 +48,7 @@ const main = async () => {
|
|||
];
|
||||
|
||||
const webpackTargetsWithDeps = await Promise.all(webpackTargets.map(async webpackTarget => {
|
||||
const tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-filenames-'));
|
||||
const tmpDir = await fs.promises.mkdtemp(path.resolve(os.tmpdir(), 'electron-filenames-'));
|
||||
const child = cp.spawn('node', [
|
||||
'./node_modules/webpack-cli/bin/cli.js',
|
||||
'--config', `./build/webpack/${webpackTarget.config}`,
|
||||
|
@ -89,7 +89,7 @@ const main = async () => {
|
|||
// Make the generated list easier to read
|
||||
.sort()
|
||||
};
|
||||
await fs.remove(tmpDir);
|
||||
await fs.promises.rm(tmpDir, { force: true, recursive: true });
|
||||
return webpackTargetWithDeps;
|
||||
}));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const asar = require('@electron/asar');
|
||||
const assert = require('node:assert');
|
||||
const fs = require('fs-extra');
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
|
@ -41,12 +41,12 @@ try {
|
|||
// Copy all files to a tmp dir to avoid including scrap files in the ASAR
|
||||
for (const file of files) {
|
||||
const newLocation = path.resolve(tmpPath, path.relative(base[0], file));
|
||||
fs.mkdirsSync(path.dirname(newLocation));
|
||||
fs.mkdirSync(path.dirname(newLocation), { recursive: true });
|
||||
fs.writeFileSync(newLocation, fs.readFileSync(file));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Unexpected error while generating ASAR', err);
|
||||
fs.remove(tmpPath)
|
||||
fs.promises.rm(tmpPath, { force: true, recursive: true })
|
||||
.then(() => process.exit(1))
|
||||
.catch(() => process.exit(1));
|
||||
return;
|
||||
|
@ -59,5 +59,5 @@ asar.createPackageWithOptions(tmpPath, out[0], {})
|
|||
console.error('Unexpected error while generating ASAR', err);
|
||||
process.exit(1);
|
||||
};
|
||||
fs.remove(tmpPath).then(exit).catch(exit);
|
||||
}).then(() => fs.remove(tmpPath));
|
||||
fs.promises.rm(tmpPath, { force: true, recursive: true }).then(exit).catch(exit);
|
||||
}).then(() => fs.promises.rm(tmpPath, { force: true, recursive: true }));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const { ElectronVersions, Installer } = require('@electron/fiddle-core');
|
||||
const childProcess = require('node:child_process');
|
||||
const crypto = require('node:crypto');
|
||||
const fs = require('fs-extra');
|
||||
const fs = require('node:fs');
|
||||
const { hashElement } = require('folder-hash');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
@ -216,7 +216,7 @@ async function installSpecModules (dir) {
|
|||
env.npm_config_nodedir = path.resolve(BASE, `out/${utils.getOutDir({ shouldLog: true })}/gen/node_headers`);
|
||||
}
|
||||
if (fs.existsSync(path.resolve(dir, 'node_modules'))) {
|
||||
await fs.remove(path.resolve(dir, 'node_modules'));
|
||||
await fs.promises.rm(path.resolve(dir, 'node_modules'), { force: true, recursive: true });
|
||||
}
|
||||
const { status } = childProcess.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install', '--frozen-lockfile'], {
|
||||
env,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue