diff --git a/.gitignore b/.gitignore index d7684e4..85464fd 100644 --- a/.gitignore +++ b/.gitignore @@ -231,3 +231,6 @@ oclif.manifest.json /android /ios .env + +# TypeScript build info +*.tsbuildinfo diff --git a/eslint.config.mjs b/eslint.config.mjs index 06a09c2..d5fd678 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -6,4 +6,17 @@ import {fileURLToPath} from 'node:url' const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore') -export default [includeIgnoreFile(gitignorePath), ...oclif, prettier] +export default [ + includeIgnoreFile(gitignorePath), + ...oclif, + prettier, + { + rules: { + // Allow util.styleText even though it's marked as experimental by ESLint + // It's available and stable in Node.js 22.13.0+ (our minimum required version) + 'n/no-unsupported-features/node-builtins': ['error', { + ignores: ['util.styleText'] + }] + } + } +] diff --git a/package.json b/package.json index 2de3d9e..ee9e8ef 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "version": "oclif readme && git add README.md" }, "engines": { - "node": ">=18.0.0" + "node": ">=22.13.0" }, "type": "module", "main": "dist/index.js", @@ -53,7 +53,6 @@ "dependencies": { "@oclif/core": "^4.5.2", "@oclif/plugin-help": "^6.2.32", - "ansis": "^4.0.0", "sharp": "^0.34.1" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index baa8361..31fd6be 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,6 @@ importers: '@oclif/plugin-help': specifier: ^6.2.32 version: 6.2.36 - ansis: - specifier: ^4.0.0 - version: 4.2.0 sharp: specifier: ^0.34.1 version: 0.34.5 @@ -1211,10 +1208,6 @@ packages: resolution: {integrity: sha512-0qWUglt9JEqLFr3w1I1pbrChn1grhaiAR2ocX1PP/flRmxgtwTzPFFFnfIlD6aMOLQZgSuCRlidD70lvx8yhzg==} engines: {node: '>=14'} - ansis@4.2.0: - resolution: {integrity: sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig==} - engines: {node: '>=14'} - are-docs-informative@0.0.2: resolution: {integrity: sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==} engines: {node: '>=14'} @@ -4606,8 +4599,6 @@ snapshots: ansis@3.17.0: {} - ansis@4.2.0: {} - are-docs-informative@0.0.2: {} arg@4.1.3: {} diff --git a/src/commands/dotenv.ts b/src/commands/dotenv.ts index addcc62..51ca6b7 100644 --- a/src/commands/dotenv.ts +++ b/src/commands/dotenv.ts @@ -7,9 +7,9 @@ */ import { Args, Command, Flags } from '@oclif/core' -import { cyan, green, red, yellow } from 'ansis' import { copyFile, unlink } from 'node:fs/promises' +import { cyan, green, red, yellow } from '../utils/color.utils.js' import { checkAssetFile } from '../utils/file-utils.js' export default class Dotenv extends Command { diff --git a/src/commands/icons.ts b/src/commands/icons.ts index 5f08334..c247f0b 100644 --- a/src/commands/icons.ts +++ b/src/commands/icons.ts @@ -7,7 +7,6 @@ */ import { Args, Command, Flags } from '@oclif/core' -import { cyan, green, red, yellow } from 'ansis' import { writeFile } from 'node:fs/promises' import { join } from 'node:path' import sharp from 'sharp' @@ -17,6 +16,7 @@ import type { ContentJson } from '../types.js' import { ICON_SIZES_ANDROID, ICON_SIZES_IOS } from '../constants.js' import { MaskType } from '../types.js' import { extractAppName } from '../utils/app.utils.js' +import { cyan, green, red, yellow } from '../utils/color.utils.js' import { checkAssetFile, mkdirp } from '../utils/file-utils.js' export default class Icons extends Command { diff --git a/src/commands/splash.ts b/src/commands/splash.ts index af1d316..ef1e612 100644 --- a/src/commands/splash.ts +++ b/src/commands/splash.ts @@ -7,7 +7,6 @@ */ import { Args, Command, Flags } from '@oclif/core' -import { cyan, green, red, yellow } from 'ansis' import { writeFile } from 'node:fs/promises' import { join } from 'node:path' import sharp from 'sharp' @@ -16,6 +15,7 @@ import type { ContentJson, SplashscreenSize } from '../types.js' import { SPLASHSCREEN_SIZES_ANDROID, SPLASHSCREEN_SIZES_IOS } from '../constants.js' import { extractAppName } from '../utils/app.utils.js' +import { cyan, green, red, yellow } from '../utils/color.utils.js' import { checkAssetFile, mkdirp } from '../utils/file-utils.js' export default class Splash extends Command { diff --git a/src/utils/color.utils.ts b/src/utils/color.utils.ts new file mode 100644 index 0000000..9070f60 --- /dev/null +++ b/src/utils/color.utils.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 ForWarD Software (https://forwardsoftware.solutions/) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import { styleText } from 'node:util' + +/** + * Color helper functions using util.styleText + * These functions provide a simple API for terminal text styling + */ + +export const cyan = (text: string) => styleText('cyan', text) +export const green = (text: string) => styleText('green', text) +export const red = (text: string) => styleText('red', text) +export const yellow = (text: string) => styleText('yellow', text)