Skip to content
Open
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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@eslint/js": "^9.37.0",
"@typescript-eslint/eslint-plugin": "^8.46.1",
"@typescript-eslint/parser": "^8.46.1",
"chalk": "^4.1.2",
"picocolors": "^1.1.1",
"eslint": "^9.37.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-n": "^17.23.1",
Expand Down
10 changes: 5 additions & 5 deletions src/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import chalk = require('chalk');
import pc = require('picocolors');
import * as fs from 'fs';
import * as ts from 'typescript';

Expand All @@ -33,19 +33,19 @@ export async function clean(options: Options): Promise<boolean> {
const outDir = tsconfig.compilerOptions.outDir;
if (outDir === '.') {
options.logger.error(
`${chalk.red('ERROR:')} ${chalk.gray('compilerOptions.outDir')} ` +
`${pc.red('ERROR:')} ${pc.gray('compilerOptions.outDir')} ` +
'cannot use the value ".". That would delete all of our sources.',
);
return false;
}
const message = `${chalk.red('Removing')} ${outDir} ...`;
const message = `${pc.red('Removing')} ${outDir} ...`;
options.logger.log(message);
await fs.promises.rm(outDir, {recursive: true, force: true});
return true;
} else {
options.logger.error(
`${chalk.red('ERROR:')} The ${chalk.gray('clean')} command` +
` requires ${chalk.gray('compilerOptions.outDir')} to be defined in ` +
`${pc.red('ERROR:')} The ${pc.gray('clean')} command` +
` requires ${pc.gray('compilerOptions.outDir')} to be defined in ` +
'tsconfig.json.',
);
return false;
Expand Down
14 changes: 7 additions & 7 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {

import {Options} from './cli';
import {PackageJSON} from '@npm/types';
import chalk = require('chalk');
import pc = require('picocolors');

const pkg = require('../../package.json');

Expand Down Expand Up @@ -102,8 +102,8 @@ export async function addScripts(
if (existing !== target) {
if (existing) {
const message =
`package.json already has a script for ${chalk.bold(script)}:\n` +
`-${chalk.red(existing)}\n+${chalk.green(target)}`;
`package.json already has a script for ${pc.bold(script)}:\n` +
`-${pc.red(existing)}\n+${pc.green(target)}`;
install = await query(message, 'Replace', false, options);
}

Expand Down Expand Up @@ -139,8 +139,8 @@ export async function addDependencies(
if (existing !== target) {
if (existing) {
const message =
`Already have devDependency for ${chalk.bold(dep)}:\n` +
`-${chalk.red(existing)}\n+${chalk.green(target)}`;
`Already have devDependency for ${pc.bold(dep)}:\n` +
`-${pc.red(existing)}\n+${pc.green(target)}`;
install = await query(message, 'Overwrite', false, options);
}

Expand Down Expand Up @@ -216,7 +216,7 @@ async function generateConfigFile(
return;
} else if (existing) {
writeFile = await query(
`${chalk.bold(filename)} already exists`,
`${pc.bold(filename)} already exists`,
'Overwrite',
false,
options,
Expand Down Expand Up @@ -313,7 +313,7 @@ export async function init(options: Options): Promise<boolean> {
throw new Error(`Unable to open package.json file: ${err.message}`);
}
const generate = await query(
`${chalk.bold('package.json')} does not exist.`,
`${pc.bold('package.json')} does not exist.`,
'Generate',
true,
options,
Expand Down
4 changes: 2 additions & 2 deletions test/kitchen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk = require('chalk');
import pc = require('picocolors');
import * as cp from 'child_process';
import * as fs from 'fs-extra';
import * as tmp from 'tmp';
Expand Down Expand Up @@ -40,7 +40,7 @@ action('🚰 kitchen sink', () => {

// Create a staging directory with temp fixtures used to test on a fresh application.
before(() => {
console.log(`${chalk.blue(`${__filename} staging area: ${stagingPath}`)}`);
console.log(`${pc.blue(`${__filename} staging area: ${stagingPath}`)}`);
cp.execSync('npm pack');
const tarball = `${pkg.name}-${pkg.version}.tgz`;
fs.renameSync(tarball, 'gts.tgz');
Expand Down
Loading