Skip to content

Commit

Permalink
Align with Storybook > 8.2 core package layout
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Nov 4, 2024
1 parent b7ee85b commit 0a4be2f
Show file tree
Hide file tree
Showing 12 changed files with 4,951 additions and 8,123 deletions.
874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.3.cjs

This file was deleted.

934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
enableTelemetry: 0
compressionLevel: mixed

enableGlobalCache: false

enableTelemetry: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.3.cjs
yarnPath: .yarn/releases/yarn-4.5.1.cjs
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ Use the following table to use the correct version of this package, based on the

| Test runner version | Storybook version |
| ------------------- | ----------------- |
| ^0.17.0 | ^8.0.0 |
| ^0.19.0 | ^8.2.0 |
| ~0.17.0 | ^8.0.0 |
| ~0.16.0 | ^7.0.0 |
| ~0.9.4 | ^6.4.0 |

Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
"@jest/types": "^29.6.3",
"@storybook/core-common": "next",
"@storybook/csf": "^0.1.11",
"@storybook/csf-tools": "next",
"@storybook/preview-api": "next",
"@swc/core": "^1.5.22",
"@swc/jest": "^0.2.23",
"expect-playwright": "^0.8.0",
Expand Down Expand Up @@ -116,6 +114,9 @@
"vite": "^4.4.5",
"wait-on": "^7.2.0"
},
"peerDependencies": {
"storybook": "^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0"
},
"engines": {
"node": "^16.10.0 || ^18.0.0 || >=20.0.0"
},
Expand All @@ -139,5 +140,6 @@
"react-native"
],
"icon": "https://user-images.githubusercontent.com/321738/63501763-88dbf600-c4cc-11e9-96cd-94adadc2fd72.png"
}
},
"packageManager": "[email protected]"
}
5 changes: 3 additions & 2 deletions src/csf/transformCsf.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-underscore-dangle */
import { loadCsf } from '@storybook/csf-tools';
import { toId, storyNameFromExport, combineTags } from '@storybook/csf';
import { loadCsf } from 'storybook/internal/csf-tools';
import * as t from '@babel/types';
import generate from '@babel/generator';
import { toId, storyNameFromExport, combineTags } from '@storybook/csf';
import dedent from 'ts-dedent';

import { getTagOptions } from '../util/getTagOptions';
Expand Down Expand Up @@ -124,6 +124,7 @@ export const transformCsf = (
const annotations = csf._storyAnnotations[key];
acc[key] = {};
if (annotations?.play) {
// @ts-expect-error type mismatch – check later
acc[key].play = annotations.play;
}

Expand Down
4 changes: 2 additions & 2 deletions src/playwright/transformPlaywright.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { relative } from 'path';
import template from '@babel/template';
import { userOrAutoTitle } from '@storybook/preview-api';
import { userOrAutoTitle } from 'storybook/internal/preview-api';
import dedent from 'ts-dedent';

import { getStorybookMetadata } from '../util';
import { transformCsf } from '../csf/transformCsf';
import type { TestPrefixer } from '../csf/transformCsf';
import dedent from 'ts-dedent';

const coverageErrorMessage = dedent`
[Test runner] An error occurred when evaluating code coverage:
Expand Down
2 changes: 1 addition & 1 deletion src/test-storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { transformPlaywrightJson } from './playwright/transformPlaywrightJson';
import { glob } from 'glob';
import { TestRunnerConfig } from './playwright/hooks';
import { getInterpretedFile } from '@storybook/core-common';
import { readConfig } from '@storybook/csf-tools';
import { readConfig } from 'storybook/internal/csf-tools';

// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'test';
Expand Down
2 changes: 1 addition & 1 deletion src/util/getStorybookMain.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join, resolve } from 'path';
import { serverRequire } from '@storybook/core-common';
import type { StorybookConfig } from '@storybook/types';
import type { StorybookConfig } from 'storybook/internal/types';
import dedent from 'ts-dedent';

export const storybookMainConfig = new Map<string, StorybookConfig>();
Expand Down
4 changes: 2 additions & 2 deletions src/util/getStorybookMetadata.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StorybookConfig } from '@storybook/types';
import * as storybookMain from './getStorybookMain';
import { StorybookConfig } from 'storybook/internal/types';

import * as storybookMain from './getStorybookMain';
import { getStorybookMetadata } from './getStorybookMetadata';

jest.mock('@storybook/core-common', () => ({
Expand Down
3 changes: 2 additions & 1 deletion src/util/getStorybookMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { join } from 'path';
import { normalizeStories, getProjectRoot } from '@storybook/core-common';
import { StoriesEntry } from 'storybook/internal/types';

import { getStorybookMain } from './getStorybookMain';
import { StoriesEntry } from '@storybook/types';

export const getStorybookMetadata = () => {
const workingDir = getProjectRoot();
Expand Down
Loading

0 comments on commit 0a4be2f

Please sign in to comment.