-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20449 from storybookjs/cli/add-prop-types
CLI: Add prop-types dependency if not using TypeScript
- Loading branch information
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |