From 0bd186d0e3cec565589d2e08011e051546086a15 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Mon, 10 Jan 2022 14:27:29 +0100 Subject: [PATCH] Replace colors with chalk in @cosmjs/cli --- .pnp.cjs | 12 ++++++------ .../cache/chalk-npm-4.1.1-f1ce6bae57-036e973e66.zip | 3 --- .../cache/chalk-npm-4.1.2-ba8b67ab80-fe75c9d5c7.zip | 3 +++ CHANGELOG.md | 2 ++ packages/cli/package.json | 2 +- packages/cli/src/cli.ts | 9 ++++----- yarn.lock | 12 ++++++------ 7 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 .yarn/cache/chalk-npm-4.1.1-f1ce6bae57-036e973e66.zip create mode 100644 .yarn/cache/chalk-npm-4.1.2-ba8b67ab80-fe75c9d5c7.zip diff --git a/.pnp.cjs b/.pnp.cjs index bd26b62d..650a49ec 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -928,7 +928,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ], [ "chalk", - "npm:2.4.2" + "npm:4.1.2" ], [ "chokidar", @@ -3281,7 +3281,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"], ["axios", "npm:0.21.4"], ["babylon", "npm:6.18.0"], - ["colors", "npm:1.4.0"], + ["chalk", "npm:4.1.2"], ["cosmjs-types", "npm:0.4.0"], ["diff", "npm:4.0.2"], ["eslint", "npm:7.26.0"], @@ -6670,10 +6670,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ], "linkType": "HARD", }], - ["npm:4.1.1", { - "packageLocation": "./.yarn/cache/chalk-npm-4.1.1-f1ce6bae57-036e973e66.zip/node_modules/chalk/", + ["npm:4.1.2", { + "packageLocation": "./.yarn/cache/chalk-npm-4.1.2-ba8b67ab80-fe75c9d5c7.zip/node_modules/chalk/", "packageDependencies": [ - ["chalk", "npm:4.1.1"], + ["chalk", "npm:4.1.2"], ["ansi-styles", "npm:4.3.0"], ["supports-color", "npm:7.2.0"] ], @@ -7618,7 +7618,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@babel/code-frame", "npm:7.12.11"], ["@eslint/eslintrc", "npm:0.4.1"], ["ajv", "npm:6.12.6"], - ["chalk", "npm:4.1.1"], + ["chalk", "npm:4.1.2"], ["cross-spawn", "npm:7.0.3"], ["debug", "virtual:84aaab4674f4a44ff521c5f62bd452551ef7a2f3aa4df9a02b089f10fb2f0645a919a4bf72c9eb29c0c6447c3e3d72115cf19f79d920f85a14d3f7e8c3fbb38d#npm:4.3.2"], ["doctrine", "npm:3.0.0"], diff --git a/.yarn/cache/chalk-npm-4.1.1-f1ce6bae57-036e973e66.zip b/.yarn/cache/chalk-npm-4.1.1-f1ce6bae57-036e973e66.zip deleted file mode 100644 index bf1f728a..00000000 --- a/.yarn/cache/chalk-npm-4.1.1-f1ce6bae57-036e973e66.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e960da1fdbf7a981e5ab510c100386337d3c9b4f9a74a8ca469dc196a2507157 -size 13703 diff --git a/.yarn/cache/chalk-npm-4.1.2-ba8b67ab80-fe75c9d5c7.zip b/.yarn/cache/chalk-npm-4.1.2-ba8b67ab80-fe75c9d5c7.zip new file mode 100644 index 00000000..3d92d730 --- /dev/null +++ b/.yarn/cache/chalk-npm-4.1.2-ba8b67ab80-fe75c9d5c7.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0f05f7fc307b23f911fff77bed71400322382e7adf21b30a37093056dcebb8b +size 13756 diff --git a/CHANGELOG.md b/CHANGELOG.md index e5b07f23..c496a5f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ and this project adheres to - @cosmjs/cosmwasm-stargate: Add support for wasmd 0.21. This changes the AMINO JSON representation of `Msg{Execute,Instantiate,Migrate}Contract.msg` from base64 strings to JSON objects. ([#948]) +- @cosmjs/cli: Replace `colors` dependency with `chalk` (see + https://snyk.io/blog/open-source-npm-packages-colors-faker/) [#865]: https://github.com/cosmos/cosmjs/issues/865 [#897]: https://github.com/cosmos/cosmjs/issues/897 diff --git a/packages/cli/package.json b/packages/cli/package.json index f54069fe..890694a0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -53,7 +53,7 @@ "@cosmjs/utils": "workspace:packages/utils", "axios": "^0.21.2", "babylon": "^6.18.0", - "colors": "^1.3.3", + "chalk": "^4", "cosmjs-types": "^0.4.0", "diff": "^4", "recast": "^0.20", diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 62d07995..c247f319 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -1,12 +1,11 @@ import axios from "axios"; +import chalk from "chalk"; import * as fs from "fs"; import { join } from "path"; import yargs from "yargs"; import { TsRepl } from "./tsrepl"; -import colors = require("colors/safe"); - export async function installedPackages(): Promise { return new Promise((resolve, reject) => { fs.readFile(__dirname + "/../package.json", { encoding: "utf8" }, (error, data) => { @@ -49,12 +48,12 @@ export async function main(originalArgs: readonly string[]): Promise { .group(["debug", "selftest"], "Maintainer options") .parse(originalArgs); - console.info(colors.green("Initializing session for you. Have fun!")); + console.info(chalk.green("Initializing session for you. Have fun!")); const visiblePackages = (await installedPackages()).filter( (name) => name.startsWith("@cosmjs/") || name === "axios", ); - console.info(colors.yellow("The following packages have been installed and can be imported:")); - console.info(colors.yellow(visiblePackages.join(", "))); + console.info(chalk.yellow("The following packages have been installed and can be imported:")); + console.info(chalk.yellow(visiblePackages.join(", "))); let init = ""; if (args.selftest) { diff --git a/yarn.lock b/yarn.lock index 58463474..6731c26d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -366,7 +366,7 @@ __metadata: "@typescript-eslint/parser": ^4.28 axios: ^0.21.2 babylon: ^6.18.0 - colors: ^1.3.3 + chalk: ^4 cosmjs-types: ^0.4.0 diff: ^4 eslint: ^7.5 @@ -2690,13 +2690,13 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^4.0.0": - version: 4.1.1 - resolution: "chalk@npm:4.1.1" +"chalk@npm:^4, chalk@npm:^4.0.0": + version: 4.1.2 + resolution: "chalk@npm:4.1.2" dependencies: ansi-styles: ^4.1.0 supports-color: ^7.1.0 - checksum: 036e973e665ba1a32c975e291d5f3d549bceeb7b1b983320d4598fb75d70fe20c5db5d62971ec0fe76cdbce83985a00ee42372416abfc3a5584465005a7855ed + checksum: fe75c9d5c76a7a98d45495b91b2172fa3b7a09e0cc9370e5c8feb1c567b85c4288e2b3fded7cfdd7359ac28d6b3844feb8b82b8686842e93d23c827c417e83fc languageName: node linkType: hard @@ -2855,7 +2855,7 @@ __metadata: languageName: node linkType: hard -"colors@npm:1.4.0, colors@npm:^1.3.3, colors@npm:^1.4.0": +"colors@npm:1.4.0, colors@npm:^1.4.0": version: 1.4.0 resolution: "colors@npm:1.4.0" checksum: 98aa2c2418ad87dedf25d781be69dc5fc5908e279d9d30c34d8b702e586a0474605b3a189511482b9d5ed0d20c867515d22749537f7bc546256c6014f3ebdcec