UNPKG

@nx/storybook

Version:

The Nx Plugin for Storybook contains executors and generators for allowing your workspace to use the powerful Storybook integration testing & documenting capabilities.

36 lines (35 loc) 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = changeStorybookTargets; const tslib_1 = require("tslib"); const output_1 = require("nx/src/utils/output"); const migrate_9_1 = tslib_1.__importDefault(require("../../generators/migrate-9/migrate-9")); const utilities_1 = require("../../utils/utilities"); async function changeStorybookTargets(tree) { const storybookVersion = (0, utilities_1.storybookMajorVersion)(); if (!storybookVersion) { /** * This just checks if Storybook is installed in the workspace. * The thing here is that during the previous step of the migration, * during packageJsonUpdates, Nx has already set Storybook * to version 9, if Storybook exists in the workspace. * So, it makes no sense here to check if the version is * 8, because it will always be. */ return; } output_1.output.log({ title: 'Migrating Storybook to v9', bodyLines: [ `🚀 This migration will update your Storybook configuration to v9.`, `It will call the @nx/storybook:migrate-9 generator for you.`, `You can read more about the migration and how this generator works here:`, `https://nx.dev/nx-api/storybook/generators/migrate-9`, ], }); return (0, migrate_9_1.default)(tree, { autoAcceptAllPrompts: true, noUpgrade: true, versionTag: 'latest', }); }