chore(storybook): remove old change-storybook-targets generator (#15126)

This commit is contained in:
Katerina Skroumpelou 2023-02-20 18:43:54 +02:00 committed by GitHub
parent 929bece2fb
commit b934edc3dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 23 additions and 178 deletions

View File

@ -3874,14 +3874,6 @@
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "change-storybook-targets",
"path": "/packages/angular/generators/change-storybook-targets",
"name": "change-storybook-targets",
"children": [],
"isExternal": false,
"disableCollapsible": false
}
],
"isExternal": false,
@ -6085,14 +6077,6 @@
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "change-storybook-targets",
"path": "/packages/storybook/generators/change-storybook-targets",
"name": "change-storybook-targets",
"children": [],
"isExternal": false,
"disableCollapsible": false
}
],
"isExternal": false,

View File

@ -404,15 +404,6 @@
"originalFilePath": "/packages/angular/src/generators/web-worker/schema.json",
"path": "/packages/angular/generators/web-worker",
"type": "generator"
},
"/packages/angular/generators/change-storybook-targets": {
"description": "Change storybook targets for Angular projects to use @storybook/angular executors",
"file": "generated/packages/angular/generators/change-storybook-targets.json",
"hidden": false,
"name": "change-storybook-targets",
"originalFilePath": "/packages/angular/src/generators/change-storybook-targets/schema.json",
"path": "/packages/angular/generators/change-storybook-targets",
"type": "generator"
}
},
"path": "/packages/angular"
@ -2625,15 +2616,6 @@
"originalFilePath": "/packages/storybook/src/generators/cypress-project/schema.json",
"path": "/packages/storybook/generators/cypress-project",
"type": "generator"
},
"/packages/storybook/generators/change-storybook-targets": {
"description": "Change storybook targets for Angular projects to use @storybook/angular executors",
"file": "generated/packages/storybook/generators/change-storybook-targets.json",
"hidden": false,
"name": "change-storybook-targets",
"originalFilePath": "/packages/storybook/src/generators/change-storybook-targets/schema.json",
"path": "/packages/storybook/generators/change-storybook-targets",
"type": "generator"
}
},
"path": "/packages/storybook"

View File

@ -398,15 +398,6 @@
"originalFilePath": "/packages/angular/src/generators/web-worker/schema.json",
"path": "angular/generators/web-worker",
"type": "generator"
},
{
"description": "Change storybook targets for Angular projects to use @storybook/angular executors",
"file": "generated/packages/angular/generators/change-storybook-targets.json",
"hidden": false,
"name": "change-storybook-targets",
"originalFilePath": "/packages/angular/src/generators/change-storybook-targets/schema.json",
"path": "angular/generators/change-storybook-targets",
"type": "generator"
}
],
"githubRoot": "https://github.com/nrwl/nx/blob/master",
@ -2596,15 +2587,6 @@
"originalFilePath": "/packages/storybook/src/generators/cypress-project/schema.json",
"path": "storybook/generators/cypress-project",
"type": "generator"
},
{
"description": "Change storybook targets for Angular projects to use @storybook/angular executors",
"file": "generated/packages/storybook/generators/change-storybook-targets.json",
"hidden": false,
"name": "change-storybook-targets",
"originalFilePath": "/packages/storybook/src/generators/change-storybook-targets/schema.json",
"path": "storybook/generators/change-storybook-targets",
"type": "generator"
}
],
"githubRoot": "https://github.com/nrwl/nx/blob/master",

View File

@ -141,9 +141,7 @@ Make sure you are on Nx version `>=14.1.8` and your `storybook` target is using
If you are using an older version of Nx, you can use [`nx migrate`](/packages/nx/documents/migrate) to migrate your codebase to a later version. Using `nx migrate` will also make sure to update your `storybook` and `build-storybook` targets to match the new format.
If you **are** on Nx `>=14.1.8` and you are still using the old executor (`@nrwl/storybook:storybook`), you can use the [`change-storybook-targets` generator](/packages/storybook/generators/change-storybook-targets) which will take care of changing your `storybook` and `build-storybook` targets across your workspace for your Angular projects using Storybook.
You can read more about the `storybook` and `build-storybook` targets for Angular projects in the [Information about the `storybook` targets](/packages/storybook/documents/angular-storybook-targets) page.
If you **are** on Nx `>=14.1.8` and you are still using the old executor (`@nrwl/storybook:storybook`), you can read our documentation about the [Angular Storybook targets](/packages/storybook/documents/angular-storybook-targets) to help you change your `storybook` and `build-storybook` targets across your workspace for your Angular projects using Storybook.
{% /callout %}
### 4. Let Storybook know of the `documentation.json` file

