Skip to content

Commit

Permalink
Merge pull request #20449 from storybookjs/cli/add-prop-types
Browse files Browse the repository at this point in the history
CLI: Add prop-types dependency if not using TypeScript
  • Loading branch information
IanVS authored Dec 31, 2022
2 parents 8408bcf + f0000d8 commit 038735d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion code/lib/cli/src/generators/REACT/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { detectLanguage } from '../../detect';
import { SupportedLanguage } from '../../project_types';
import { baseGenerator } from '../baseGenerator';
import type { Generator } from '../types';

const generator: Generator = async (packageManager, npmOptions, options) => {
await baseGenerator(packageManager, npmOptions, options, 'react');
// Add prop-types dependency if not using TypeScript
const language = detectLanguage();
const extraPackages = language === SupportedLanguage.JAVASCRIPT ? ['prop-types'] : [];

await baseGenerator(packageManager, npmOptions, options, 'react', {
extraPackages,
});
};

export default generator;

0 comments on commit 038735d

Please sign in to comment.