diff --git a/docs/generated/cli/create-nx-workspace.md b/docs/generated/cli/create-nx-workspace.md index ca39cba7b804b..2d26849dfb966 100644 --- a/docs/generated/cli/create-nx-workspace.md +++ b/docs/generated/cli/create-nx-workspace.md @@ -139,7 +139,7 @@ Package manager to use Type: `string` -Customizes the initial content of your workspace. Default presets include: ["apps", "empty", "core", "npm", "ts", "web-components", "angular-monorepo", "angular-standalone", "react-monorepo", "react-standalone", "vue-monorepo", "vue-standalone", "next", "nextjs-standalone", "react-native", "expo", "nest", "express", "react", "angular", "vue", "node-standalone", "node-monorepo", "ts-standalone"]. To build your own see https://nx.dev/extending-nx/recipes/create-preset +Customizes the initial content of your workspace. Default presets include: ["apps", "empty", "core", "npm", "ts", "web-components", "angular-monorepo", "angular-standalone", "react-monorepo", "react-standalone", "vue-monorepo", "vue-standalone", "next", "nextjs-standalone", "react-native", "expo", "nest", "express", "react", "angular", "node-standalone", "node-monorepo", "ts-standalone"]. To build your own see https://nx.dev/extending-nx/recipes/create-preset ### routing diff --git a/docs/generated/packages/nx/documents/create-nx-workspace.md b/docs/generated/packages/nx/documents/create-nx-workspace.md index ca39cba7b804b..2d26849dfb966 100644 --- a/docs/generated/packages/nx/documents/create-nx-workspace.md +++ b/docs/generated/packages/nx/documents/create-nx-workspace.md @@ -139,7 +139,7 @@ Package manager to use Type: `string` -Customizes the initial content of your workspace. Default presets include: ["apps", "empty", "core", "npm", "ts", "web-components", "angular-monorepo", "angular-standalone", "react-monorepo", "react-standalone", "vue-monorepo", "vue-standalone", "next", "nextjs-standalone", "react-native", "expo", "nest", "express", "react", "angular", "vue", "node-standalone", "node-monorepo", "ts-standalone"]. To build your own see https://nx.dev/extending-nx/recipes/create-preset +Customizes the initial content of your workspace. Default presets include: ["apps", "empty", "core", "npm", "ts", "web-components", "angular-monorepo", "angular-standalone", "react-monorepo", "react-standalone", "vue-monorepo", "vue-standalone", "next", "nextjs-standalone", "react-native", "expo", "nest", "express", "react", "angular", "node-standalone", "node-monorepo", "ts-standalone"]. To build your own see https://nx.dev/extending-nx/recipes/create-preset ### routing diff --git a/e2e/workspace-create/src/create-nx-workspace.test.ts b/e2e/workspace-create/src/create-nx-workspace.test.ts index dab4f71f77446..d207c87c06e07 100644 --- a/e2e/workspace-create/src/create-nx-workspace.test.ts +++ b/e2e/workspace-create/src/create-nx-workspace.test.ts @@ -420,6 +420,38 @@ describe('create-nx-workspace', () => { }, 90000); } }); + + it('should create a workspace with a single vue app at the root', () => { + const wsName = uniq('vue'); + + runCreateWorkspace(wsName, { + preset: 'vue-standalone', + appName: wsName, + style: 'css', + packageManager, + e2eTestRunner: 'none', + }); + + checkFilesExist('package.json'); + checkFilesExist('project.json'); + checkFilesExist('index.html'); + checkFilesExist('src/main.ts'); + checkFilesExist('src/App.vue'); + expectCodeIsFormatted(); + }); + + it('should be able to create an vue monorepo', () => { + const wsName = uniq('vue'); + const appName = uniq('app'); + runCreateWorkspace(wsName, { + preset: 'vue-monorepo', + appName, + style: 'css', + packageManager, + e2eTestRunner: 'none', + }); + expectCodeIsFormatted(); + }); }); describe('create-nx-workspace parent folder', () => { diff --git a/packages/create-nx-workspace/bin/create-nx-workspace.ts b/packages/create-nx-workspace/bin/create-nx-workspace.ts index 1801ff199a9ff..712a477d7b15e 100644 --- a/packages/create-nx-workspace/bin/create-nx-workspace.ts +++ b/packages/create-nx-workspace/bin/create-nx-workspace.ts @@ -370,7 +370,6 @@ async function determineStack( case Preset.NextJs: case Preset.NextJsStandalone: return 'react'; - case Preset.Vue: case Preset.VueStandalone: case Preset.VueMonorepo: return 'vue'; @@ -616,22 +615,11 @@ async function determineVueOptions( let appName: string; let e2eTestRunner: undefined | 'none' | 'cypress' | 'playwright' = undefined; - if (parsedArgs.preset && parsedArgs.preset !== Preset.Vue) { + if (parsedArgs.preset) { preset = parsedArgs.preset; - if (preset === Preset.VueStandalone || preset === Preset.VueMonorepo) { - appName = parsedArgs.appName ?? parsedArgs.name; - } else { - appName = await determineAppName(parsedArgs); - } } else { const workspaceType = await determineStandaloneOrMonorepo(); - if (workspaceType === 'standalone') { - appName = parsedArgs.name; - } else { - appName = await determineAppName(parsedArgs); - } - if (workspaceType === 'standalone') { preset = Preset.VueStandalone; } else { @@ -639,11 +627,17 @@ async function determineVueOptions( } } + if (preset === Preset.VueStandalone) { + appName = parsedArgs.appName ?? parsedArgs.name; + } else { + appName = await determineAppName(parsedArgs); + } + e2eTestRunner = await determineE2eTestRunner(parsedArgs); if (parsedArgs.style) { style = parsedArgs.style; - } else if (preset === Preset.VueMonorepo || preset === Preset.VueStandalone) { + } else { const reply = await enquirer.prompt<{ style: string }>([ { name: 'style', diff --git a/packages/create-nx-workspace/src/utils/preset/preset.ts b/packages/create-nx-workspace/src/utils/preset/preset.ts index 62dd0c45ba60f..198e58fb7702d 100644 --- a/packages/create-nx-workspace/src/utils/preset/preset.ts +++ b/packages/create-nx-workspace/src/utils/preset/preset.ts @@ -19,7 +19,6 @@ export enum Preset { Express = 'express', React = 'react', Angular = 'angular', - Vue = 'vue', NodeStandalone = 'node-standalone', NodeMonorepo = 'node-monorepo', TsStandalone = 'ts-standalone',