Skip to content

Commit c680705

Browse files
authored
chore(): update scripts to use colorette instead of turbocolor (ionic-team#21349)
1 parent 60be68c commit c680705

5 files changed

Lines changed: 25 additions & 25 deletions

File tree

.scripts/common.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const execa = require('execa');
44
const inquirer = require('inquirer');
55
const Listr = require('listr');
66
const semver = require('semver');
7-
const tc = require('turbocolor');
7+
const { bold, cyan, dim } = require('colorette');
88

99
const rootDir = path.join(__dirname, '../');
1010

@@ -55,7 +55,7 @@ async function askNpmTag(version) {
5555
type: 'confirm',
5656
name: 'confirm',
5757
message: answers => {
58-
return `Will publish ${tc.cyan(version)} to ${tc.cyan(answers.npmTag)}. Continue?`;
58+
return `Will publish ${cyan(version)} to ${cyan(answers.npmTag)}. Continue?`;
5959
}
6060
}
6161
];
@@ -192,7 +192,7 @@ function preparePackage(tasks, package, version, install) {
192192

193193
// Add project tasks
194194
tasks.push({
195-
title: `Prepare ${tc.bold(pkg.name)}`,
195+
title: `Prepare ${bold(pkg.name)}`,
196196
task: () => new Listr(projectTasks)
197197
});
198198
}
@@ -234,7 +234,7 @@ function prepareDevPackage(tasks, package, version) {
234234

235235
// Add project tasks
236236
tasks.push({
237-
title: `Prepare dev build: ${tc.bold(pkg.name)}`,
237+
title: `Prepare dev build: ${bold(pkg.name)}`,
238238
task: () => new Listr(projectTasks)
239239
});
240240
}
@@ -244,7 +244,7 @@ function updatePackageVersions(tasks, packages, version) {
244244
updatePackageVersion(tasks, package, version);
245245

246246
tasks.push({
247-
title: `${package} update @ionic/core dependency, if present ${tc.dim(`(${version})`)}`,
247+
title: `${package} update @ionic/core dependency, if present ${dim(`(${version})`)}`,
248248
task: async () => {
249249
if (package !== 'core') {
250250
const pkg = readPkg(package);
@@ -261,7 +261,7 @@ function updatePackageVersions(tasks, packages, version) {
261261
updatePackageVersion(tasks, distPackage, version);
262262

263263
tasks.push({
264-
title: `${package} update @ionic/core dependency, if present ${tc.dim(`(${version})`)}`,
264+
title: `${package} update @ionic/core dependency, if present ${dim(`(${version})`)}`,
265265
task: async () => {
266266
const pkg = readPkg(distPackage);
267267
updateDependency(pkg, '@ionic/core', version);
@@ -272,7 +272,7 @@ function updatePackageVersions(tasks, packages, version) {
272272

273273
if (package === 'packages/react-router') {
274274
tasks.push({
275-
title: `${package} update @ionic/react dependency, if present ${tc.dim(`(${version})`)}`,
275+
title: `${package} update @ionic/react dependency, if present ${dim(`(${version})`)}`,
276276
task: async () => {
277277
const pkg = readPkg(package);
278278
updateDependency(pkg, '@ionic/react', version);
@@ -287,7 +287,7 @@ function updatePackageVersion(tasks, package, version) {
287287
const projectRoot = projectPath(package);
288288

289289
tasks.push({
290-
title: `${package}: update package.json ${tc.dim(`(${version})`)}`,
290+
title: `${package}: update package.json ${dim(`(${version})`)}`,
291291
task: async () => {
292292
await execa('npm', ['version', version], { cwd: projectRoot });
293293
}

.scripts/prepare.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Deploy script adopted from https://github.com/sindresorhus/np
33
* MIT License (c) Sindre Sorhus (sindresorhus.com)
44
*/
5-
const tc = require('turbocolor');
5+
const { cyan, dim, red, reset } = require('colorette');
66
const execa = require('execa');
77
const inquirer = require('inquirer');
88
const Listr = require('listr');
@@ -34,7 +34,7 @@ async function main() {
3434
console.log(` npm run release\n`);
3535

3636
} catch(err) {
37-
console.log('\n', tc.red(err), '\n');
37+
console.log('\n', red(err), '\n');
3838
process.exit(1);
3939
}
4040
}
@@ -84,7 +84,7 @@ async function askVersion() {
8484
type: 'confirm',
8585
name: 'confirm',
8686
message: answers => {
87-
return `Will bump from ${tc.cyan(oldVersion)} to ${tc.cyan(answers.version)}. Continue?`;
87+
return `Will bump from ${cyan(oldVersion)} to ${cyan(answers.version)}. Continue?`;
8888
}
8989
}
9090
];
@@ -131,7 +131,7 @@ async function preparePackages(packages, version, install) {
131131
function validateGit(tasks, version) {
132132
tasks.push(
133133
{
134-
title: `Validate git tag ${tc.dim(`(v${version})`)}`,
134+
title: `Validate git tag ${dim(`(v${version})`)}`,
135135
task: () => execa('git', ['fetch'])
136136
.then(() => {
137137
return execa.stdout('npm', ['config', 'get', 'tag-version-prefix']);
@@ -198,17 +198,17 @@ function prettyVersionDiff(oldVersion, inc) {
198198

199199
for (let i = 0; i < newVersion.length; i++) {
200200
if ((newVersion[i] !== oldVersion[i] && !firstVersionChange)) {
201-
output.push(`${tc.dim.cyan(newVersion[i])}`);
201+
output.push(`${dim(cyan(newVersion[i]))}`);
202202
firstVersionChange = true;
203203
} else if (newVersion[i].indexOf('-') >= 1) {
204204
let preVersion = [];
205205
preVersion = newVersion[i].split('-');
206-
output.push(`${tc.dim.cyan(`${preVersion[0]}-${preVersion[1]}`)}`);
206+
output.push(`${dim(cyan(`${preVersion[0]}-${preVersion[1]}`))}`);
207207
} else {
208-
output.push(tc.reset.dim(newVersion[i]));
208+
output.push(reset(dim(newVersion[i])));
209209
}
210210
}
211-
return output.join(tc.reset.dim('.'));
211+
return output.join(reset(dim('.')));
212212
}
213213

214214
main();

.scripts/release-dev.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const tc = require('turbocolor');
1+
const { cyan, red } = require('colorette');
22
const semver = require('semver');
33
const execa = require('execa');
44
const inquirer = require('inquirer');
@@ -47,7 +47,7 @@ async function main() {
4747
console.log(`\nionic ${devVersion} published!! 🎉\n`);
4848

4949
} catch (err) {
50-
console.log('\n', tc.red(err), '\n');
50+
console.log('\n', red(err), '\n');
5151
process.exit(1);
5252
}
5353

@@ -64,7 +64,7 @@ async function askDevVersion(devVersion) {
6464
name: 'confirm',
6565
value: true,
6666
message: () => {
67-
return `Publish the dev build ${tc.cyan(devVersion)}?`;
67+
return `Publish the dev build ${cyan(devVersion)}?`;
6868
}
6969
}
7070
];

.scripts/release.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Deploy script adopted from https://github.com/sindresorhus/np
33
* MIT License (c) Sindre Sorhus (sindresorhus.com)
44
*/
5-
const tc = require('turbocolor');
5+
const { cyan, dim, green, red, yellow } = require('colorette');
66
const execa = require('execa');
77
const Listr = require('listr');
88
const path = require('path');
@@ -48,14 +48,14 @@ async function main() {
4848
// Dry run doesn't publish to npm or git
4949
if (dryRun) {
5050
console.log(`
51-
\n${tc.yellow('Did not publish. Remove the "--dry-run" flag to publish:')}\n${tc.green(version)} to ${tc.cyan(npmTag)}\n
51+
\n${yellow('Did not publish. Remove the "--dry-run" flag to publish:')}\n${green(version)} to ${cyan(npmTag)}\n
5252
`);
5353
} else {
5454
console.log(`\nionic ${version} published to ${npmTag}!! 🎉\n`);
5555
}
5656

5757
} catch (err) {
58-
console.log('\n', tc.red(err), '\n');
58+
console.log('\n', red(err), '\n');
5959
process.exit(1);
6060
}
6161
}
@@ -75,7 +75,7 @@ function publishGit(tasks, version, changelog, npmTag) {
7575

7676
tasks.push(
7777
{
78-
title: `Tag latest commit ${tc.dim(`(${gitTag})`)}`,
78+
title: `Tag latest commit ${dim(`(${gitTag})`)}`,
7979
task: () => execa('git', ['tag', `${gitTag}`], { cwd: common.rootDir })
8080
},
8181
{

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
},
1111
"devDependencies": {
1212
"@octokit/rest": "^17.0.0",
13+
"colorette": "^1.2.0",
1314
"conventional-changelog-cli": "^2.0.1",
1415
"execa": "^0.10.0",
1516
"fs-extra": "^7.0.0",
1617
"inquirer": "^6.0.0",
1718
"lerna": "^3.16.2",
1819
"listr": "^0.14.0",
1920
"rimraf": "^2.6.3",
20-
"semver": "^5.5.0",
21-
"turbocolor": "^2.4.1"
21+
"semver": "^5.5.0"
2222
},
2323
"engines": {
2424
"node": ">= 10"

0 commit comments

Comments
 (0)