Skip to content

chore: migrate chalk to picocolors and NO_COLOR env #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/soft-moons-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@unts/patch-package": patch
---

chore: migrate `chalk` to `picocolors` and `NO_COLOR` env
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@
"dependencies": {
"@nolyfill/json-stable-stringify": "^1.0.30",
"@yarnpkg/lockfile": "^1.1.0",
"chalk": "^4.1.2",
"ci-info": "^3.7.0",
"cross-spawn": "^7.0.3",
"find-yarn-workspace-root": "^2.0.0",
"fs-extra": "^10.0.0",
"klaw-sync": "^6.0.0",
"minimist": "^1.2.6",
"open": "^7.4.2",
"picocolors": "^1.1.1",
"semver": "^7.5.3",
"slash": "^3.0.0",
"tmp": "^0.0.33",
Expand Down
4 changes: 1 addition & 3 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env bash
set -e

export CI=true

yarn clean
yarn build
version=$(node -e 'console.log(require("./package.json").version)')
yarn version --new-version 0.0.0 --no-git-tag-version --no-commit-hooks
yarn pack --filename patch-package.test.$(date +%s).tgz
yarn version --new-version $version --no-git-tag-version --no-commit-hooks
yarn jest "$@"
NO_COLOR=1 yarn jest "$@"
2 changes: 1 addition & 1 deletion src/applyPatches.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import colors from "chalk"
import { existsSync, writeFileSync } from "fs-extra"
import { posix } from "path"
import colors from "picocolors"
import semver from "semver"
import { hashFile } from "./hash"
import { logPatchSequenceError } from "./makePatch"
Expand Down
2 changes: 1 addition & 1 deletion src/createIssue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import colors from "chalk"
import open from "open"
import colors from "picocolors"
import { stringify } from "querystring"
import { PackageManager } from "./detectPackageManager"
import { PackageDetails } from "./PackageDetails"
Expand Down
2 changes: 1 addition & 1 deletion src/detectPackageManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import colors from "chalk"
import findWorkspaceRoot from "find-yarn-workspace-root"
import fs from "fs-extra"
import colors from "picocolors"
import { join } from "./path"

export type PackageManager = "yarn" | "npm" | "npm-shrinkwrap"
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import colors from "chalk"
import { isCI } from "ci-info"
import minimist from "minimist"
import { normalize, sep } from "path"
import colors from "picocolors"
import slash from "slash"
import { applyPatchesForApp } from "./applyPatches"
import { detectPackageManager } from "./detectPackageManager"
Expand Down
2 changes: 1 addition & 1 deletion src/makePatch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import colors from "chalk"
import {
copySync,
existsSync,
Expand All @@ -9,6 +8,7 @@ import {
renameSync,
writeFileSync,
} from "fs-extra"
import colors from "picocolors"
import { dirSync } from "tmp"
import { gzipSync } from "zlib"
import { applyPatch } from "./applyPatches"
Expand Down
2 changes: 1 addition & 1 deletion src/makeRegExp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import colors from "chalk"
import colors from "picocolors"

export const makeRegExp = (
reString: string,
Expand Down
2 changes: 1 addition & 1 deletion src/patch/read.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import colors from "chalk"
import { readFileSync } from "fs-extra"
import { normalize } from "path"
import colors from "picocolors"
import { PackageDetails } from "../PackageDetails"
import { relative, resolve } from "../path"
import { parsePatchFile, PatchFilePart } from "./parse"
Expand Down
2 changes: 1 addition & 1 deletion src/rebase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import colors from "chalk"
import { join, resolve } from "path"
import colors from "picocolors"
import { applyPatch } from "./applyPatches"
import { hashFile } from "./hash"
import { PatchedPackageDetails } from "./PackageDetails"
Expand Down
2 changes: 1 addition & 1 deletion src/stateFile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import stringify from "@nolyfill/json-stable-stringify"
import colors from "chalk"
import { existsSync, readFileSync, unlinkSync, writeFileSync } from "fs"
import { join } from "path"
import colors from "picocolors"
import { hashFile } from "./hash"
import { PackageDetails } from "./PackageDetails"
export interface PatchState {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5224,10 +5224,10 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==

picocolors@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==
picocolors@^1.0.0, picocolors@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==

picomatch@^2.3.1:
version "2.3.1"
Expand Down
Loading