Bump Node.js environment to 18.x
- Bump Node.js to version 18. This change is necessary as Node.js v16 will reach end-of-life on 2023-09-11. It also ensure compatibility with dependencies requiring minimum of Node.js v18, such as `vite`, `@vitejs`plugin-legacy` and `icon-gen`. - Bump `setup-node` action to v4. - Recommend using the `nvm` tool for managing Node.js versions in the documentation. - Update documentation to point to code reference for required Node.js version. This removes duplication of information, and keeps the code as single source of truth for required Node.js version. - Refactor code to adopt the `node:` protocol for Node API imports as per Node.js 18 standards. This change addresses ambiguities and aligns with Node.js best practices (nodejs/node#38343). Currently, there is no ESLint rule to enforce this protocol, as noted in import-js/eslint-plugin-import#2717. - Replace `cross-fetch` dependency with the native Node.js fetch API introduced in Node.js 18. Adjust type casting for async iterable read streams to align with the latest Node.js APIs, based on discussions in DefinitelyTyped/DefinitelyTyped#65542.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { unlink, readFile } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import { unlink, readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { log, die, LogLevel } from '../utils/log';
|
||||
import { exists } from '../utils/io';
|
||||
import { SupportedPlatform, CURRENT_PLATFORM } from '../utils/platform';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { join } from 'path';
|
||||
import { readdir } from 'fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { readdir } from 'node:fs/promises';
|
||||
import { die } from '../../../utils/log';
|
||||
import { exists } from '../../../utils/io';
|
||||
import { getAppName } from '../../../utils/npm';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { access, chmod } from 'fs/promises';
|
||||
import { constants } from 'fs';
|
||||
import { access, chmod } from 'node:fs/promises';
|
||||
import { constants } from 'node:fs';
|
||||
import { log } from '../../utils/log';
|
||||
import { ExtractionResult } from './common/extraction-result';
|
||||
import { findByFilePattern } from './common/app-artifact-locator';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { mkdtemp, rm } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import { mkdtemp, rm } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { exists } from '../../utils/io';
|
||||
import { log, die, LogLevel } from '../../utils/log';
|
||||
import { runCommand } from '../../utils/run-command';
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { spawn } from 'child_process';
|
||||
import { spawn, type ChildProcess } from 'node:child_process';
|
||||
import { log, LogLevel, die } from '../utils/log';
|
||||
import { captureScreen } from './system-capture/screen-capture';
|
||||
import { captureWindowTitles } from './system-capture/window-title-capture';
|
||||
import type { ChildProcess } from 'child_process';
|
||||
|
||||
const TERMINATION_GRACE_PERIOD_IN_SECONDS = 20;
|
||||
const TERMINATION_CHECK_INTERVAL_IN_MS = 1000;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { unlink } from 'fs/promises';
|
||||
import { unlink } from 'node:fs/promises';
|
||||
import { runCommand } from '../../utils/run-command';
|
||||
import { log, LogLevel } from '../../utils/log';
|
||||
import { CURRENT_PLATFORM, SupportedPlatform } from '../../utils/platform';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { join } from 'path';
|
||||
import { join } from 'node:path';
|
||||
import distDirs from '@/../dist-dirs.json' assert { type: 'json' };
|
||||
|
||||
export const DESKTOP_BUILD_COMMAND = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { readdir, access } from 'fs/promises';
|
||||
import { constants } from 'fs';
|
||||
import { readdir, access } from 'node:fs/promises';
|
||||
import { constants } from 'node:fs';
|
||||
|
||||
export async function exists(path: string): Promise<boolean> {
|
||||
if (!path) { throw new Error('Missing path'); }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { join } from 'path';
|
||||
import { rm, readFile } from 'fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { rm, readFile } from 'node:fs/promises';
|
||||
import { exists, isDirMissingOrEmpty } from './io';
|
||||
import { runCommand } from './run-command';
|
||||
import { LogLevel, die, log } from './log';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { platform } from 'os';
|
||||
import { platform } from 'node:os';
|
||||
import { die } from './log';
|
||||
|
||||
export enum SupportedPlatform {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { exec } from 'child_process';
|
||||
import { exec, type ExecOptions, type ExecException } from 'node:child_process';
|
||||
import { indentText } from './text';
|
||||
import type { ExecOptions, ExecException } from 'child_process';
|
||||
|
||||
const TIMEOUT_IN_SECONDS = 180;
|
||||
const MAX_OUTPUT_BUFFER_SIZE = 1024 * 1024; // 1 MB
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import fetch from 'cross-fetch';
|
||||
|
||||
export async function fetchWithTimeout(
|
||||
url: string,
|
||||
timeoutInMs: number,
|
||||
|
||||
Reference in New Issue
Block a user