From 807d0cf15b11214c3e2491bcd0ea605d86d3df8b Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Wed, 13 Sep 2023 12:12:09 -0400 Subject: [PATCH] feat(vue): remove unused preset --- .../src/create-nx-workspace.test.ts | 32 +++++++++++++++++++ .../bin/create-nx-workspace.ts | 22 +++++-------- .../src/utils/preset/preset.ts | 1 - 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/e2e/workspace-create/src/create-nx-workspace.test.ts b/e2e/workspace-create/src/create-nx-workspace.test.ts index dab4f71f77446e..d207c87c06e075 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 1801ff199a9ff6..712a477d7b15ef 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 62dd0c45ba60f2..198e58fb7702de 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',