Skip to content

Commit ab9d761

Browse files
authored
Merge branch 'next' into patch-3
2 parents 55694d9 + 1633942 commit ab9d761

File tree

32 files changed

+629
-219
lines changed

32 files changed

+629
-219
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 8.2.6
2+
3+
- CPC: Fix missing exports for addon-kit - [#28691](https://github.com/storybookjs/storybook/pull/28691), thanks @ndelangen!
4+
15
## 8.2.5
26

37
- CPC: Add the globals export for manager - [#28650](https://github.com/storybookjs/storybook/pull/28650), thanks @ndelangen!

code/.storybook/main.ts

+70-9
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,78 @@ const managerApiPath = path.join(__dirname, '../core/src/manager-api');
88

99
const config: StorybookConfig = {
1010
stories: [
11+
{
12+
directory: '../core/template/stories',
13+
titlePrefix: 'core',
14+
},
1115
{
1216
directory: '../core/src/manager',
13-
titlePrefix: '@manager',
17+
titlePrefix: 'manager',
1418
},
1519
{
1620
directory: '../core/src/preview-api',
17-
titlePrefix: '@preview',
21+
titlePrefix: 'preview',
22+
},
23+
{
24+
directory: '../core/src/components/brand',
25+
titlePrefix: 'brand',
1826
},
1927
{
20-
directory: '../core/src/components',
21-
titlePrefix: '@components',
28+
directory: '../core/src/components/components',
29+
titlePrefix: 'components',
2230
},
2331
{
2432
directory: '../lib/blocks/src',
25-
titlePrefix: '@blocks',
33+
titlePrefix: 'blocks',
34+
},
35+
{
36+
directory: '../addons/a11y/template/stories',
37+
titlePrefix: 'addons/a11y',
38+
},
39+
{
40+
directory: '../addons/actions/template/stories',
41+
titlePrefix: 'addons/actions',
42+
},
43+
{
44+
directory: '../addons/backgrounds/template/stories',
45+
titlePrefix: 'addons/backgrounds',
2646
},
2747
{
2848
directory: '../addons/controls/src',
29-
titlePrefix: '@addons/controls',
49+
titlePrefix: 'addons/controls',
50+
},
51+
{
52+
directory: '../addons/controls/template/stories',
53+
titlePrefix: 'addons/controls',
54+
},
55+
{
56+
directory: '../addons/docs/template/stories',
57+
titlePrefix: 'addons/docs',
58+
},
59+
{
60+
directory: '../addons/links/template/stories',
61+
titlePrefix: 'addons/links',
62+
},
63+
{
64+
directory: '../addons/viewport/template/stories',
65+
titlePrefix: 'addons/viewport',
66+
},
67+
{
68+
directory: '../addons/toolbars/template/stories',
69+
titlePrefix: 'addons/toolbars',
3070
},
3171
{
3272
directory: '../addons/onboarding/src',
33-
titlePrefix: '@addons/onboarding',
73+
titlePrefix: 'addons/onboarding',
3474
},
3575
{
3676
directory: '../addons/interactions/src',
37-
titlePrefix: '@addons/interactions',
77+
titlePrefix: 'addons/interactions',
3878
},
79+
// {
80+
// directory: '../addons/interactions/template/stories',
81+
// titlePrefix: 'addons/interactions',
82+
// },
3983
],
4084
addons: [
4185
'@storybook/addon-links',
@@ -46,6 +90,11 @@ const config: StorybookConfig = {
4690
'@storybook/addon-a11y',
4791
'@chromatic-com/storybook',
4892
],
93+
previewAnnotations: [
94+
'./core/template/stories/preview.ts',
95+
'./addons/toolbars/template/stories/preview.ts',
96+
'./renderers/react/template/components/index.js',
97+
],
4998
build: {
5099
test: {
51100
// we have stories for the blocks here, we can't exclude them
@@ -58,9 +107,21 @@ const config: StorybookConfig = {
58107
name: '@storybook/react-vite',
59108
options: {},
60109
},
110+
refs: {
111+
icons: {
112+
title: 'Icons',
113+
url: 'https://main--64b56e737c0aeefed9d5e675.chromatic.com',
114+
expanded: false,
115+
},
116+
},
61117
core: {
62118
disableTelemetry: true,
63119
},
120+
features: {
121+
viewportStoryGlobals: true,
122+
themesStoryGlobals: true,
123+
backgroundsStoryGlobals: true,
124+
},
64125
viteFinal: (viteConfig, { configType }) =>
65126
mergeConfig(viteConfig, {
66127
resolve: {
@@ -81,7 +142,7 @@ const config: StorybookConfig = {
81142
sourcemap: process.env.CI !== 'true',
82143
},
83144
}),
84-
logLevel: 'debug',
145+
// logLevel: 'debug',
85146
};
86147

87148
export default config;

code/.storybook/preview.tsx

-17
Original file line numberDiff line numberDiff line change
@@ -296,20 +296,3 @@ export const parameters = {
296296
],
297297
},
298298
};
299-
300-
export const globalTypes = {
301-
theme: {
302-
name: 'Theme',
303-
description: 'Global theme for components',
304-
toolbar: {
305-
icon: 'circlehollow',
306-
title: 'Theme',
307-
items: [
308-
{ value: 'light', icon: 'circlehollow', title: 'light' },
309-
{ value: 'dark', icon: 'circle', title: 'dark' },
310-
{ value: 'side-by-side', icon: 'sidebar', title: 'side by side' },
311-
{ value: 'stacked', icon: 'bottombar', title: 'stacked' },
312-
],
313-
},
314-
},
315-
};

code/addons/docs/docs/recipes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ The Storybook UI is a workshop for developing components in isolation. Storybook
184184
To address this, we’ve added a CLI flag to only export the docs. This flag is also available in dev mode:
185185

186186
```sh
187-
yarn build-storybook --docs
187+
yarn storybook build --docs
188188
```
189189

190190
## Disabling docs stories

code/addons/links/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts"
6868
},
6969
"dependencies": {
70-
"@storybook/csf": "0.1.11",
70+
"@storybook/csf": "^0.1.11",
7171
"@storybook/global": "^5.0.0",
7272
"ts-dedent": "^2.0.0"
7373
},

code/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
"prep": "bun ./scripts/prep.ts"
254254
},
255255
"dependencies": {
256-
"@storybook/csf": "0.1.11",
256+
"@storybook/csf": "^0.1.11",
257257
"@types/express": "^4.17.21",
258258
"@types/node": "^18.0.0",
259259
"browser-assert": "^1.2.1",

code/core/src/common/js-package-manager/JsPackageManager.ts

+2-16
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,6 @@ export abstract class JsPackageManager {
6464
return packageJSON ? packageJSON.version ?? null : null;
6565
}
6666

67-
// NOTE: for some reason yarn prefers the npm registry in
68-
// local development, so always use npm
69-
async setRegistryURL(url: string) {
70-
if (url) {
71-
await this.executeCommand({ command: 'npm', args: ['config', 'set', 'registry', url] });
72-
} else {
73-
await this.executeCommand({ command: 'npm', args: ['config', 'delete', 'registry'] });
74-
}
75-
}
76-
77-
async getRegistryURL() {
78-
const res = await this.executeCommand({ command: 'npm', args: ['config', 'get', 'registry'] });
79-
const url = res.trim();
80-
return url === 'undefined' ? undefined : url;
81-
}
82-
8367
constructor(options?: JsPackageManagerOptions) {
8468
this.cwd = options?.cwd || process.cwd();
8569
}
@@ -487,6 +471,8 @@ export abstract class JsPackageManager {
487471
): // Use generic and conditional type to force `string[]` if fetchAllVersions is true and `string` if false
488472
Promise<T extends true ? string[] : string>;
489473

474+
public abstract getRegistryURL(): Promise<string | undefined>;
475+
490476
public abstract runPackageCommand(
491477
command: string,
492478
args: string[],

code/core/src/common/js-package-manager/NPMProxy.test.ts

-15
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,6 @@ describe('NPM Proxy', () => {
3434
});
3535
});
3636

37-
describe('setRegistryUrl', () => {
38-
it('should run `npm config set registry https://foo.bar`', async () => {
39-
const executeCommandSpy = vi.spyOn(npmProxy, 'executeCommand').mockResolvedValueOnce('');
40-
41-
await npmProxy.setRegistryURL('https://foo.bar');
42-
43-
expect(executeCommandSpy).toHaveBeenCalledWith(
44-
expect.objectContaining({
45-
command: 'npm',
46-
args: ['config', 'set', 'registry', 'https://foo.bar'],
47-
})
48-
);
49-
});
50-
});
51-
5237
describe('installDependencies', () => {
5338
describe('npm6', () => {
5439
it('should run `npm install`', async () => {

code/core/src/common/js-package-manager/NPMProxy.ts

+11
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,17 @@ export class NPMProxy extends JsPackageManager {
181181
});
182182
}
183183

184+
public async getRegistryURL() {
185+
const res = await this.executeCommand({
186+
command: 'npm',
187+
// "npm config" commands are not allowed in workspaces per default
188+
// https://github.com/npm/cli/issues/6099#issuecomment-1847584792
189+
args: ['config', 'get', 'registry', '-ws=false', '-iwr'],
190+
});
191+
const url = res.trim();
192+
return url === 'undefined' ? undefined : url;
193+
}
194+
184195
protected async runAddDeps(dependencies: string[], installAsDevDependencies: boolean) {
185196
const { logStream, readLogFile, moveLogFile, removeLogFile } = await createLogStream();
186197
let args = [...dependencies];

code/core/src/common/js-package-manager/PNPMProxy.test.ts

-15
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,6 @@ describe('PNPM Proxy', () => {
2424
});
2525
});
2626

27-
describe('setRegistryUrl', () => {
28-
it('should run `npm config set registry https://foo.bar`', async () => {
29-
const executeCommandSpy = vi.spyOn(pnpmProxy, 'executeCommand').mockResolvedValueOnce('');
30-
31-
await pnpmProxy.setRegistryURL('https://foo.bar');
32-
33-
expect(executeCommandSpy).toHaveBeenCalledWith(
34-
expect.objectContaining({
35-
command: 'npm',
36-
args: ['config', 'set', 'registry', 'https://foo.bar'],
37-
})
38-
);
39-
});
40-
});
41-
4227
describe('installDependencies', () => {
4328
it('should run `pnpm install`', async () => {
4429
const executeCommandSpy = vi

code/core/src/common/js-package-manager/PNPMProxy.ts

+9
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ export class PNPMProxy extends JsPackageManager {
9090
});
9191
}
9292

93+
public async getRegistryURL() {
94+
const res = await this.executeCommand({
95+
command: 'pnpm',
96+
args: ['config', 'get', 'registry'],
97+
});
98+
const url = res.trim();
99+
return url === 'undefined' ? undefined : url;
100+
}
101+
93102
async runPackageCommand(command: string, args: string[], cwd?: string): Promise<string> {
94103
return this.executeCommand({
95104
command: 'pnpm',

code/core/src/common/js-package-manager/Yarn1Proxy.test.ts

-15
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ describe('Yarn 1 Proxy', () => {
2525
});
2626
});
2727

28-
describe('setRegistryUrl', () => {
29-
it('should run `yarn config set npmRegistryServer https://foo.bar`', async () => {
30-
const executeCommandSpy = vi.spyOn(yarn1Proxy, 'executeCommand').mockResolvedValueOnce('');
31-
32-
await yarn1Proxy.setRegistryURL('https://foo.bar');
33-
34-
expect(executeCommandSpy).toHaveBeenCalledWith(
35-
expect.objectContaining({
36-
command: 'npm',
37-
args: ['config', 'set', 'registry', 'https://foo.bar'],
38-
})
39-
);
40-
});
41-
});
42-
4328
describe('installDependencies', () => {
4429
it('should run `yarn`', async () => {
4530
const executeCommandSpy = vi.spyOn(yarn1Proxy, 'executeCommand').mockResolvedValueOnce('');

code/core/src/common/js-package-manager/Yarn1Proxy.ts

+9
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ export class Yarn1Proxy extends JsPackageManager {
8383
return JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as Record<string, any>;
8484
}
8585

86+
public async getRegistryURL() {
87+
const res = await this.executeCommand({
88+
command: 'yarn',
89+
args: ['config', 'get', 'registry'],
90+
});
91+
const url = res.trim();
92+
return url === 'undefined' ? undefined : url;
93+
}
94+
8695
public async findInstallations(pattern: string[], { depth = 99 }: { depth?: number } = {}) {
8796
const yarnArgs = ['list', '--pattern', pattern.map((p) => `"${p}"`).join(' '), '--json'];
8897

code/core/src/common/js-package-manager/Yarn2Proxy.test.ts

-15
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,6 @@ describe('Yarn 2 Proxy', () => {
5353
});
5454
});
5555

56-
describe('setRegistryUrl', () => {
57-
it('should run `yarn config set npmRegistryServer https://foo.bar`', async () => {
58-
const executeCommandSpy = vi.spyOn(yarn2Proxy, 'executeCommand').mockResolvedValueOnce('');
59-
60-
await yarn2Proxy.setRegistryURL('https://foo.bar');
61-
62-
expect(executeCommandSpy).toHaveBeenCalledWith(
63-
expect.objectContaining({
64-
command: 'npm',
65-
args: ['config', 'set', 'registry', 'https://foo.bar'],
66-
})
67-
);
68-
});
69-
});
70-
7156
describe('addDependencies', () => {
7257
it('with devDep it should run `yarn install -D @storybook/core`', async () => {
7358
const executeCommandSpy = vi.spyOn(yarn2Proxy, 'executeCommand').mockResolvedValueOnce('');

code/core/src/common/js-package-manager/Yarn2Proxy.ts

+9
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ export class Yarn2Proxy extends JsPackageManager {
239239
await removeLogFile();
240240
}
241241

242+
public async getRegistryURL() {
243+
const res = await this.executeCommand({
244+
command: 'yarn',
245+
args: ['config', 'get', 'npmRegistryServer'],
246+
});
247+
const url = res.trim();
248+
return url === 'undefined' ? undefined : url;
249+
}
250+
242251
protected async runRemoveDeps(dependencies: string[]) {
243252
const args = [...dependencies];
244253

code/core/src/core-server/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ It contains:
66

77
- CLI arg parsing
88
- Storybook UI "manager" webpack configuration
9-
- `start-storybook` dev server
10-
- `build-storybook` static builder
9+
- `storybook dev` dev server
10+
- `storybook build` static builder
1111
- presets handling
1212

1313
The "preview" (aka iframe) side is implemented in pluggable builders:

0 commit comments

Comments
 (0)