View File

@ -17,4 +17,12 @@ That means that you can use the official [Storybook for Angular documentation (e
If you are on Nx version `<14.1.8` and you want to move to the latest version (or any version `>=14.1.8`) you can use the `nx migrate` command, which will take care of migrating your Storybook targets across all your Angular projects using Storybook to use the new schema, the original Storybook executors for Angular. The configuration changes that you need to make will be handled automatically by Nx, so you will not have to do any manual work.
If you have already moved on a version of Nx `>=14.1.8` without using `nx migrate` and now you are having trouble with your Angular projects using Storybook (eg. `Property 'uiFramework' does not match the schema. '@storybook/angular' should be one of ...`), that means that your targets are still using the old schema and they should change. For that, you can use the [`change-storybook-targets` generator](/packages/storybook/generators/change-storybook-targets) which will take care of changing your `storybook` and `build-storybook` targets across your workspace for your Angular projects using Storybook.
If you have already moved on a version of Nx `>=14.1.8` without using `nx migrate` and now you are having trouble with your Angular projects using Storybook (eg. `Property 'uiFramework' does not match the schema. '@storybook/angular' should be one of ...`), that means that your targets are still using the old schema and they should change. The way to fix that is to call `nx migrate` again like this:
```bash
nx migrate @nrwl/storybook@14.1.0 --to="@nrwl/storybook@14.2.0"
```
and follow the instructions that will be printed in the console.
This command will generate a new `migrations.json` file which will contain the "change-storybook-targets" migration script. This script (when called with `yarn nx migrate --run-migrations`) will change the `storybook` and `build-storybook` targets in all your Angular projects that are configured to use Storybook. The new target configuration will use the native Storybook builders (`@storybook/angular:build-storybook` and `@storybook/angular:start-storybook`) instead of the Nx Storybook builders (`@nrwl/storybook:build-storybook` and `@nrwl/storybook:storybook`).

View File

@ -141,9 +141,7 @@ Make sure you are on Nx version `>=14.1.8` and your `storybook` target is using
If you are using an older version of Nx, you can use [`nx migrate`](/packages/nx/documents/migrate) to migrate your codebase to a later version. Using `nx migrate` will also make sure to update your `storybook` and `build-storybook` targets to match the new format.
If you **are** on Nx `>=14.1.8` and you are still using the old executor (`@nrwl/storybook:storybook`), you can use the [`change-storybook-targets` generator](/packages/storybook/generators/change-storybook-targets) which will take care of changing your `storybook` and `build-storybook` targets across your workspace for your Angular projects using Storybook.
You can read more about the `storybook` and `build-storybook` targets for Angular projects in the [Information about the `storybook` targets](/packages/storybook/documents/angular-storybook-targets) page.
If you **are** on Nx `>=14.1.8` and you are still using the old executor (`@nrwl/storybook:storybook`), you can read our documentation about the [Angular Storybook targets](/packages/storybook/documents/angular-storybook-targets) to help you change your `storybook` and `build-storybook` targets across your workspace for your Angular projects using Storybook.
{% /callout %}
### 4. Let Storybook know of the `documentation.json` file

View File

@ -17,4 +17,12 @@ That means that you can use the official [Storybook for Angular documentation (e
If you are on Nx version `<14.1.8` and you want to move to the latest version (or any version `>=14.1.8`) you can use the `nx migrate` command, which will take care of migrating your Storybook targets across all your Angular projects using Storybook to use the new schema, the original Storybook executors for Angular. The configuration changes that you need to make will be handled automatically by Nx, so you will not have to do any manual work.
If you have already moved on a version of Nx `>=14.1.8` without using `nx migrate` and now you are having trouble with your Angular projects using Storybook (eg. `Property 'uiFramework' does not match the schema. '@storybook/angular' should be one of ...`), that means that your targets are still using the old schema and they should change. For that, you can use the [`change-storybook-targets` generator](/packages/storybook/generators/change-storybook-targets) which will take care of changing your `storybook` and `build-storybook` targets across your workspace for your Angular projects using Storybook.
If you have already moved on a version of Nx `>=14.1.8` without using `nx migrate` and now you are having trouble with your Angular projects using Storybook (eg. `Property 'uiFramework' does not match the schema. '@storybook/angular' should be one of ...`), that means that your targets are still using the old schema and they should change. The way to fix that is to call `nx migrate` again like this:
```bash
nx migrate @nrwl/storybook@14.1.0 --to="@nrwl/storybook@14.2.0"
```
and follow the instructions that will be printed in the console.
This command will generate a new `migrations.json` file which will contain the "change-storybook-targets" migration script. This script (when called with `yarn nx migrate --run-migrations`) will change the `storybook` and `build-storybook` targets in all your Angular projects that are configured to use Storybook. The new target configuration will use the native Storybook builders (`@storybook/angular:build-storybook` and `@storybook/angular:start-storybook`) instead of the Nx Storybook builders (`@nrwl/storybook:build-storybook` and `@nrwl/storybook:storybook`).

View File

@ -1,11 +0,0 @@
This generator will change the `storybook` and `build-storybook` targets in all your Angular projects that are configured to use Storybook. The new target configuration will use the native Storybook builders (`@storybook/angular:build-storybook` and `@storybook/angular:start-storybook`) instead of the Nx Storybook builders (`@nrwl/storybook:build-storybook` and `@nrwl/storybook:storybook`).
This generator is usually invoked through a migrator, when you are using `nx migrate` to upgrade your workspace to Nx `14.1.8` or later.
If you are on Nx `14.1.8` or later and you did not use `nx migrate`, you can run this generator manually by running the following command:
```bash
nx g @nrwl/angular:change-storybook-targets
```
You can read more about how this generator works, and why we are changing the Storybook targets, in the [Angular Storybook targets documentation page](/packages/storybook/documents/angular-storybook-targets).

View File

@ -171,12 +171,6 @@
"factory": "./src/generators/web-worker/compat",
"schema": "./src/generators/web-worker/schema.json",
"description": "Creates a Web Worker."
},
"change-storybook-targets": {
"factory": "./src/generators/change-storybook-targets/compat",
"schema": "./src/generators/change-storybook-targets/schema.json",
"description": "Change storybook targets for Angular projects to use @storybook/angular executors",
"hidden": false
}
},
"generators": {
@ -348,11 +342,6 @@
"factory": "./src/generators/web-worker/web-worker",
"schema": "./src/generators/web-worker/schema.json",
"description": "Creates a Web Worker."
},
"change-storybook-targets": {
"factory": "./src/generators/change-storybook-targets/change-storybook-targets",
"schema": "./src/generators/change-storybook-targets/schema.json",
"description": "Change storybook targets for Angular projects to use @storybook/angular executors"
}
}
}

