Skip to content

Commit

Permalink
feat(vue): remove unused preset
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Sep 13, 2023
1 parent 952b550 commit 807d0cf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 15 deletions.
32 changes: 32 additions & 0 deletions e2e/workspace-create/src/create-nx-workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
22 changes: 8 additions & 14 deletions packages/create-nx-workspace/bin/create-nx-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -616,34 +615,29 @@ 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 {
preset = Preset.VueMonorepo;
}
}

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',
Expand Down
1 change: 0 additions & 1 deletion packages/create-nx-workspace/src/utils/preset/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export enum Preset {
Express = 'express',
React = 'react',
Angular = 'angular',
Vue = 'vue',
NodeStandalone = 'node-standalone',
NodeMonorepo = 'node-monorepo',
TsStandalone = 'ts-standalone',
Expand Down

0 comments on commit 807d0cf

Please sign in to comment.