feat!: bump engines to Node.js >=22.12.0 (#139)
Some checks failed
Publish documentation / docs (push) Failing after 1m9s

BREAKING CHANGE: Requires Node.js v22.12.0 LTS or higher. ESM-only.
This commit is contained in:
David Sanders
2025-07-03 15:30:07 -07:00
committed by GitHub
parent 175672e430
commit 421713cf80
26 changed files with 1234 additions and 2566 deletions

View File

@@ -1,8 +1,9 @@
import { spawn, ExitCodeError } from '@malept/cross-spawn-promise';
import * as fs from 'fs-extra';
import * as path from 'path';
import fs from 'node:fs';
import path from 'node:path';
import { promises as stream } from 'node:stream';
import { spawn, ExitCodeError } from '@malept/cross-spawn-promise';
const MACHO_PREFIX = 'Mach-O ';
export enum AppFileType {
@@ -27,11 +28,11 @@ export const getAllAppFiles = async (appPath: string): Promise<AppFile[]> => {
const visited = new Set<string>();
const traverse = async (p: string) => {
p = await fs.realpath(p);
p = await fs.promises.realpath(p);
if (visited.has(p)) return;
visited.add(p);
const info = await fs.stat(p);
const info = await fs.promises.stat(p);
if (info.isSymbolicLink()) return;
if (info.isFile()) {
let fileType = AppFileType.PLAIN;
@@ -63,7 +64,7 @@ export const getAllAppFiles = async (appPath: string): Promise<AppFile[]> => {
}
if (info.isDirectory()) {
for (const child of await fs.readdir(p)) {
for (const child of await fs.promises.readdir(p)) {
await traverse(path.resolve(p, child));
}
}
@@ -83,3 +84,21 @@ export const readMachOHeader = async (path: string) => {
});
return Buffer.concat(chunks);
};
export const fsMove = async (oldPath: string, newPath: string) => {
try {
await fs.promises.rename(oldPath, newPath);
} catch (err) {
if ((err as NodeJS.ErrnoException).code === 'EXDEV') {
// Cross-device link, fallback to copy and delete
await fs.promises.cp(oldPath, newPath, {
force: true,
recursive: true,
verbatimSymlinks: true,
});
await fs.promises.rm(oldPath, { force: true, recursive: true });
} else {
throw err;
}
}
};