Skip to content

Commit 5416983

Browse files
author
Daniel Del Core
committed
filepaths to configs are returned with fetcher functions
1 parent a9defa8 commit 5416983

File tree

13 files changed

+246
-150
lines changed

13 files changed

+246
-150
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeshift/fetcher': minor
3+
---
4+
5+
Fetcher now returns entrypoint filepath.

packages/cli/src/list.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('list', () => {
3333

3434
const result = (console.log as jest.Mock).mock.calls.join('\n');
3535

36-
expect(result).toEqual(`${chalk.bold('foobar')}
36+
expect(result).toEqual(`${chalk.bold('@codeshift/mod-foobar')}
3737
├─ transforms
3838
| ├─ 18.0.0
3939
| └─ 19.0.0
@@ -47,7 +47,7 @@ describe('list', () => {
4747

4848
const result = (console.log as jest.Mock).mock.calls.join('\n');
4949

50-
expect(result).toEqual(`${chalk.bold('@foo/bar')}
50+
expect(result).toEqual(`${chalk.bold('@codeshift/mod-foo__bar')}
5151
├─ transforms
5252
| ├─ 18.0.0
5353
| └─ 19.0.0
@@ -61,13 +61,13 @@ describe('list', () => {
6161

6262
const result = (console.log as jest.Mock).mock.calls.join('\n');
6363

64-
expect(result).toEqual(`${chalk.bold('bar')}
64+
expect(result).toEqual(`${chalk.bold('@codeshift/mod-bar')}
6565
├─ transforms
6666
| ├─ 18.0.0
6767
| └─ 19.0.0
6868
└─ presets
6969
└─ sort-imports
70-
${chalk.bold('@foo/bar')}
70+
${chalk.bold('@codeshift/mod-foo__bar')}
7171
├─ transforms
7272
| ├─ 18.0.0
7373
| └─ 19.0.0
@@ -132,13 +132,13 @@ ${chalk.bold('@foo/bar')}
132132

133133
const result = (console.log as jest.Mock).mock.calls.join('\n');
134134

135-
expect(result).toEqual(`${chalk.bold('found1')}
135+
expect(result).toEqual(`${chalk.bold('@codeshift/mod-found1')}
136136
├─ transforms
137137
| ├─ 18.0.0
138138
| └─ 19.0.0
139139
└─ presets
140140
└─ sort-imports
141-
${chalk.bold('found2')}
141+
${chalk.bold('@codeshift/mod-found2')}
142142
├─ transforms
143143
| ├─ 18.0.0
144144
| └─ 19.0.0

packages/cli/src/list.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
import chalk from 'chalk';
22
import { PluginManager } from 'live-plugin-manager';
33

4-
import { fetchPackageConfig } from './fetch-package';
4+
import { fetchPackages } from './utils/fetch-package';
5+
import { getCodeshiftPackageName } from './utils/package-names';
56

67
export default async function list(packages: string[]) {
78
const packageManager = new PluginManager();
89
const configs = [];
910

1011
for (const packageName of packages) {
1112
try {
12-
const config = await fetchPackageConfig(packageName, packageManager);
13-
configs.push({ packageName, config });
13+
const { community, remote } = await fetchPackages(
14+
packageName,
15+
packageManager,
16+
);
17+
community &&
18+
configs.push({
19+
packageName: getCodeshiftPackageName(packageName),
20+
config: community.config,
21+
});
22+
remote && configs.push({ packageName, config: remote.config });
1423
} catch (error) {
1524
console.warn(
1625
chalk.red(

0 commit comments

Comments
 (0)