Skip to content

Commit

Permalink
Merge pull request #20159 from storybookjs/kasper/sb-1047-re-enable-t…
Browse files Browse the repository at this point in the history
…s-49-ci-templates
  • Loading branch information
kasperpeulen authored Dec 12, 2022
2 parents df84a9f + 75c9a26 commit 589dcfc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 3 additions & 6 deletions code/lib/cli/src/detect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,22 +296,19 @@ describe('Detect', () => {

it(`should return language typescript if the dependency is >TS4.9`, () => {
expect(detectLanguage({ dependencies: { typescript: '4.9.1' } })).toBe(
// TODO: switch to TYPESCRIPT once csf-tools and eslint-plugin-storybook support `satisfies` operator
SupportedLanguage.TYPESCRIPT_LEGACY
SupportedLanguage.TYPESCRIPT
);
});

it(`should return language typescript if the dependency is =TS4.9`, () => {
expect(detectLanguage({ dependencies: { typescript: '4.9.0' } })).toBe(
// TODO: switch to TYPESCRIPT once csf-tools and eslint-plugin-storybook support `satisfies` operator
SupportedLanguage.TYPESCRIPT_LEGACY
SupportedLanguage.TYPESCRIPT
);
});

it(`should return language typescript if the dependency is =TS4.9beta`, () => {
expect(detectLanguage({ dependencies: { typescript: '^4.9.0-beta' } })).toBe(
// TODO: switch to TYPESCRIPT once csf-tools and eslint-plugin-storybook support `satisfies` operator
SupportedLanguage.TYPESCRIPT_LEGACY
SupportedLanguage.TYPESCRIPT
);
});

Expand Down
7 changes: 5 additions & 2 deletions code/lib/cli/src/detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,13 @@ export function detectLanguage(packageJson?: PackageJson) {
(!hasDependency(packageJson, '@typescript-eslint/parser') ||
hasDependency(packageJson, '@typescript-eslint/parser', (version) =>
semver.gte(semver.coerce(version), '5.44.0')
)) &&
(!hasDependency(packageJson, 'eslint-plugin-storybook') ||
hasDependency(packageJson, 'eslint-plugin-storybook', (version) =>
semver.gte(semver.coerce(version), '0.6.8')
))
) {
// TODO: switch to TYPESCRIPT once csf-tools and eslint-plugin-storybook support `satisfies` operator
language = SupportedLanguage.TYPESCRIPT_LEGACY;
language = SupportedLanguage.TYPESCRIPT;
} else if (hasDependency(packageJson, 'typescript')) {
language = SupportedLanguage.TYPESCRIPT_LEGACY;
}
Expand Down

0 comments on commit 589dcfc

Please sign in to comment.