diff --git a/tools/workspace-plugin/src/generators/react-library/index.spec.ts b/tools/workspace-plugin/src/generators/react-library/index.spec.ts index eb189c4eb82c94..90804d5f23fbe7 100644 --- a/tools/workspace-plugin/src/generators/react-library/index.spec.ts +++ b/tools/workspace-plugin/src/generators/react-library/index.spec.ts @@ -221,6 +221,26 @@ describe('react-library generator', () => { " `); + expect(readJson(tree, `${stories.root}/.eslintrc.json`)).toMatchInlineSnapshot(` + Object { + "extends": Array [ + "plugin:@fluentui/eslint-plugin/react", + ], + "root": true, + "rules": Object { + "import/no-extraneous-dependencies": Array [ + "error", + Object { + "packageDir": Array [ + ".", + "../../../../", + ], + }, + ], + }, + } + `); + // global updates const expectedPathAlias = { @@ -246,9 +266,12 @@ describe('react-library generator', () => { setup(tree); await generator(tree, { name: 'react-one', owner: '@org/chosen-one', kind: 'compat' }); - const config = readProjectConfiguration(tree, '@proj/react-one-compat'); + const library = readProjectConfiguration(tree, '@proj/react-one-compat'); + const stories = readProjectConfiguration(tree, '@proj/react-one-compat-stories'); - expect(tree.children(config.root)).toMatchInlineSnapshot(` + // library + + expect(tree.children(library.root)).toMatchInlineSnapshot(` Array [ "project.json", ".babelrc.json", @@ -268,13 +291,37 @@ describe('react-library generator', () => { "tsconfig.spec.json", ] `); - expect(config).toEqual( + expect(library).toEqual( expect.objectContaining({ root: 'packages/react-components/react-one-compat/library', sourceRoot: 'packages/react-components/react-one-compat/library/src', tags: ['platform:web', 'vNext', 'compat'], }), ); + + // stories + + expect(tree.children(stories.root)).toMatchInlineSnapshot(` + Array [ + "src", + ".storybook", + "README.md", + "just.config.ts", + ".eslintrc.json", + "tsconfig.json", + "tsconfig.lib.json", + "package.json", + "project.json", + ] + `); + + expect(stories).toEqual( + expect.objectContaining({ + root: 'packages/react-components/react-one-compat/stories', + sourceRoot: 'packages/react-components/react-one-compat/stories/src', + tags: ['vNext', 'platform:web', 'compat', 'type:stories'], + }), + ); }); }); diff --git a/tools/workspace-plugin/src/generators/split-library-in-two/generator.ts b/tools/workspace-plugin/src/generators/split-library-in-two/generator.ts index 89737bb228c65a..9eb530b6c80cde 100644 --- a/tools/workspace-plugin/src/generators/split-library-in-two/generator.ts +++ b/tools/workspace-plugin/src/generators/split-library-in-two/generator.ts @@ -388,7 +388,12 @@ function makeStoriesLibrary(tree: Tree, options: Options, logger: typeof output) root: newProjectRoot, sourceRoot: newProjectSourceRoot, name: `${options.projectConfig.name}-stories`, - tags: ['vNext', 'platform:web', 'type:stories'], + tags: [ + 'vNext', + 'platform:web', + options.projectConfig.tags?.includes('compat') ? 'compat' : null, + 'type:stories', + ].filter(Boolean) as string[], }); updateJson(tree, '/tsconfig.base.json', (json: TsConfig) => {