Skip to content

Commit d047927

Browse files
authored
fix: add prefix to packages story titles (#252)
1 parent 5f2bc3a commit d047927

File tree

5 files changed

+37
-12
lines changed

5 files changed

+37
-12
lines changed

apps/docsite/project.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"options": {
1414
"port": 4400,
1515
"configDir": "apps/docsite/.storybook",
16-
"docs": true,
1716
"docsMode": true
1817
},
1918
"configurations": {
@@ -28,7 +27,6 @@
2827
"options": {
2928
"outputDir": "dist/storybook/docsite",
3029
"configDir": "apps/docsite/.storybook",
31-
"docs": true,
3230
"docsMode": true
3331
},
3432
"configurations": {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "fix: make stories title consistent with other packages",
4+
"packageName": "@fluentui-contrib/react-keytips",
5+
"email": "[email protected]",
6+
"dependentChangeType": "none"
7+
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Meta } from '@storybook/react';
1+
import type { Meta } from '@storybook/react';
22
import { <%= componentName %> } from '<%= npmScope %>/<%= name %>';
33
export { Default } from './Default.stories';
44

5-
const meta: Meta<typeof <%= componentName %>> = {
5+
const meta = {
6+
title: 'Packages/<%= name %>/<%= componentName %>',
67
component: <%= componentName %>,
7-
};
8+
} satisfies Meta<typeof <%= componentName %>>;
89

910
export default meta;

packages/nx-plugin/src/generators/component/generator.spec.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('component generator', () => {
1414
let tree: Tree;
1515
const options: ComponentGeneratorSchema = {
1616
name: 'hello-world',
17-
componentName: 'foo',
17+
componentName: 'Foo',
1818
};
1919

2020
beforeEach(async () => {
@@ -30,23 +30,42 @@ describe('component generator', () => {
3030

3131
expect(
3232
tree.children(
33-
joinPathFragments(config.sourceRoot as string, 'components/foo')
33+
joinPathFragments(config.sourceRoot as string, 'components/Foo')
3434
)
3535
).toMatchInlineSnapshot(`
3636
[
37-
"foo.styles.ts",
38-
"foo.test.tsx",
39-
"foo.tsx",
37+
"Foo.styles.ts",
38+
"Foo.test.tsx",
39+
"Foo.tsx",
4040
"index.ts",
4141
]
4242
`);
4343

44-
expect(tree.children(joinPathFragments(config.root, 'stories/foo')))
44+
expect(tree.children(joinPathFragments(config.root, 'stories/Foo')))
4545
.toMatchInlineSnapshot(`
4646
[
4747
"Default.stories.tsx",
4848
"index.stories.tsx",
4949
]
5050
`);
51+
52+
const story = tree.read(
53+
joinPathFragments(config.root, 'stories/Foo/index.stories.tsx'),
54+
'utf8'
55+
);
56+
57+
expect(story).toMatchInlineSnapshot(`
58+
"import type { Meta } from '@storybook/react';
59+
import { Foo } from '@fluentui-contrib/hello-world';
60+
export { Default } from './Default.stories';
61+
62+
const meta = {
63+
title: 'Packages/hello-world/Foo',
64+
component: Foo,
65+
} satisfies Meta<typeof Foo>;
66+
67+
export default meta;
68+
"
69+
`);
5170
});
5271
});

packages/react-keytips/stories/index.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export { DynamicStory as Dynamic } from './Dynamic.stories';
66
export { OverflowStory as Overflow } from './OverflowMenu.stories';
77

88
const meta = {
9-
title: 'Keytips',
9+
title: 'Packages/react-keytips',
1010
component: Keytips,
1111
} satisfies Meta<typeof Keytips>;
1212

0 commit comments

Comments
 (0)