Upgrade/remove outdated dependencies

This commit is contained in:
Jamie Kyle 2024-11-13 17:20:36 -08:00 committed by GitHub
parent 0bc6368c64
commit b347a628b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 3511 additions and 8360 deletions

View file

@ -1,11 +1,20 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import fs from 'fs/promises';
import { pathExists } from 'fs-extra';
import path from 'path';
import rimraf from 'rimraf';
import type { AfterPackContext } from 'electron-builder';
import fs, { readdir, rm } from 'node:fs/promises';
import path from 'path';
async function safeReaddir(dir: string): Promise<Array<string> | null> {
try {
return await readdir(dir);
} catch (error) {
if (error.code === 'ENOENT') {
return null;
}
throw error;
}
}
export async function afterPack({
appOutDir,
@ -29,10 +38,8 @@ export async function afterPack({
const versionsDir = path.join(frameworkDir, 'Versions');
const currentVersion = path.join(versionsDir, 'Current');
let subFolders: Array<string>;
if (await pathExists(currentVersion)) {
subFolders = await fs.readdir(currentVersion);
} else {
let subFolders = await safeReaddir(currentVersion);
if (subFolders == null) {
console.error(`${currentVersion} not found`);
subFolders = [];
}
@ -44,12 +51,13 @@ export async function afterPack({
'Replacing electron framework symlink with real folder',
sourcePath
);
rimraf.sync(targetPath);
// eslint-disable-next-line no-await-in-loop
await rm(targetPath, { recursive: true, force: true });
// eslint-disable-next-line no-await-in-loop
await fs.rename(sourcePath, targetPath);
}
console.log('Removing duplicate electron framework', versionsDir);
rimraf.sync(versionsDir);
await rm(versionsDir, { recursive: true, force: true });
}