Skip to content

Commit

Permalink
Merge pull request #25236 from storybookjs/shilman/kill-stories-json
Browse files Browse the repository at this point in the history
API: Remove stories.json support
  • Loading branch information
shilman authored Dec 18, 2023
2 parents 5854e5a + ff88e04 commit 152edae
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 2,234 deletions.
7 changes: 7 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Icons is deprecated](#icons-is-deprecated)
- [React-docgen component analysis by default](#react-docgen-component-analysis-by-default)
- [Removed postinstall](#removed-postinstall)
- [Removed stories.json](#removed-storiesjson)
- [Framework-specific changes](#framework-specific-changes)
- [Angular: Drop support for Angular \< 15](#angular-drop-support-for-angular--15)
- [Next.js: Drop support for version \< 13.5](#nextjs-drop-support-for-version--135)
Expand Down Expand Up @@ -473,6 +474,12 @@ For more information see: https://storybook.js.org/docs/react/api/main-config-ty

We removed the `@storybook/postinstall` package, which provided some utilities for addons to programmatically modify user configuration files on install. This package was years out of date, so this should be a non-disruptive change. If your addon used the package, you can view the old source code [here](https://github.com/storybookjs/storybook/tree/release-7-5/code/lib/postinstall) and adapt it into your addon.

#### Removed stories.json

In addition to the built storybook, `storybook build` generates two files, `index.json` and `stories.json`, that list out the contents of the Storybook. `stories.json` is a legacy format and we included it for backwards compatibility. As of 8.0 we no longer build `stories.json` by default, and we will remove it completely in 9.0.

In the meantime if you have code that relies on `stories.json`, you can find code that transforms the "v4" `index.json` to the "v3" `stories.json` format (and their respective TS types): https://github.com/storybookjs/storybook/blob/release-7-5/code/lib/core-server/src/utils/stories-json.ts#L71-L91

### Framework-specific changes

#### Angular: Drop support for Angular \< 15
Expand Down
10 changes: 1 addition & 9 deletions code/lib/core-server/src/build-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
copyAllStaticFilesRelativeToMain,
} from './utils/copy-all-static-files';
import { getBuilders } from './utils/get-builders';
import { convertToIndexV3, extractStoriesJson } from './utils/stories-json';
import { extractStoriesJson } from './utils/stories-json';
import { extractStorybookMetadata } from './utils/metadata';
import { StoryIndexGenerator } from './utils/StoryIndexGenerator';
import { summarizeIndex } from './utils/summarizeIndex';
Expand Down Expand Up @@ -172,19 +172,11 @@ export async function buildStaticStandalone(options: BuildStaticStandaloneOption
storyIndexers: deprecatedStoryIndexers,
indexers,
docs: docsOptions,
storiesV2Compatibility: !features?.storyStoreV7,
storyStoreV7: !!features?.storyStoreV7,
build,
});

initializedStoryIndexGenerator = generator.initialize().then(() => generator);
effects.push(
extractStoriesJson(
join(options.outputDir, 'stories.json'),
initializedStoryIndexGenerator as Promise<StoryIndexGenerator>,
convertToIndexV3
)
);
effects.push(
extractStoriesJson(
join(options.outputDir, 'index.json'),
Expand Down
Loading

0 comments on commit 152edae

Please sign in to comment.