Skip to content

Commit

Permalink
feat(storybook): keeping only things that are needed
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Mar 28, 2022
1 parent f5dc2ff commit 53a3df9
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 301 deletions.
20 changes: 0 additions & 20 deletions docs/generated/packages/react.json
Original file line number Diff line number Diff line change
Expand Up @@ -634,26 +634,6 @@
"aliases": [],
"path": "/packages/react/src/generators/storybook-configuration/schema.json"
},
{
"name": "storybook-migrate-defaults-5-to-6",
"factory": "./src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6#storybookMigration5to6Generator",
"schema": {
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"$id": "storybook-migrate-defaults-5-to-6",
"title": "Storybook migrate defaults 5 to 6",
"description": "Generate default Storybook configuration files using Storybook version `>=6.x` specs, for projects that already have Storybook instances and configurations of versions `<6.x`.",
"type": "object",
"properties": {},
"required": [],
"presets": []
},
"description": "Generate default Storybook configuration files using Storybook version `>=6.x` specs, for projects that already have Storybook instances and configurations of versions `<6.x`.",
"hidden": false,
"implementation": "/packages/react/src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6#storybookMigration5to6Generator.ts",
"aliases": [],
"path": "/packages/react/src/generators/storybook-migrate-defaults-5-to-6/schema.json"
},
{
"name": "component-story",
"factory": "./src/generators/component-story/component-story#componentStoryGenerator",
Expand Down
1 change: 0 additions & 1 deletion docs/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@
"component",
"redux",
"storybook-configuration",
"storybook-migrate-defaults-5-to-6",
"component-story",
"stories",
"component-cypress-spec",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions packages/react/generators.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@
"hidden": false
},

"storybook-migrate-defaults-5-to-6": {
"factory": "./src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6#storybookMigration5to6Generator",
"schema": "./src/generators/storybook-migrate-defaults-5-to-6/schema.json",
"description": "Generate default Storybook configuration files using Storybook version `>=6.x` specs, for projects that already have Storybook instances and configurations of versions `<6.x`.",
"hidden": false
},

"component-story": {
"factory": "./src/generators/component-story/component-story#componentStoryGenerator",
"schema": "./src/generators/component-story/schema.json",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions packages/storybook/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export { configurationGenerator } from './src/generators/configuration/configuration';
export { cypressProjectGenerator } from './src/generators/cypress-project/cypress-project';
export { migrateDefaultsGenerator } from './src/generators/migrate-defaults-5-to-6/migrate-defaults-5-to-6';
export { migrateStoriesTo62Generator } from './src/generators/migrate-stories-to-6-2/migrate-stories-to-6-2';
export { storybookVersion } from './src/utils/versions';
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ function configureTsSolutionConfig(
const tsConfigContent = readJson<TsConfig>(tree, tsConfigPath);

if (
!tsConfigContent.references
.map((reference) => reference.path)
!tsConfigContent?.references
?.map((reference) => reference.path)
.includes('./.storybook/tsconfig.json')
) {
tsConfigContent.references = [
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { readJson, Tree, updateJson } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { storybookVersion } from '../../../utils/versions';
import configurationGenerator from '../../../generators/configuration/configuration';
import {
deleteNewConfigurationAndCreateNew,
createTestUILibNoNgDevkit,
} from '../../utils/testing';
import { storybookVersion } from '../../utils/versions';
import configurationGenerator from '../configuration/configuration';
deleteNewConfigurationAndCreateNew,
} from '../../../utils/testing';
import { migrateDefaultsGenerator } from './migrate-defaults-5-to-6';

describe('migrate-defaults-5-to-6 Generator', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
convertNxGenerator,
generateFiles,
GeneratorCallback,
getProjects,
Expand All @@ -12,7 +11,7 @@ import {
offsetFromRoot,
} from '@nrwl/devkit';
import { lte } from 'semver';
import { storybookVersion } from '../../utils/versions';
import { storybookVersion } from '../../../utils/versions';
import { join } from 'path';
import { checkAndCleanWithSemver } from '@nrwl/workspace/src/utilities/version-utils';
import { getRootTsConfigPathInTree } from '@nrwl/workspace/src/utilities/typescript';
Expand Down Expand Up @@ -168,7 +167,10 @@ function migrateProjectLevelStorybookInstance(
}
generateFiles(
tree,
join(__dirname, '../configuration/project-files/.storybook'),
join(
__dirname,
'../../../generators/configuration/project-files/.storybook'
),
configFolder,
{
tmpl: '',
Expand All @@ -194,7 +196,7 @@ function migrateRootLevelStorybookInstance(tree: Tree) {

generateFiles(
tree,
join(__dirname, '../configuration/root-files/.storybook'),
join(__dirname, '../../../generators/configuration/root-files/.storybook'),
'.storybook',
{ rootTsConfigPath: getRootTsConfigPathInTree(tree) }
);
Expand All @@ -205,8 +207,3 @@ export function moveDirectory(tree: Tree, from: string, to: string) {
tree.rename(file, file.replace(from, to));
});
}

export default migrateDefaultsGenerator;
export const migrateDefaultsSchematic = convertNxGenerator(
migrateDefaultsGenerator
);
Loading

0 comments on commit 53a3df9

Please sign in to comment.