Skip to content

Commit 4781125

Browse files
committed
List command no longer stops on error
1 parent 450c977 commit 4781125

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

.changeset/shiny-rats-roll.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeshift/cli': patch
3+
---
4+
5+
List CLI command no longer exits on error. Instead it will log a message

packages/cli/src/errors.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export class NoTransformsExistError extends Error {}
21
export class InvalidUserInputError extends Error {}

packages/cli/src/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import main from './main';
33
import list from './list';
44
import init from './init';
55
import validate from './validate';
6-
import { NoTransformsExistError, InvalidUserInputError } from './errors';
6+
import { InvalidUserInputError } from './errors';
77

88
import packageJson from '../package.json';
99
import { Command, Option, CommanderError } from 'commander';
@@ -124,11 +124,6 @@ try {
124124
process.exit(9);
125125
}
126126

127-
if (error instanceof NoTransformsExistError) {
128-
console.warn(chalk.yellow(error.message));
129-
process.exit(0);
130-
}
131-
132127
console.error(chalk.red(error));
133128
process.exit(3);
134129
}

packages/cli/src/list.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import chalk from 'chalk';
22
import { PluginManager } from 'live-plugin-manager';
3-
import { NoTransformsExistError } from './errors';
43

54
export default async function list(packages: string[]) {
65
const packageManager = new PluginManager();
@@ -13,8 +12,10 @@ export default async function list(packages: string[]) {
1312
try {
1413
await packageManager.install(codemodName);
1514
} catch (error) {
16-
throw new NoTransformsExistError(
17-
`No transforms found for package ${pkgSplit[0]}`,
15+
console.log(
16+
chalk.red(
17+
`Unable to find codeshift package: ${chalk.bold(codemodName)}.`,
18+
),
1819
);
1920
}
2021

0 commit comments

Comments
 (0)