Skip to content

Commit f4f99df

Browse files
JounQinWikiRik
andauthored
refactor: replace cli-color with picocolors (#1532)
Co-authored-by: Rik Smale <[email protected]>
1 parent c03f20e commit f4f99df

File tree

7 files changed

+36
-68
lines changed

7 files changed

+36
-68
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"types.d.ts"
1313
],
1414
"dependencies": {
15-
"cli-color": "^2.0.3",
1615
"fs-extra": "^9.1.0",
1716
"js-beautify": "1.14.9",
1817
"lodash": "^4.17.21",
18+
"picocolors": "^1.1.1",
1919
"resolve": "^1.22.1",
2020
"umzug": "^2.3.0",
2121
"yargs": "^16.2.0"

src/commands/database.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { logMigrator } from '../core/migrator';
44

55
import helpers from '../helpers';
66
import { cloneDeep, defaults, pick } from 'lodash';
7-
import clc from 'cli-color';
7+
import colors from 'picocolors';
88

99
const Sequelize = helpers.generic.getSequelize();
1010

@@ -61,7 +61,11 @@ exports.handler = async function (args) {
6161
})
6262
.catch((e) => helpers.view.error(e));
6363

64-
helpers.view.log('Database', clc.blueBright(config.database), 'created.');
64+
helpers.view.log(
65+
'Database',
66+
colors.blueBright(config.database),
67+
'created.'
68+
);
6569

6670
break;
6771
case 'db:drop':
@@ -76,7 +80,11 @@ exports.handler = async function (args) {
7680
)
7781
.catch((e) => helpers.view.error(e));
7882

79-
helpers.view.log('Database', clc.blueBright(config.database), 'dropped.');
83+
helpers.view.log(
84+
'Database',
85+
colors.blueBright(config.database),
86+
'dropped.'
87+
);
8088

8189
break;
8290
}

src/commands/migration_generate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { _baseOptions, _underscoreOption } from '../core/yargs';
33

44
import helpers from '../helpers';
55
import fs from 'fs';
6-
import clc from 'cli-color';
6+
import colors from 'picocolors';
77

