Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/generate-sandboxes-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
git config --global user.name "Storybook Bot"
git config --global user.email "bot@storybook.js.org"
- name: Install dependencies
run: node ./scripts/check-dependencies.js
run: |
cd ./scripts
node ./check-dependencies.js
cd ..
- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link
- name: Publishing to local registry
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/generate-sandboxes-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
git config --global user.name "Storybook Bot"
git config --global user.email "bot@storybook.js.org"
- name: Install dependencies
run: node ./scripts/check-dependencies.js
run: |
cd ./scripts
node ./check-dependencies.js
cd ..
- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link
- name: Publishing to local registry
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 7.5.4

- Core: Detect no matching export error in storybook start and build - [#24877](https://github.com/storybookjs/storybook/pull/24877), thanks [@yannbf](https://github.com/yannbf)!
- Core: Gracefully handle error when parsing preview.js file - [#24858](https://github.com/storybookjs/storybook/pull/24858), thanks [@yannbf](https://github.com/yannbf)!
- ManagerAPI: Fix setting status without index, crashes storybook - [#24866](https://github.com/storybookjs/storybook/pull/24866), thanks [@ndelangen](https://github.com/ndelangen)!

## 7.5.3

- Angular: Support v17 - [#24717](https://github.com/storybookjs/storybook/pull/24717), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/js-package-manager/NPMProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class NPMProxy extends JsPackageManager {
await this.executeCommand({
command: 'npm',
args: ['install', ...args, ...this.getInstallArgs()],
stdio: ['ignore', logStream, logStream],
stdio: process.env.CI ? 'inherit' : ['ignore', logStream, logStream],
});
} catch (err) {
const stdout = await readLogFile();
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/js-package-manager/PNPMProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class PNPMProxy extends JsPackageManager {
await this.executeCommand({
command: 'pnpm',
args: ['add', ...args, ...this.getInstallArgs()],
stdio: ['ignore', logStream, logStream],
stdio: process.env.CI ? 'inherit' : ['ignore', logStream, logStream],
});
} catch (err) {
const stdout = await readLogFile();
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/js-package-manager/Yarn1Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class Yarn1Proxy extends JsPackageManager {
await this.executeCommand({
command: 'yarn',
args: ['add', ...this.getInstallArgs(), ...args],
stdio: ['ignore', logStream, logStream],
stdio: process.env.CI ? 'inherit' : ['ignore', logStream, logStream],
});
} catch (err) {
const stdout = await readLogFile();
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/js-package-manager/Yarn2Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class Yarn2Proxy extends JsPackageManager {
await this.executeCommand({
command: 'yarn',
args: ['add', ...this.getInstallArgs(), ...args],
stdio: ['ignore', logStream, logStream],
stdio: process.env.CI ? 'inherit' : ['ignore', logStream, logStream],
});
} catch (err) {
const stdout = await readLogFile();
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/repro-generators/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,5 @@ export const svelteKit: Parameters = {
name: 'svelteKit',
version: 'latest',
generator:
'yarn create svelte-with-args --name={{appName}} --directory=. --template=skeleton --types=null --no-prettier --no-eslint --no-playwright',
'yarn create svelte-with-args --name={{appName}} --directory=. --template=skeleton --types=null --no-prettier --no-eslint --no-playwright --no-vitest --no-svelte5',
};
4 changes: 2 additions & 2 deletions code/lib/cli/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const baseTemplates = {
'svelte-kit/skeleton-js': {
name: 'SvelteKit Latest (Vite | JavaScript)',
script:
'yarn create svelte-with-args --name=svelte-kit/skeleton-js --directory={{beforeDir}} --template=skeleton --types=null --no-prettier --no-eslint --no-playwright --no-vitest',
'yarn create svelte-with-args --name=svelte-kit/skeleton-js --directory={{beforeDir}} --template=skeleton --types=null --no-prettier --no-eslint --no-playwright --no-vitest --no-svelte5',
expected: {
framework: '@storybook/sveltekit',
renderer: '@storybook/svelte',
Expand All @@ -344,7 +344,7 @@ const baseTemplates = {
'svelte-kit/skeleton-ts': {
name: 'SvelteKit Latest (Vite | TypeScript)',
script:
'yarn create svelte-with-args --name=svelte-kit/skeleton-ts --directory={{beforeDir}} --template=skeleton --types=typescript --no-prettier --no-eslint --no-playwright --no-vitest',
'yarn create svelte-with-args --name=svelte-kit/skeleton-ts --directory={{beforeDir}} --template=skeleton --types=typescript --no-prettier --no-eslint --no-playwright --no-vitest --no-svelte5',
expected: {
framework: '@storybook/sveltekit',
renderer: '@storybook/svelte',
Expand Down
49 changes: 46 additions & 3 deletions code/lib/csf-tools/src/ConfigFile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-underscore-dangle */
import fs from 'fs-extra';
import dedent from 'ts-dedent';

import * as t from '@babel/types';

Expand All @@ -12,6 +13,30 @@ import { babelParse } from './babelParse';

const logger = console;

const getCsfParsingErrorMessage = ({
expectedType,
foundType,
node,
}: {
expectedType: string;
foundType: string | undefined;
node: any | undefined;
}) => {
let nodeInfo = '';
if (node) {
try {
nodeInfo = JSON.stringify(node);
} catch (e) {
//
}
}

return dedent`
CSF Parsing error: Expected '${expectedType}' but found '${foundType}' instead in '${node?.type}'.
${nodeInfo}
`;
};

const propKey = (p: t.ObjectProperty) => {
if (t.isIdentifier(p.key)) return p.key.name;
if (t.isStringLiteral(p.key)) return p.key.value;
Expand Down Expand Up @@ -163,7 +188,13 @@ export class ConfigFile {
}
});
} else {
logger.warn(`Unexpected ${JSON.stringify(node)}`);
logger.warn(
getCsfParsingErrorMessage({
expectedType: 'ObjectExpression',
foundType: decl?.type,
node: decl || node.declaration,
})
);
}
},
},
Expand All @@ -183,7 +214,13 @@ export class ConfigFile {
}
});
} else {
logger.warn(`Unexpected ${JSON.stringify(node)}`);
logger.warn(
getCsfParsingErrorMessage({
expectedType: 'VariableDeclaration',
foundType: node.declaration?.type,
node: node.declaration,
})
);
}
},
},
Expand Down Expand Up @@ -223,7 +260,13 @@ export class ConfigFile {
}
});
} else {
logger.warn(`Unexpected ${JSON.stringify(node)}`);
logger.warn(
getCsfParsingErrorMessage({
expectedType: 'ObjectExpression',
foundType: exportObject?.type,
node: exportObject,
})
);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion code/lib/manager-api/src/modules/stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,9 @@ export const init: ModuleFn<SubAPI, SubState> = ({
});

await store.setState({ status: newStatus }, { persistence: 'session' });
await api.setIndex(index);
if (index) {
await api.setIndex(index);
}
},
experimental_setFilter: async (id, filterFunction) => {
const { internal_index: index } = store.getState();
Expand Down
26 changes: 26 additions & 0 deletions code/lib/manager-api/src/tests/stories.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,32 @@ describe('stories API', () => {
}
`);
});
it('skips updating index, if index is unset', async () => {
const moduleArgs = createMockModuleArgs({});
const { api } = initStories(moduleArgs as unknown as ModuleArgs);
const { store } = moduleArgs;

await expect(
api.experimental_updateStatus('a-addon-id', {
'a-story-id': {
status: 'pending',
title: 'an addon title',
description: 'an addon description',
},
})
).resolves.not.toThrow();
expect(store.getState().status).toMatchInlineSnapshot(`
Object {
"a-story-id": Object {
"a-addon-id": Object {
"description": "an addon description",
"status": "pending",
"title": "an addon title",
},
},
}
`);
});
it('updates multiple stories', async () => {
const moduleArgs = createMockModuleArgs({});
const { api } = initStories(moduleArgs as unknown as ModuleArgs);
Expand Down
18 changes: 11 additions & 7 deletions code/lib/telemetry/src/storybook-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,17 @@ export const computeStorybookMetadata = async ({

const storybookInfo = getStorybookInfo(packageJson);

const { previewConfig } = storybookInfo;
if (previewConfig) {
const config = await readConfig(previewConfig);
const usesGlobals = !!(
config.getFieldNode(['globals']) || config.getFieldNode(['globalTypes'])
);
metadata.preview = { ...metadata.preview, usesGlobals };
try {
const { previewConfig } = storybookInfo;
if (previewConfig) {
const config = await readConfig(previewConfig);
const usesGlobals = !!(
config.getFieldNode(['globals']) || config.getFieldNode(['globalTypes'])
);
metadata.preview = { ...metadata.preview, usesGlobals };
}
} catch (e) {
// gracefully handle error, as it's not critical information and AST parsing can cause trouble
}

const storybookVersion = storybookPackages[storybookInfo.frameworkPackage]?.version;
Expand Down
5 changes: 3 additions & 2 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/experimental-utils": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@vitejs/plugin-react": "^2.1.0",
"@vitejs/plugin-react": "^3.0.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^9.1.2",
"chromatic": "7.1.0",
Expand Down Expand Up @@ -328,5 +328,6 @@
"Dependency Upgrades"
]
]
}
},
"deferredNextVersion": "7.5.4"
}
34 changes: 4 additions & 30 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.18.9, @babel/core@npm:^7.19.6, @babel/core@npm:^7.20.12, @babel/core@npm:^7.22.0, @babel/core@npm:^7.22.1, @babel/core@npm:^7.22.9, @babel/core@npm:^7.3.4, @babel/core@npm:^7.7.5":
"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.18.9, @babel/core@npm:^7.20.12, @babel/core@npm:^7.22.0, @babel/core@npm:^7.22.1, @babel/core@npm:^7.22.9, @babel/core@npm:^7.3.4, @babel/core@npm:^7.7.5":
version: 7.23.0
resolution: "@babel/core@npm:7.23.0"
dependencies:
Expand Down Expand Up @@ -1718,7 +1718,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-transform-react-jsx-development@npm:^7.16.7, @babel/plugin-transform-react-jsx-development@npm:^7.18.6, @babel/plugin-transform-react-jsx-development@npm:^7.22.5":
"@babel/plugin-transform-react-jsx-development@npm:^7.16.7, @babel/plugin-transform-react-jsx-development@npm:^7.22.5":
version: 7.22.5
resolution: "@babel/plugin-transform-react-jsx-development@npm:7.22.5"
dependencies:
Expand Down Expand Up @@ -1751,7 +1751,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-transform-react-jsx@npm:^7.14.9, @babel/plugin-transform-react-jsx@npm:^7.19.0, @babel/plugin-transform-react-jsx@npm:^7.22.15, @babel/plugin-transform-react-jsx@npm:^7.22.5":
"@babel/plugin-transform-react-jsx@npm:^7.14.9, @babel/plugin-transform-react-jsx@npm:^7.22.15, @babel/plugin-transform-react-jsx@npm:^7.22.5":
version: 7.22.15
resolution: "@babel/plugin-transform-react-jsx@npm:7.22.15"
dependencies:
Expand Down Expand Up @@ -7928,7 +7928,7 @@ __metadata:
"@typescript-eslint/eslint-plugin": ^5.45.0
"@typescript-eslint/experimental-utils": ^5.45.0
"@typescript-eslint/parser": ^5.45.0
"@vitejs/plugin-react": ^2.1.0
"@vitejs/plugin-react": ^3.0.1
babel-eslint: ^10.1.0
babel-loader: ^9.1.2
chromatic: 7.1.0
Expand Down Expand Up @@ -10156,23 +10156,6 @@ __metadata:
languageName: node
linkType: hard

"@vitejs/plugin-react@npm:^2.1.0":
version: 2.2.0
resolution: "@vitejs/plugin-react@npm:2.2.0"
dependencies:
"@babel/core": ^7.19.6
"@babel/plugin-transform-react-jsx": ^7.19.0
"@babel/plugin-transform-react-jsx-development": ^7.18.6
"@babel/plugin-transform-react-jsx-self": ^7.18.6
"@babel/plugin-transform-react-jsx-source": ^7.19.6
magic-string: ^0.26.7
react-refresh: ^0.14.0
peerDependencies:
vite: ^3.0.0
checksum: 85fe5c740fbe8aa5dd4c3516a02a937dff0e2b0858cfa7cf8a69b998b7d05e08c296a087fde66f9171367f5c9d10d6e4bc026df1fa1e2ec528f49e7eaabeeae1
languageName: node
linkType: hard

"@vitejs/plugin-react@npm:^3.0.1":
version: 3.1.0
resolution: "@vitejs/plugin-react@npm:3.1.0"
Expand Down Expand Up @@ -22309,15 +22292,6 @@ __metadata:
languageName: node
linkType: hard

"magic-string@npm:^0.26.7":
version: 0.26.7
resolution: "magic-string@npm:0.26.7"
dependencies:
sourcemap-codec: ^1.4.8
checksum: 950035b344fe2a8163668980bc4a215a0b225086e6e22100fd947e7647053c6ba6b4f11a04de83a97a276526ccb602ef53b173725dbb1971fb146cff5a5e14f6
languageName: node
linkType: hard

"magic-string@npm:^0.27.0":
version: 0.27.0
resolution: "magic-string@npm:0.27.0"
Expand Down
2 changes: 1 addition & 1 deletion docs/sharing/design-integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Once they're connected, you'll be able to view the story by clicking the link in

### Embed Figma in Storybook with the addon

[Design addon](https://storybook.js.org/addons/storybook-addon-designs) allows you to embed Figma files and prototypes in Storybook.
[Designs addon](https://storybook.js.org/addons/@storybook/addon-designs) allows you to embed Figma files and prototypes in Storybook.

![Storybook addon figma](./storybook-figma-addon.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import type { Meta, StoryObj } from '@storybook/web-components';

const Meta: Meta = {
const meta: Meta = {
component: 'custom-button',
//👇 Enables auto-generated documentation for the component story
tags: ['autodocs'],
Expand Down
2 changes: 1 addition & 1 deletion docs/versions/latest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"7.5.3","info":{"plain":"- Angular: Support v17 - [#24717](https://github.com/storybookjs/storybook/pull/24717), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!\n- CLI: Catch when prettier failed to prettify main and preview config files - [#24604](https://github.com/storybookjs/storybook/pull/24604), thanks [@kasperpeulen](https://github.com/kasperpeulen)!\n- UI: Fix button contrast-ratio - [#24525](https://github.com/storybookjs/storybook/pull/24525), thanks [@maheshchandra10](https://github.com/maheshchandra10)!"}}
{"version":"7.5.4","info":{"plain":"- Core: Detect no matching export error in storybook start and build - [#24877](https://github.com/storybookjs/storybook/pull/24877), thanks [@yannbf](https://github.com/yannbf)!\n- Core: Gracefully handle error when parsing preview.js file - [#24858](https://github.com/storybookjs/storybook/pull/24858), thanks [@yannbf](https://github.com/yannbf)!\n- ManagerAPI: Fix setting status without index, crashes storybook - [#24866](https://github.com/storybookjs/storybook/pull/24866), thanks [@ndelangen](https://github.com/ndelangen)!"}}
2 changes: 1 addition & 1 deletion docs/versions/next.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"7.6.0-alpha.4","info":{"plain":"- CLI: Ensure errors with opening the browser are caught - [#24668](https://github.com/storybookjs/storybook/pull/24668), thanks [@xueyawei](https://github.com/xueyawei)!\n- Babel: Update all @babel/* dependencies - [#24610](https://github.com/storybookjs/storybook/pull/24610), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!\n- CLI: Catch when prettier failed to prettify main and preview config files - [#24604](https://github.com/storybookjs/storybook/pull/24604), thanks [@kasperpeulen](https://github.com/kasperpeulen)!\n- CLI: Ignore `addon-onboarding` when checking versions - [#24634](https://github.com/storybookjs/storybook/pull/24634), thanks [@JReinhold](https://github.com/JReinhold)!\n- CLI: Use @storybook/test in template stories - [#24393](https://github.com/storybookjs/storybook/pull/24393), thanks [@yannbf](https://github.com/yannbf)!\n- Controls: Improve accessibility of BooleanControl for screen readers - [#24418](https://github.com/storybookjs/storybook/pull/24418), thanks [@danielmarcano](https://github.com/danielmarcano)!\n- Dependencies: Update @babel/traverse and @babel/core to fix vulnerability - [#24670](https://github.com/storybookjs/storybook/pull/24670), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!\n- Dependencies: Update browserify-sign transitive dependency - [#24674](https://github.com/storybookjs/storybook/pull/24674), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!\n- Dependencies: Update nx dependencies to v17 - [#24671](https://github.com/storybookjs/storybook/pull/24671), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!\n- Maintenance: Split renderers preview entrypoints - [#24623](https://github.com/storybookjs/storybook/pull/24623), thanks [@ndelangen](https://github.com/ndelangen)!\n- Next.js: Add avif support - [#24611](https://github.com/storybookjs/storybook/pull/24611), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!\n- Next.js: Fix forwarding ref for Image component - [#24648](https://github.com/storybookjs/storybook/pull/24648), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!\n- Theming: Add theme variable to set the preview background color - [#24575](https://github.com/storybookjs/storybook/pull/24575), thanks [@JReinhold](https://github.com/JReinhold)!\n- UI: Fix button contrast-ratio - [#24525](https://github.com/storybookjs/storybook/pull/24525), thanks [@maheshchandra10](https://github.com/maheshchandra10)!\n- UI: Update zIndex on NotificationList to fix the notification not being clickable in certain cases - [#24602](https://github.com/storybookjs/storybook/pull/24602), thanks [@yoshi2no](https://github.com/yoshi2no)!"}}
{"version":"7.6.0-beta.2","info":{"plain":"- Actions: Fix `@storybook/core-events/preview-errors` dependency missing for Yarn PnP - [#24973](https://github.com/storybookjs/storybook/pull/24973), thanks [@JReinhold](https://github.com/JReinhold)!\n- Webpack5: Resolve circular dependency and fix HMR - [#24974](https://github.com/storybookjs/storybook/pull/24974), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!"}}
Loading