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 8b812cc
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/generated/cli/create-nx-workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
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 8b812cc

Please sign in to comment.