88
exports.builder = (yargs) =>
99
_underscoreOption(
@@ -30,7 +30,7 @@ exports.handler = function (args) {
3030

3131
helpers.view.log(
3232
'New migration was created at',
33-
clc.blueBright(helpers.path.getMigrationPath(args.name)),
33+
colors.blueBright(helpers.path.getMigrationPath(args.name)),
3434
'.'
3535
);
3636

src/commands/model_generate.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import process from 'process';
22
import { _baseOptions, _underscoreOption } from '../core/yargs';
33

44
import helpers from '../helpers';
5-
import clc from 'cli-color';
5+
import colors from 'picocolors';
66

77
exports.builder = (yargs) =>
88
_underscoreOption(
@@ -38,12 +38,12 @@ exports.handler = function (args) {
3838
helpers.migration.generateTableCreationFile(args);
3939
helpers.view.log(
4040
'New model was created at',
41-
clc.blueBright(helpers.path.getModelPath(args.name)),
41+
colors.blueBright(helpers.path.getModelPath(args.name)),
4242
'.'
4343
);
4444
helpers.view.log(
4545
'New migration was created at',
46-
clc.blueBright(
46+
colors.blueBright(
4747
helpers.path.getMigrationPath(
4848
helpers.migration.generateMigrationName(args)
4949
)
@@ -60,7 +60,7 @@ function ensureModelsFolder() {
6060
'Unable to find models path (' +
6161
helpers.path.getModelsPath() +
6262
'). Did you run ' +
63-
clc.blueBright('sequelize init') +
63+
colors.blueBright('sequelize init') +
6464
'?'
6565
);
6666
}
@@ -72,7 +72,7 @@ function ensureMigrationsFolder() {
7272
'Unable to find migrations path (' +
7373
helpers.path.getPath('migration') +
7474
'). Did you run ' +
75-
clc.blueBright('sequelize init') +
75+
colors.blueBright('sequelize init') +
7676
'?'
7777
);
7878
}

src/commands/seed_generate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { _baseOptions } from '../core/yargs';
33

44
import helpers from '../helpers';
55
import fs from 'fs';
6-
import clc from 'cli-color';
6+
import colors from 'picocolors';
77

88
exports.builder = (yargs) =>
99
_baseOptions(yargs).option('name', {
@@ -28,7 +28,7 @@ exports.handler = function (args) {
2828

2929
helpers.view.log(
3030
'New seed was created at',
31-
clc.blueBright(helpers.path.getSeederPath(args.name)),
31+
colors.blueBright(helpers.path.getSeederPath(args.name)),
3232
'.'
3333
);
3434

src/helpers/view-helper.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import clc from 'cli-color';
1+
import colors from 'picocolors';
22
import _ from 'lodash';
33
import helpers from './index';
44
import getYArgs from '../core/yargs';
@@ -15,7 +15,7 @@ module.exports = {
1515
];
1616

1717
this.log();
18-
this.log(clc.underline('Sequelize CLI [' + versions.join(', ') + ']'));
18+
this.log(colors.underline('Sequelize CLI [' + versions.join(', ') + ']'));
1919
this.log();
2020
},
2121

@@ -36,27 +36,27 @@ module.exports = {
3636
}
3737

3838
this.log();
39-
console.error(`${clc.red('ERROR:')} ${message}`);
39+
console.error(`${colors.red('ERROR:')} ${message}`);
4040
if (error.original && error.original.detail) {
41-
console.error(`${clc.red('ERROR DETAIL:')} ${error.original.detail}`);
41+
console.error(`${colors.red('ERROR DETAIL:')} ${error.original.detail}`);
4242
}
4343

4444
extraMessages.forEach((message) =>
45-
console.error(`${clc.red('EXTRA MESSAGE:')} ${message}`)
45+
console.error(`${colors.red('EXTRA MESSAGE:')} ${message}`)
4646
);
4747
this.log();
4848

4949
process.exit(1);
5050
},
5151

5252
warn(message) {
53-
this.log(`${clc.yellow('WARNING:')} ${message}`);
53+
this.log(`${colors.yellow('WARNING:')} ${message}`);
5454
},
5555

5656
notifyAboutExistingFile(file) {
5757
this.error(
5858
'The file ' +
59-
clc.blueBright(file) +
59+
colors.blueBright(file) +
6060
' already exists. ' +
6161
'Run command with --force to overwrite it.'
6262
);

yarn.lock

+8-48
Original file line numberDiff line numberDiff line change
@@ -1933,17 +1933,6 @@ clean-stack@^2.0.0:
19331933
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
19341934
integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==
19351935

1936-
cli-color@^2.0.3:
1937-
version "2.0.4"
1938-
resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-2.0.4.tgz#d658080290968816b322248b7306fad2346fb2c8"
1939-
integrity sha512-zlnpg0jNcibNrO7GG9IeHH7maWFeCz+Ja1wx/7tZNU5ASSSSZ+/qZciM0/LHCYxSdqv5h2sdbQ/PXYdOuetXvA==
1940-
dependencies:
1941-
d "^1.0.1"
1942-
es5-ext "^0.10.64"
1943-
es6-iterator "^2.0.3"
1944-
memoizee "^0.4.15"
1945-
timers-ext "^0.1.7"
1946-
19471936
cli-cursor@^4.0.0:
19481937
version "4.0.0"
19491938
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-4.0.0.tgz#3cecfe3734bf4fe02a8361cbdc0f6fe28c6a57ea"
@@ -2478,7 +2467,7 @@ es-errors@^1.3.0:
24782467
resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f"
24792468
integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==
24802469

2481-
es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.53, es5-ext@^0.10.62, es5-ext@^0.10.64, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46:
2470+
es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.62, es5-ext@^0.10.64, es5-ext@~0.10.14:
24822471
version "0.10.64"
24832472
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714"
24842473
integrity sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==
@@ -2505,7 +2494,7 @@ es6-symbol@^3.1.1, es6-symbol@^3.1.3:
25052494
d "^1.0.2"
25062495
ext "^1.7.0"
25072496

2508-
es6-weak-map@^2.0.1, es6-weak-map@^2.0.3:
2497+
es6-weak-map@^2.0.1:
25092498
version "2.0.3"
25102499
resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53"
25112500
integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==
@@ -3697,11 +3686,6 @@ is-plain-object@^5.0.0:
36973686
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344"
36983687
integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==
36993688

3700-
is-promise@^2.2.2:
3701-
version "2.2.2"
3702-
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1"
3703-
integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==
3704-
37053689
is-property@^1.0.2:
37063690
version "1.0.2"
37073691
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"
@@ -4140,13 +4124,6 @@ lru-cache@^7.14.1:
41404124
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89"
41414125
integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==
41424126

4143-
lru-queue@^0.1.0:
4144-
version "0.1.0"
4145-
resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3"
4146-
integrity sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==
4147-
dependencies:
4148-
es5-ext "~0.10.2"
4149-
41504127
make-dir@^2.0.0, make-dir@^2.1.0:
41514128
version "2.1.0"
41524129
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
@@ -4216,20 +4193,6 @@ matchdep@^2.0.0:
42164193
resolve "^1.4.0"
42174194
stack-trace "0.0.10"
42184195

4219-
memoizee@^0.4.15:
4220-
version "0.4.15"
4221-
resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.15.tgz#e6f3d2da863f318d02225391829a6c5956555b72"
4222-
integrity sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==
4223-
dependencies:
4224-
d "^1.0.1"
4225-
es5-ext "^0.10.53"
4226-
es6-weak-map "^2.0.3"
4227-
event-emitter "^0.3.5"
4228-
is-promise "^2.2.2"
4229-
lru-queue "^0.1.0"
4230-
next-tick "^1.1.0"
4231-
timers-ext "^0.1.7"
4232-
42334196
meow@^12.0.1:
42344197
version "12.1.1"
42354198
resolved "https://registry.yarnpkg.com/meow/-/meow-12.1.1.tgz#e558dddbab12477b69b2e9a2728c327f191bace6"
@@ -4548,7 +4511,7 @@ negotiator@^0.6.2:
45484511
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
45494512
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==
45504513

4551-
next-tick@1, next-tick@^1.1.0:
4514+
next-tick@^1.1.0:
45524515
version "1.1.0"
45534516
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb"
45544517
integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==
@@ -5010,6 +4973,11 @@ picocolors@^1.0.0, picocolors@^1.0.1:
50104973
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1"
50114974
integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==
50124975

4976+
picocolors@^1.1.1:
4977+
version "1.1.1"
4978+
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
4979+
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
4980+
50134981
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1:
50144982
version "2.3.1"
50154983
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
@@ -6092,14 +6060,6 @@ time-stamp@^1.0.0:
60926060
resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3"
60936061
integrity sha512-gLCeArryy2yNTRzTGKbZbloctj64jkZ57hj5zdraXue6aFgd6PmvVtEyiUU+hvU0v7q08oVv8r8ev0tRo6bvgw==
60946062

6095-
timers-ext@^0.1.7:
6096-
version "0.1.7"
6097-
resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6"
6098-
integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==
6099-
dependencies:
6100-
es5-ext "~0.10.46"
6101-
next-tick "1"
6102-
61036063
to-absolute-glob@^2.0.0:
61046064
version "2.0.2"
61056065
resolved "https://registry.yarnpkg.com/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz#1865f43d9e74b0822db9f145b78cff7d0f7c849b"

0 commit comments

Comments
 (0)