View File

@ -1,6 +1,5 @@
export * from './src/generators/add-linting/add-linting';
export * from './src/generators/application/application';
export * from './src/generators/change-storybook-targets/change-storybook-targets';
export * from './src/generators/component-cypress-spec/component-cypress-spec';
export * from './src/generators/component-story/component-story';
export * from './src/generators/component/component';

View File

@ -1,20 +0,0 @@
import type { Tree } from '@nrwl/devkit';
import { ensurePackage, formatFiles } from '@nrwl/devkit';
import { nxVersion } from '../../utils/versions';
import type { Schema } from './schema';
export async function angularChangeStorybookTargestGenerator(
tree: Tree,
schema: Schema
) {
ensurePackage(tree, '@nrwl/storybook', nxVersion);
const { changeStorybookTargetsGenerator } = await import('@nrwl/storybook');
await changeStorybookTargetsGenerator(tree);
if (!schema.skipFormat) {
await formatFiles(tree);
}
}
export default angularChangeStorybookTargestGenerator;

View File

@ -1,4 +0,0 @@
import { convertNxGenerator } from '@nrwl/devkit';
import angularChangeStorybookTargestGenerator from './change-storybook-targets';
export default convertNxGenerator(angularChangeStorybookTargestGenerator);

View File

@ -1,3 +0,0 @@
export interface Schema {
skipFormat?: boolean;
}

