Skip to content

Commit 8758586

Browse files
committed
chore: use readily installed chalk package
1 parent 6a4c621 commit 8758586

File tree

8 files changed

+32
-40
lines changed

8 files changed

+32
-40
lines changed

automation/utils/bin/rui-publish-marketplace.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import assert from "node:assert/strict";
44
import { getPublishedInfo, gh } from "../src";
5-
import { fgGreen } from "../src/ansi-colors";
65
import { createDraft, publishDraft } from "../src/api/contributor";
6+
import chalk from "chalk";
77

88
async function main(): Promise<void> {
99
console.log(`Getting package information...`);
@@ -13,11 +13,11 @@ async function main(): Promise<void> {
1313
assert.ok(tag, "env.TAG is empty");
1414

1515
if (marketplace.appNumber === -1) {
16-
console.log(`Skipping release process for tag ${fgGreen(tag)}. appNumber is set to -1 in package.json.`);
16+
console.log(`Skipping release process for tag ${chalk.green(tag)}. appNumber is set to -1 in package.json.`);
1717
process.exit(2);
1818
}
1919

20-
console.log(`Starting release process for tag ${fgGreen(tag)}`);
20+
console.log(`Starting release process for tag ${chalk.green(tag)}`);
2121

2222
const artifactUrl = await gh.getMPKReleaseArtifactUrl(tag);
2323

automation/utils/bin/rui-verify-package-format.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
import { ZodError } from "zod";
44
import {
5+
getModuleChangelog,
56
getPackageFileContent,
6-
PackageSchema,
7-
ModulePackageSchema,
7+
getWidgetChangelog,
88
JSActionsPackageSchema,
9+
ModulePackageSchema,
10+
PackageSchema,
911
PublishedPackageSchema
1012
} from "../src";
1113
import { verify as verifyWidget } from "../src/verify-widget-manifest";
12-
import { fgCyan, fgGreen, fgYellow } from "../src/ansi-colors";
13-
import { getModuleChangelog, getWidgetChangelog } from "../src";
14+
import chalk from "chalk";
1415

1516
async function main(): Promise<void> {
1617
const path = process.cwd();
@@ -63,13 +64,13 @@ async function main(): Promise<void> {
6364

6465
// Changelog check coming soon...
6566

66-
console.log(fgGreen("Verification success"));
67+
console.log(chalk.green("Verification success"));
6768
} catch (error) {
6869
if (error instanceof ZodError) {
6970
for (const issue of error.issues) {
70-
const keys = issue.path.map(x => fgYellow(`${x}`));
71+
const keys = issue.path.map(x => chalk.yellow(`${x}`));
7172
const code = `[${issue.code}]`;
72-
console.error(`package.${keys.join(".")} - ${code} ${fgCyan(issue.message)}`);
73+
console.error(`package.${keys.join(".")} - ${code} ${chalk.cyan(issue.message)}`);
7374
}
7475
// Just for new line
7576
console.log("");

automation/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@mendix/prettier-config-web-widgets": "workspace:*",
3838
"@types/cross-zip": "^4.0.2",
3939
"@types/node-fetch": "2.6.12",
40-
"chalk": "^4.1.2",
40+
"chalk": "^5.4.1",
4141
"cross-zip": "^4.0.1",
4242
"enquirer": "^2.4.1",
4343
"execa": "^5.1.1",

automation/utils/src/ansi-colors.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

automation/utils/src/api/contributor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import assert from "node:assert/strict";
2-
import { fetch, BodyInit } from "../fetch";
2+
import { BodyInit, fetch } from "../fetch";
33
import { z } from "zod";
44
import { Version } from "../version";
5-
import { fgGreen } from "../ansi-colors";
5+
import chalk from "chalk";
66

77
export interface CreateDraftSuccessResponse {
88
App: App;
@@ -115,7 +115,7 @@ export async function createDraft(params: CreateDraftParams): Promise<CreateDraf
115115
const { appName, appNumber, version, studioProVersion, artifactUrl, reactReady } = CreateDraftParams.parse(params);
116116
console.log(`Creating draft in the Mendix Marketplace...`);
117117
console.log(
118-
fgGreen(
118+
chalk.green(
119119
`AppName: ${appName} - AppNumber: ${appNumber} - Version: ${version.format()} - StudioPro: ${studioProVersion.format()}`
120120
)
121121
);

automation/utils/src/build-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { join } from "node:path";
2-
import { fgGreen } from "./ansi-colors";
2+
import chalk from "chalk";
33
import { getModuleInfo, getWidgetInfo, ModuleInfo, WidgetInfo } from "./package-info";
44

55
export interface Output<Dirs, Files> {
@@ -65,7 +65,7 @@ export async function getWidgetBuildConfig({
6565
console.info(`Creating build config for ${packageName}...`);
6666

6767
if (MX_PROJECT_PATH) {
68-
console.info(fgGreen(`targetProject: using project path from MX_PROJECT_PATH.`));
68+
console.info(chalk.green(`targetProject: using project path from MX_PROJECT_PATH.`));
6969
}
7070

7171
const paths = {
@@ -118,7 +118,7 @@ export async function getModuleBuildConfig({
118118
console.info(`Creating build config for ${packageName}...`);
119119

120120
if (MX_PROJECT_PATH) {
121-
console.info(fgGreen(`targetProject: using project path from MX_PROJECT_PATH.`));
121+
console.info(chalk.green(`targetProject: using project path from MX_PROJECT_PATH.`));
122122
}
123123

124124
const paths = {

automation/utils/src/steps.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { writeFile, readFile } from "node:fs/promises";
1+
import { readFile, writeFile } from "node:fs/promises";
22
import { dirname, join, parse, relative, resolve } from "path";
3-
import { fgYellow } from "./ansi-colors";
43
import {
54
CommonBuildConfig,
65
getModuleConfigs,
@@ -13,7 +12,8 @@ import { copyMpkFiles, getMpkPaths } from "./monorepo";
1312
import { createModuleMpkInDocker } from "./mpk";
1413
import { ModuleInfo, PackageInfo, WidgetInfo } from "./package-info";
1514
import { addFilesToPackageXml, PackageType } from "./package-xml";
16-
import { cp, ensureFileExists, exec, mkdir, popd, pushd, rm, unzip, zip, chmod } from "./shell";
15+
import { chmod, cp, ensureFileExists, exec, mkdir, popd, pushd, rm, unzip, zip } from "./shell";
16+
import chalk from "chalk";
1717

1818
type Step<Info, Config> = (params: { info: Info; config: Config }) => Promise<void>;
1919

@@ -210,9 +210,9 @@ export async function pushUpdateToTestProject({ info, config }: ModuleStepParams
210210
logStep("Push update to test project");
211211

212212
if (!process.env.CI) {
213-
console.warn(fgYellow("You run script in non CI env"));
214-
console.warn(fgYellow("Set CI=1 in your env if you want to push changes to remote test project"));
215-
console.warn(fgYellow("Skip push step"));
213+
console.warn(chalk.yellow("You run script in non CI env"));
214+
console.warn(chalk.yellow("Set CI=1 in your env if you want to push changes to remote test project"));
215+
console.warn(chalk.yellow("Skip push step"));
216216
return;
217217
}
218218

@@ -222,8 +222,8 @@ export async function pushUpdateToTestProject({ info, config }: ModuleStepParams
222222
const status = (await exec(`git status --porcelain`, { stdio: "pipe" })).stdout.trim();
223223

224224
if (status === "") {
225-
console.warn(fgYellow("Nothing to commit"));
226-
console.warn(fgYellow("Skip push step"));
225+
console.warn(chalk.yellow("Nothing to commit"));
226+
console.warn(chalk.yellow("Skip push step"));
227227
return;
228228
}
229229

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)