diff --git a/docs/generated/packages/storybook/generators/configuration.json b/docs/generated/packages/storybook/generators/configuration.json index ab3b494c767b8..d10d6558c6e36 100644 --- a/docs/generated/packages/storybook/generators/configuration.json +++ b/docs/generated/packages/storybook/generators/configuration.json @@ -89,6 +89,7 @@ "@storybook/web-components-vite" ], "aliases": ["storybook7UiFramework"], + "x-prompt": "Choose the Storybook framework that you need to use.", "x-priority": "important", "hidden": false }, diff --git a/packages/storybook/package.json b/packages/storybook/package.json index dc03414f5b0af..5028134dadde2 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -31,7 +31,6 @@ }, "dependencies": { "dotenv": "~10.0.0", - "enquirer": "~2.3.6", "@phenomnomnominal/tsquery": "~5.0.1", "semver": "7.3.4", "@nx/cypress": "file:../cypress", diff --git a/packages/storybook/src/generators/configuration/configuration-nested.spec.ts b/packages/storybook/src/generators/configuration/configuration-nested.spec.ts index 919f2f6e97dbd..21c5a2bba59f4 100644 --- a/packages/storybook/src/generators/configuration/configuration-nested.spec.ts +++ b/packages/storybook/src/generators/configuration/configuration-nested.spec.ts @@ -6,7 +6,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import * as enquirer from 'enquirer'; import configurationGenerator from './configuration'; import * as workspaceConfiguration from './test-configs/root-workspace-configuration.json'; @@ -19,9 +18,6 @@ jest.mock('nx/src/project-graph/project-graph', () => ({ .mockImplementation(async () => ({ nodes: {}, dependencies: {} })), })); -jest.mock('enquirer'); -// @ts-ignore -enquirer.prompt = jest.fn(); describe('@nx/storybook:configuration for workspaces with Root project', () => { beforeAll(() => { process.env.NX_INTERACTIVE = 'true'; @@ -32,10 +28,6 @@ describe('@nx/storybook:configuration for workspaces with Root project', () => { }); describe('basic functionalities', () => { let tree: Tree; - // @ts-ignore - enquirer.prompt = jest - .fn() - .mockReturnValue(Promise.resolve({ bundler: 'webpack' })); beforeEach(async () => { tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); updateJson(tree, 'nx.json', (json) => { diff --git a/packages/storybook/src/generators/configuration/configuration.spec.ts b/packages/storybook/src/generators/configuration/configuration.spec.ts index a990f6e2d266e..116e1178fc2a9 100644 --- a/packages/storybook/src/generators/configuration/configuration.spec.ts +++ b/packages/storybook/src/generators/configuration/configuration.spec.ts @@ -10,7 +10,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import * as enquirer from 'enquirer'; import { Linter } from '@nx/linter'; import { libraryGenerator } from '@nx/js'; @@ -26,9 +25,6 @@ jest.mock('nx/src/project-graph/project-graph', () => ({ .fn() .mockImplementation(async () => ({ nodes: {}, dependencies: {} })), })); -jest.mock('enquirer'); -// @ts-ignore -enquirer.prompt = jest.fn(); describe('@nx/storybook:configuration for Storybook v7', () => { describe('basic functionalities', () => { diff --git a/packages/storybook/src/generators/configuration/configuration.ts b/packages/storybook/src/generators/configuration/configuration.ts index 402e60e18432a..cfc682f5da18b 100644 --- a/packages/storybook/src/generators/configuration/configuration.ts +++ b/packages/storybook/src/generators/configuration/configuration.ts @@ -39,7 +39,6 @@ import { storybookVersion, tsNodeVersion, } from '../../utils/versions'; -import { getGeneratorConfigurationOptions } from './lib/user-prompts'; export async function configurationGenerator( tree: Tree, @@ -49,10 +48,6 @@ export async function configurationGenerator( throw new Error(pleaseUpgrade()); } - if (process.env.NX_INTERACTIVE === 'true') { - rawSchema = await getGeneratorConfigurationOptions(rawSchema); - } - const schema = normalizeSchema(rawSchema); const tasks: GeneratorCallback[] = []; diff --git a/packages/storybook/src/generators/configuration/lib/user-prompts.ts b/packages/storybook/src/generators/configuration/lib/user-prompts.ts deleted file mode 100644 index 9798d7fa2084d..0000000000000 --- a/packages/storybook/src/generators/configuration/lib/user-prompts.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { UiFramework7 } from '../../../utils/models'; -import { Constants } from '../../../utils/utilities'; -import { prompt } from 'enquirer'; -import { StorybookConfigureSchema } from '../schema'; - -export async function getGeneratorConfigurationOptions( - rawSchema: StorybookConfigureSchema -): Promise { - if (!rawSchema.uiFramework) { - rawSchema.uiFramework = await getStorybook7Framework(); - } - - return rawSchema; -} - -export async function getStorybook7Framework(): Promise { - const a = await prompt<{ UiFramework: UiFramework7 }>([ - { - name: 'UiFramework', - message: `Choose the Storybook 7 framework that you need to use`, - type: 'autocomplete', - choices: [ - ...Constants.uiFrameworks7.map((uiFramework) => ({ - name: uiFramework, - message: uiFramework, - })), - ], - }, - ]); - return a.UiFramework; -} diff --git a/packages/storybook/src/generators/configuration/schema.json b/packages/storybook/src/generators/configuration/schema.json index 6ba17152359af..b87e8e1f3bf96 100644 --- a/packages/storybook/src/generators/configuration/schema.json +++ b/packages/storybook/src/generators/configuration/schema.json @@ -89,6 +89,7 @@ "@storybook/web-components-vite" ], "aliases": ["storybook7UiFramework"], + "x-prompt": "Choose the Storybook framework that you need to use.", "x-priority": "important", "hidden": false },