mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Upgrade/remove outdated dependencies
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user