chore(): update scripts to use colorette instead of turbocolor (#21349)
This commit is contained in:
parent
60be68ca6d
commit
c680705162
|
@ -4,7 +4,7 @@ const execa = require('execa');
|
||||||
const inquirer = require('inquirer');
|
const inquirer = require('inquirer');
|
||||||
const Listr = require('listr');
|
const Listr = require('listr');
|
||||||
const semver = require('semver');
|
const semver = require('semver');
|
||||||
const tc = require('turbocolor');
|
const { bold, cyan, dim } = require('colorette');
|
||||||
|
|
||||||
const rootDir = path.join(__dirname, '../');
|
const rootDir = path.join(__dirname, '../');
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ async function askNpmTag(version) {
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
name: 'confirm',
|
name: 'confirm',
|
||||||
message: answers => {
|
message: answers => {
|
||||||
return `Will publish ${tc.cyan(version)} to ${tc.cyan(answers.npmTag)}. Continue?`;
|
return `Will publish ${cyan(version)} to ${cyan(answers.npmTag)}. Continue?`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -192,7 +192,7 @@ function preparePackage(tasks, package, version, install) {
|
||||||
|
|
||||||
// Add project tasks
|
// Add project tasks
|
||||||
tasks.push({
|
tasks.push({
|
||||||
title: `Prepare ${tc.bold(pkg.name)}`,
|
title: `Prepare ${bold(pkg.name)}`,
|
||||||
task: () => new Listr(projectTasks)
|
task: () => new Listr(projectTasks)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ function prepareDevPackage(tasks, package, version) {
|
||||||
|
|
||||||
// Add project tasks
|
// Add project tasks
|
||||||
tasks.push({
|
tasks.push({
|
||||||
title: `Prepare dev build: ${tc.bold(pkg.name)}`,
|
title: `Prepare dev build: ${bold(pkg.name)}`,
|
||||||
task: () => new Listr(projectTasks)
|
task: () => new Listr(projectTasks)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ function updatePackageVersions(tasks, packages, version) {
|
||||||
updatePackageVersion(tasks, package, version);
|
updatePackageVersion(tasks, package, version);
|
||||||
|
|
||||||
tasks.push({
|
tasks.push({
|
||||||
title: `${package} update @ionic/core dependency, if present ${tc.dim(`(${version})`)}`,
|
title: `${package} update @ionic/core dependency, if present ${dim(`(${version})`)}`,
|
||||||
task: async () => {
|
task: async () => {
|
||||||
if (package !== 'core') {
|
if (package !== 'core') {
|
||||||
const pkg = readPkg(package);
|
const pkg = readPkg(package);
|
||||||
|
@ -261,7 +261,7 @@ function updatePackageVersions(tasks, packages, version) {
|
||||||
updatePackageVersion(tasks, distPackage, version);
|
updatePackageVersion(tasks, distPackage, version);
|
||||||
|
|
||||||
tasks.push({
|
tasks.push({
|
||||||
title: `${package} update @ionic/core dependency, if present ${tc.dim(`(${version})`)}`,
|
title: `${package} update @ionic/core dependency, if present ${dim(`(${version})`)}`,
|
||||||
task: async () => {
|
task: async () => {
|
||||||
const pkg = readPkg(distPackage);
|
const pkg = readPkg(distPackage);
|
||||||
updateDependency(pkg, '@ionic/core', version);
|
updateDependency(pkg, '@ionic/core', version);
|
||||||
|
@ -272,7 +272,7 @@ function updatePackageVersions(tasks, packages, version) {
|
||||||
|
|
||||||
if (package === 'packages/react-router') {
|
if (package === 'packages/react-router') {
|
||||||
tasks.push({
|
tasks.push({
|
||||||
title: `${package} update @ionic/react dependency, if present ${tc.dim(`(${version})`)}`,
|
title: `${package} update @ionic/react dependency, if present ${dim(`(${version})`)}`,
|
||||||
task: async () => {
|
task: async () => {
|
||||||
const pkg = readPkg(package);
|
const pkg = readPkg(package);
|
||||||
updateDependency(pkg, '@ionic/react', version);
|
updateDependency(pkg, '@ionic/react', version);
|
||||||
|
@ -287,7 +287,7 @@ function updatePackageVersion(tasks, package, version) {
|
||||||
const projectRoot = projectPath(package);
|
const projectRoot = projectPath(package);
|
||||||
|
|
||||||
tasks.push({
|
tasks.push({
|
||||||
title: `${package}: update package.json ${tc.dim(`(${version})`)}`,
|
title: `${package}: update package.json ${dim(`(${version})`)}`,
|
||||||
task: async () => {
|
task: async () => {
|
||||||
await execa('npm', ['version', version], { cwd: projectRoot });
|
await execa('npm', ['version', version], { cwd: projectRoot });
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Deploy script adopted from https://github.com/sindresorhus/np
|
* Deploy script adopted from https://github.com/sindresorhus/np
|
||||||
* MIT License (c) Sindre Sorhus (sindresorhus.com)
|
* MIT License (c) Sindre Sorhus (sindresorhus.com)
|
||||||
*/
|
*/
|
||||||
const tc = require('turbocolor');
|
const { cyan, dim, red, reset } = require('colorette');
|
||||||
const execa = require('execa');
|
const execa = require('execa');
|
||||||
const inquirer = require('inquirer');
|
const inquirer = require('inquirer');
|
||||||
const Listr = require('listr');
|
const Listr = require('listr');
|
||||||
|
@ -34,7 +34,7 @@ async function main() {
|
||||||
console.log(` npm run release\n`);
|
console.log(` npm run release\n`);
|
||||||
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log('\n', tc.red(err), '\n');
|
console.log('\n', red(err), '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ async function askVersion() {
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
name: 'confirm',
|
name: 'confirm',
|
||||||
message: answers => {
|
message: answers => {
|
||||||
return `Will bump from ${tc.cyan(oldVersion)} to ${tc.cyan(answers.version)}. Continue?`;
|
return `Will bump from ${cyan(oldVersion)} to ${cyan(answers.version)}. Continue?`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -131,7 +131,7 @@ async function preparePackages(packages, version, install) {
|
||||||
function validateGit(tasks, version) {
|
function validateGit(tasks, version) {
|
||||||
tasks.push(
|
tasks.push(
|
||||||
{
|
{
|
||||||
title: `Validate git tag ${tc.dim(`(v${version})`)}`,
|
title: `Validate git tag ${dim(`(v${version})`)}`,
|
||||||
task: () => execa('git', ['fetch'])
|
task: () => execa('git', ['fetch'])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return execa.stdout('npm', ['config', 'get', 'tag-version-prefix']);
|
return execa.stdout('npm', ['config', 'get', 'tag-version-prefix']);
|
||||||
|
@ -198,17 +198,17 @@ function prettyVersionDiff(oldVersion, inc) {
|
||||||
|
|
||||||
for (let i = 0; i < newVersion.length; i++) {
|
for (let i = 0; i < newVersion.length; i++) {
|
||||||
if ((newVersion[i] !== oldVersion[i] && !firstVersionChange)) {
|
if ((newVersion[i] !== oldVersion[i] && !firstVersionChange)) {
|
||||||
output.push(`${tc.dim.cyan(newVersion[i])}`);
|
output.push(`${dim(cyan(newVersion[i]))}`);
|
||||||
firstVersionChange = true;
|
firstVersionChange = true;
|
||||||
} else if (newVersion[i].indexOf('-') >= 1) {
|
} else if (newVersion[i].indexOf('-') >= 1) {
|
||||||
let preVersion = [];
|
let preVersion = [];
|
||||||
preVersion = newVersion[i].split('-');
|
preVersion = newVersion[i].split('-');
|
||||||
output.push(`${tc.dim.cyan(`${preVersion[0]}-${preVersion[1]}`)}`);
|
output.push(`${dim(cyan(`${preVersion[0]}-${preVersion[1]}`))}`);
|
||||||
} else {
|
} else {
|
||||||
output.push(tc.reset.dim(newVersion[i]));
|
output.push(reset(dim(newVersion[i])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return output.join(tc.reset.dim('.'));
|
return output.join(reset(dim('.')));
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const tc = require('turbocolor');
|
const { cyan, red } = require('colorette');
|
||||||
const semver = require('semver');
|
const semver = require('semver');
|
||||||
const execa = require('execa');
|
const execa = require('execa');
|
||||||
const inquirer = require('inquirer');
|
const inquirer = require('inquirer');
|
||||||
|
@ -47,7 +47,7 @@ async function main() {
|
||||||
console.log(`\nionic ${devVersion} published!! 🎉\n`);
|
console.log(`\nionic ${devVersion} published!! 🎉\n`);
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('\n', tc.red(err), '\n');
|
console.log('\n', red(err), '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ async function askDevVersion(devVersion) {
|
||||||
name: 'confirm',
|
name: 'confirm',
|
||||||
value: true,
|
value: true,
|
||||||
message: () => {
|
message: () => {
|
||||||
return `Publish the dev build ${tc.cyan(devVersion)}?`;
|
return `Publish the dev build ${cyan(devVersion)}?`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Deploy script adopted from https://github.com/sindresorhus/np
|
* Deploy script adopted from https://github.com/sindresorhus/np
|
||||||
* MIT License (c) Sindre Sorhus (sindresorhus.com)
|
* MIT License (c) Sindre Sorhus (sindresorhus.com)
|
||||||
*/
|
*/
|
||||||
const tc = require('turbocolor');
|
const { cyan, dim, green, red, yellow } = require('colorette');
|
||||||
const execa = require('execa');
|
const execa = require('execa');
|
||||||
const Listr = require('listr');
|
const Listr = require('listr');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
@ -48,14 +48,14 @@ async function main() {
|
||||||
// Dry run doesn't publish to npm or git
|
// Dry run doesn't publish to npm or git
|
||||||
if (dryRun) {
|
if (dryRun) {
|
||||||
console.log(`
|
console.log(`
|
||||||
\n${tc.yellow('Did not publish. Remove the "--dry-run" flag to publish:')}\n${tc.green(version)} to ${tc.cyan(npmTag)}\n
|
\n${yellow('Did not publish. Remove the "--dry-run" flag to publish:')}\n${green(version)} to ${cyan(npmTag)}\n
|
||||||
`);
|
`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`\nionic ${version} published to ${npmTag}!! 🎉\n`);
|
console.log(`\nionic ${version} published to ${npmTag}!! 🎉\n`);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('\n', tc.red(err), '\n');
|
console.log('\n', red(err), '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ function publishGit(tasks, version, changelog, npmTag) {
|
||||||
|
|
||||||
tasks.push(
|
tasks.push(
|
||||||
{
|
{
|
||||||
title: `Tag latest commit ${tc.dim(`(${gitTag})`)}`,
|
title: `Tag latest commit ${dim(`(${gitTag})`)}`,
|
||||||
task: () => execa('git', ['tag', `${gitTag}`], { cwd: common.rootDir })
|
task: () => execa('git', ['tag', `${gitTag}`], { cwd: common.rootDir })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@octokit/rest": "^17.0.0",
|
"@octokit/rest": "^17.0.0",
|
||||||
|
"colorette": "^1.2.0",
|
||||||
"conventional-changelog-cli": "^2.0.1",
|
"conventional-changelog-cli": "^2.0.1",
|
||||||
"execa": "^0.10.0",
|
"execa": "^0.10.0",
|
||||||
"fs-extra": "^7.0.0",
|
"fs-extra": "^7.0.0",
|
||||||
|
@ -17,8 +18,7 @@
|
||||||
"lerna": "^3.16.2",
|
"lerna": "^3.16.2",
|
||||||
"listr": "^0.14.0",
|
"listr": "^0.14.0",
|
||||||
"rimraf": "^2.6.3",
|
"rimraf": "^2.6.3",
|
||||||
"semver": "^5.5.0",
|
"semver": "^5.5.0"
|
||||||
"turbocolor": "^2.4.1"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">= 10"
|
||||||
|
|
Loading…
Reference in New Issue