@nx/storybook
Version:
31 lines (30 loc) • 1.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = changeStorybookTargets;
const output_1 = require("nx/src/utils/output");
const migrate_8_1 = require("../../generators/migrate-8/migrate-8");
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 8, if Storybook exists in the workspace.
* So, it makes no sense here to check if the version is
* 7, because it will always be.
*/
return;
}
output_1.output.log({
title: 'Migrating Storybook to v8',
bodyLines: [
`🚀 This migration will update your Storybook configuration to v8.`,
`It will call the @nx/storybook:migrate-8 generator for you.`,
`You can read more about the migration and how this generator works here:`,
`https://nx.dev/nx-api/storybook/generators/migrate-8`,
],
});
return (0, migrate_8_1.default)(tree, { autoAcceptAllPrompts: true });
}