fix(angular): generate storybook configuration with proper linter (#3580)
This commit is contained in:
parent
8d835ad1d6
commit
d796731c97
@ -42,6 +42,16 @@ Type: `boolean`
|
||||
|
||||
Automatically generate \*.stories.ts files for components declared in this library
|
||||
|
||||
### linter
|
||||
|
||||
Default: `tslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
### name
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -42,6 +42,16 @@ Type: `boolean`
|
||||
|
||||
Automatically generate \*.stories.ts files for components declared in this library
|
||||
|
||||
### linter
|
||||
|
||||
Default: `tslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
### name
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`schematic:configuration should generate the right files 1`] = `
|
||||
Array [
|
||||
"/workspace.json",
|
||||
"/package.json",
|
||||
"/nx.json",
|
||||
"/tsconfig.base.json",
|
||||
"/tslint.json",
|
||||
"/jest.config.js",
|
||||
"/libs/test-ui-lib/README.md",
|
||||
"/libs/test-ui-lib/tsconfig.lib.json",
|
||||
"/libs/test-ui-lib/tslint.json",
|
||||
"/libs/test-ui-lib/tsconfig.json",
|
||||
"/libs/test-ui-lib/jest.config.js",
|
||||
"/libs/test-ui-lib/tsconfig.spec.json",
|
||||
"/libs/test-ui-lib/src/index.ts",
|
||||
"/libs/test-ui-lib/src/test-setup.ts",
|
||||
"/libs/test-ui-lib/src/lib/test-ui-lib.module.ts",
|
||||
"/libs/test-ui-lib/src/lib/test-button/test-button.component.css",
|
||||
"/libs/test-ui-lib/src/lib/test-button/test-button.component.html",
|
||||
"/libs/test-ui-lib/src/lib/test-button/test-button.component.spec.ts",
|
||||
"/libs/test-ui-lib/src/lib/test-button/test-button.component.ts",
|
||||
"/libs/test-ui-lib/src/lib/test-button/test-button.component.stories.ts",
|
||||
"/libs/test-ui-lib/src/lib/nested/nested.module.ts",
|
||||
"/libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.css",
|
||||
"/libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.html",
|
||||
"/libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.spec.ts",
|
||||
"/libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.ts",
|
||||
"/libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.stories.ts",
|
||||
"/libs/test-ui-lib/src/lib/test-other/test-other.component.css",
|
||||
"/libs/test-ui-lib/src/lib/test-other/test-other.component.html",
|
||||
"/libs/test-ui-lib/src/lib/test-other/test-other.component.spec.ts",
|
||||
"/libs/test-ui-lib/src/lib/test-other/test-other.component.ts",
|
||||
"/libs/test-ui-lib/src/lib/test-other/test-other.component.stories.ts",
|
||||
"/libs/test-ui-lib/.storybook/tsconfig.json",
|
||||
"/libs/test-ui-lib/.storybook/addons.js",
|
||||
"/libs/test-ui-lib/.storybook/config.js",
|
||||
"/libs/test-ui-lib/.storybook/webpack.config.js",
|
||||
"/.storybook/addons.js",
|
||||
"/.storybook/tsconfig.json",
|
||||
"/.storybook/webpack.config.js",
|
||||
"/apps/test-ui-lib-e2e/tslint.json",
|
||||
"/apps/test-ui-lib-e2e/cypress.json",
|
||||
"/apps/test-ui-lib-e2e/tsconfig.e2e.json",
|
||||
"/apps/test-ui-lib-e2e/tsconfig.json",
|
||||
"/apps/test-ui-lib-e2e/src/fixtures/example.json",
|
||||
"/apps/test-ui-lib-e2e/src/plugins/index.js",
|
||||
"/apps/test-ui-lib-e2e/src/support/commands.ts",
|
||||
"/apps/test-ui-lib-e2e/src/support/index.ts",
|
||||
"/apps/test-ui-lib-e2e/src/integration/test-button/test-button.component.spec.ts",
|
||||
"/apps/test-ui-lib-e2e/src/integration/test-other/test-other.component.spec.ts",
|
||||
"/apps/test-ui-lib-e2e/src/integration/nested-button/nested-button.component.spec.ts",
|
||||
]
|
||||
`;
|
||||
@ -87,4 +87,18 @@ describe('schematic:configuration', () => {
|
||||
)
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should generate the right files', async () => {
|
||||
const tree = await runSchematic(
|
||||
'storybook-configuration',
|
||||
<StorybookConfigureSchema>{
|
||||
name: 'test-ui-lib',
|
||||
configureCypress: true,
|
||||
generateCypressSpecs: true,
|
||||
generateStories: true,
|
||||
},
|
||||
appTree
|
||||
);
|
||||
expect(tree.files).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@ -20,6 +20,7 @@ export default function (schema: StorybookConfigureSchema): Rule {
|
||||
name: schema.name,
|
||||
uiFramework: '@storybook/angular',
|
||||
configureCypress: schema.configureCypress,
|
||||
linter: schema.linter,
|
||||
}),
|
||||
schema.generateStories ? generateStories(schema) : noop(),
|
||||
]);
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import { Linter } from '@nrwl/workspace';
|
||||
|
||||
export interface StorybookConfigureSchema {
|
||||
name: string;
|
||||
configureCypress: boolean;
|
||||
generateStories: boolean;
|
||||
generateCypressSpecs: boolean;
|
||||
linter: Linter;
|
||||
}
|
||||
|
||||
@ -25,6 +25,12 @@
|
||||
"type": "boolean",
|
||||
"description": "Automatically generate *.spec.ts files in the cypress e2e app generated by the cypress-configure schematic",
|
||||
"x-prompt": "Automatically generate *.spec.ts files in the cypress e2e app generated by the cypress-configure schematic?"
|
||||
},
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"default": "tslint"
|
||||
}
|
||||
},
|
||||
"required": ["name"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user