View File

@ -1,19 +0,0 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "NxAngularChangeStorybookTargetsGenerator",
"title": "Change Storybook targets",
"description": "Change the Storybook target executors.",
"type": "object",
"cli": "nx",
"properties": {
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false,
"x-priority": "internal"
}
},
"additionalProperties": false,
"required": [],
"examplesFile": "../../../docs/change-storybook-targets-examples.md"
}

View File

@ -1,16 +0,0 @@
---
title: Change Storybook targets generator examples
description: This page contains examples for the @nrwl/storybook:change-storybook-targets generator, targeted to Angular projects set up with Storybook.
---
This generator will change the `storybook` and `build-storybook` targets in all your Angular projects that are configured to use Storybook. The new target configuration will use the native Storybook builders (`@storybook/angular:build-storybook` and `@storybook/angular:start-storybook`) instead of the Nx Storybook builders (`@nrwl/storybook:build-storybook` and `@nrwl/storybook:storybook`).
This generator is usually invoked through a migrator, when you are using `nx migrate` to upgrade your workspace to Nx `14.1.8` or later.
If you are on Nx `14.1.8` or later and you did not use `nx migrate`, you can run this generator manually by running the following command:
```bash
nx g @nrwl/storybook:change-storybook-targets
```
You can read more about how this generator works, and why we are changing the Storybook targets, in the [Angular Storybook targets documentation page](/packages/storybook/documents/angular-storybook-targets).

View File

@ -20,12 +20,6 @@
"schema": "./src/generators/cypress-project/schema.json",
"description": "Add cypress e2e app to test a UI library that is set up for Storybook.",
"hidden": false
},
"change-storybook-targets": {
"factory": "./src/generators/change-storybook-targets/change-storybook-targets#changeStorybookTargetsSchematic",
"schema": "./src/generators/change-storybook-targets/schema.json",
"description": "Change storybook targets for Angular projects to use @storybook/angular executors",
"hidden": false
}
},
"generators": {
@ -47,12 +41,6 @@
"schema": "./src/generators/cypress-project/schema.json",
"description": "Add cypress e2e app to test a UI library that is set up for Storybook.",
"hidden": false
},
"change-storybook-targets": {
"factory": "./src/generators/change-storybook-targets/change-storybook-targets",
"schema": "./src/generators/change-storybook-targets/schema.json",
"description": "Change storybook targets for Angular projects to use @storybook/angular executors",
"hidden": false
}
}
}

View File

@ -1,4 +1,3 @@
export { configurationGenerator } from './src/generators/configuration/configuration';
export { cypressProjectGenerator } from './src/generators/cypress-project/cypress-project';
export { changeStorybookTargetsGenerator } from './src/generators/change-storybook-targets/change-storybook-targets';
export { storybookVersion } from './src/utils/versions';

View File

@ -1 +0,0 @@
export interface ChangeStorybookTargets {}

View File

@ -1,11 +0,0 @@
{
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"$id": "change-storybook-targets",
"title": "Change Storybook targets",
"description": "Change the Storybook target executors of Angular projects to use the native Storybook for Angular executor schema.",
"type": "object",
"properties": {},
"required": [],
"examplesFile": "../../../docs/change-storybook-targets-example.md"
}

View File

@ -1,11 +1,6 @@
import {
addProjectConfiguration,
readNxJson,
Tree,
writeJson,
} from '@nrwl/devkit';
import { addProjectConfiguration, readNxJson, Tree } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import changeStorybookTargetsGenerator from './change-storybook-targets';
import changeStorybookTargetsGenerator from './change-storybook-targets-generator';
import * as defaultConfig from './test-configs/default-config.json';
import * as customNames from './test-configs/custom-names-config.json';
import * as nonAngular from './test-configs/non-angular.json';

View File

@ -1,5 +1,5 @@
import { Tree } from '@nrwl/devkit';
import { changeStorybookTargetsGenerator } from '../../generators/change-storybook-targets/change-storybook-targets';
import { changeStorybookTargetsGenerator } from './change-storybook-targets-generator';
export default async function changeStorybookTargets(tree: Tree) {
return changeStorybookTargetsGenerator(tree);