Skip to content

Commit 9c5fdb2

Browse files
authored
fix: support node < 22.14 (#5834)
1 parent 878dc59 commit 9c5fdb2

File tree

8 files changed

+337
-505
lines changed

8 files changed

+337
-505
lines changed

lib/color.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// using chalk as some of our other dependencies are already using it...
22
// exporting from here so we can easily refactor to a different color library if needed
33
import * as ansi from "ansi-colors";
4-
import { ColorName, Chalk } from "chalk";
4+
import * as chalk from "chalk";
55

6-
export type Color = ColorName;
6+
export type Color = typeof chalk.Color;
77

88
export function stripColors(formatStr: string) {
99
return ansi.stripColor(formatStr);
1010
}
1111

12-
export const color = new Chalk();
12+
export const color = chalk;

lib/common/file-system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import * as shelljs from "shelljs";
1515
import { parseJson } from "./helpers";
1616
import { PACKAGE_JSON_FILE_NAME } from "../constants";
1717
import { EOL } from "os";
18-
import { detectNewline } from "detect-newline";
18+
import * as detectNewline from "detect-newline";
1919
import { IFileSystem, IReadFileOptions, IFsStats } from "./declarations";
2020
import { IInjector } from "./definitions/yok";
2121
import { create as createArchiver } from "archiver";

lib/common/opener.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import open from "open";
1+
import * as xopen from "open";
22
import { IOpener } from "../declarations";
33
import { injector } from "./yok";
44

55
export class Opener implements IOpener {
66
public open(target: string, appname?: string): any {
7-
return open(target, {
7+
return xopen(target, {
88
app: {
99
name: appname,
1010
},

lib/common/verify-node-version.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// This function must be separate to avoid dependencies on C++ modules - it must execute precisely when other functions cannot
22

3+
import { color } from "../color";
34
import { ISystemWarning } from "./declarations";
45

56
// Use only ES5 code here - pure JavaScript can be executed with any Node.js version (even 0.10, 0.12).
@@ -11,7 +12,7 @@ var util = require("util");
1112
// These versions cannot be used with CLI due to bugs in the node itself.
1213
// We are absolutely sure we cannot work with them, so inform the user if he is trying to use any of them and exit the process.
1314
var versionsCausingFailure = ["0.10.34", "4.0.0", "4.2.0", "5.0.0"];
14-
var minimumRequiredVersion = "22.12.0";
15+
var minimumRequiredVersion = "8.0.0";
1516

1617
interface INodeVersionOpts {
1718
supportedVersionsRange: string;
@@ -45,13 +46,15 @@ export function verifyNodeVersion(): void {
4546
semver.lt(nodeVer, minimumRequiredVersion)
4647
) {
4748
console.error(
48-
util.format(
49-
"%sNode.js '%s' is not supported. To be able to work with %s CLI, install any Node.js version in the following range: %s.%s",
50-
os.EOL,
51-
nodeVer,
52-
cliName,
53-
supportedVersionsRange,
54-
os.EOL,
49+
color.red.bold(
50+
util.format(
51+
"%sNode.js '%s' is not supported. To be able to work with %s CLI, install any Node.js version in the following range: %s.%s",
52+
os.EOL,
53+
nodeVer,
54+
cliName,
55+
supportedVersionsRange,
56+
os.EOL,
57+
),
5558
),
5659
);
5760
process.exit(1);

lib/services/assets-generation/assets-generation-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Jimp, cssColorToHex, rgbaToInt, JimpInstance } from "jimp";
2-
import Color from "color";
2+
import * as Color from "color";
33
import { exported } from "../../common/decorators";
44
import { AssetConstants } from "../../constants";
55
import {

lib/services/terminal-spinner-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ora from "ora";
1+
import * as ora from "ora";
22
import { injector } from "../common/yok";
33
import {
44
ITerminalSpinner,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy