Skip to content

Commit

Permalink
feat(storybook): use createNodesV2 for init and convert-to-inferred g…
Browse files Browse the repository at this point in the history
…enerators
  • Loading branch information
Phillip9587 committed Sep 24, 2024
1 parent db3339a commit d6b9633
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
} from '@nx/devkit';
import { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
import {
migrateProjectExecutorsToPluginV1,
migrateProjectExecutorsToPlugin,
NoTargetsToMigrateError,
} from '@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator';
import { buildPostTargetTransformer } from './lib/build-post-target-transformer';
import { servePostTargetTransformer } from './lib/serve-post-target-transformer';
import { createNodes } from '../../plugins/plugin';
import { createNodesV2 } from '../../plugins/plugin';
import { storybookVersion } from '../../utils/versions';

interface Schema {
Expand All @@ -23,11 +23,11 @@ interface Schema {
export async function convertToInferred(tree: Tree, options: Schema) {
const projectGraph = await createProjectGraphAsync();
const migrationLogs = new AggregatedLog();
const migratedProjects = await migrateProjectExecutorsToPluginV1(
const migratedProjects = await migrateProjectExecutorsToPlugin(
tree,
projectGraph,
'@nx/storybook/plugin',
createNodes,
createNodesV2,
{
buildStorybookTargetName: 'build-storybook',
serveStorybookTargetName: 'storybook',
Expand Down
8 changes: 4 additions & 4 deletions packages/storybook/src/generators/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
updateJson,
updateNxJson,
} from '@nx/devkit';
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
import { gte } from 'semver';
import { createNodes } from '../../plugins/plugin';
import { createNodesV2 } from '../../plugins/plugin';
import {
getInstalledStorybookVersion,
storybookMajorVersion,
Expand Down Expand Up @@ -102,11 +102,11 @@ export async function initGeneratorInternal(tree: Tree, schema: Schema) {
schema.addPlugin ??= addPluginDefault;

if (schema.addPlugin) {
await addPluginV1(
await addPlugin(
tree,
await createProjectGraphAsync(),
'@nx/storybook/plugin',
createNodes,
createNodesV2,
{
serveStorybookTargetName: [
'storybook',
Expand Down

0 comments on commit d6b9633

Please sign in to comment.