Skip to content

Commit d5c8df3

Browse files
committed
fix: fixing list-add-ons
1 parent 4fe61eb commit d5c8df3

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/cta-cli/src/cli.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ Remove your node_modules directory and package lock file and re-install.`,
266266
}
267267
return value
268268
},
269-
defaultFramework || 'React',
269+
defaultFramework || 'react-cra',
270270
)
271271
}
272272

@@ -334,6 +334,7 @@ Remove your node_modules directory and package lock file and re-install.`,
334334

335335
program.action(async (projectName: string, options: CliOptions) => {
336336
if (options.listAddOns) {
337+
console.log(options.framework || defaultFramework || 'react-cra')
337338
const addOns = await getAllAddOns(
338339
getFrameworkById(options.framework || defaultFramework || 'react-cra')!,
339340
defaultMode ||
@@ -355,8 +356,8 @@ Remove your node_modules directory and package lock file and re-install.`,
355356
...options,
356357
} as CliOptions
357358

358-
cliOptions.framework = getFrameworkByName(
359-
options.framework || defaultFramework || 'React',
359+
cliOptions.framework = getFrameworkById(
360+
options.framework || defaultFramework || 'react-cra',
360361
)!.id
361362

362363
if (defaultMode) {

packages/cta-engine/src/frameworks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ export function getFrameworkById(id: string) {
141141
}
142142

143143
export function getFrameworkByName(name: string) {
144-
return frameworks.find((framework) => framework.name === name)
144+
return frameworks.find(
145+
(framework) => framework.name.toLowerCase() === name.toLowerCase(),
146+
)
145147
}
146148

147149
export function getFrameworks() {

packages/cta-engine/tests/frameworks.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ describe('registerFramework', () => {
5757
expect(fileContents).toEqual(JSON.stringify(basePackageJSON))
5858

5959
expect(getFrameworkByName('Test')).not.toBeUndefined()
60+
expect(getFrameworkByName('test')).not.toBeUndefined()
6061
expect(getFrameworks().length).toEqual(1)
6162
})
6263
})

0 commit comments

Comments
 (0)