Skip to content

Commit 82fbb98

Browse files
committed
feat(misc): dont generate defaultProject for non standalone workspaces
1 parent 7c65787 commit 82fbb98

File tree

31 files changed

+7
-175
lines changed

31 files changed

+7
-175
lines changed

docs/generated/packages/angular/generators/application.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@
139139
"description": "Whether to configure Tailwind CSS for the application.",
140140
"default": false
141141
},
142-
"skipDefaultProject": {
143-
"description": "Skip setting the project as the default project. When `false` (the default), the project is set as the default project only if there is no default project already set.",
144-
"type": "boolean",
145-
"default": false
146-
},
147142
"standalone": {
148143
"description": "Generate an application that is setup to use standalone components.",
149144
"type": "boolean",

docs/generated/packages/react/generators/application.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,6 @@
159159
"enum": ["babel", "swc"],
160160
"default": "babel"
161161
},
162-
"skipDefaultProject": {
163-
"description": "Skip setting the project as the default project. When `false` (the default), the project is set as the default project only if there is no default project already set.",
164-
"type": "boolean",
165-
"default": false
166-
},
167162
"skipPackageJson": {
168163
"description": "Do not add dependencies to `package.json`.",
169164
"type": "boolean",

packages/angular/src/generators/application/angular-v14/application.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
enableStrictTypeChecking,
2121
normalizeOptions,
2222
setApplicationStrictDefault,
23-
setDefaultProject,
2423
updateAppComponentTemplate,
2524
updateComponentSpec,
2625
updateConfigFiles,
@@ -109,10 +108,6 @@ export async function applicationGenerator(
109108
await addE2e(host, options);
110109
updateEditorTsConfig(host, options);
111110

112-
if (!options.skipDefaultProject) {
113-
setDefaultProject(host, options);
114-
}
115-
116111
if (options.backendProject) {
117112
addProxyConfig(host, options);
118113
}

packages/angular/src/generators/application/angular-v14/lib/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export * from './nrwl-home-tpl';
1111
export * from './remove-scaffolded-e2e';
1212
export * from './root-router-config';
1313
export * from './set-app-strict-default';
14-
export * from './set-default-project';
1514
export * from './update-component-spec';
1615
export * from './update-app-component-template';
1716
export * from './update-nx-component-template';

packages/angular/src/generators/application/angular-v14/lib/set-default-project.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/angular/src/generators/application/angular-v14/schema.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export interface Schema {
2424
port?: number;
2525
setParserOptionsProject?: boolean;
2626
skipPackageJson?: boolean;
27-
skipDefaultProject?: boolean;
2827
standalone?: boolean;
2928
rootProject?: boolean;
3029
}

packages/angular/src/generators/application/application.spec.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,6 @@ describe('app', () => {
219219
expect(appTsConfig.extends).toBe('../../tsconfig.json');
220220
});
221221

222-
it('should set default project', async () => {
223-
// ACT
224-
await generateApp(appTree);
225-
226-
// ASSERT
227-
const { defaultProject } = readWorkspaceConfiguration(appTree);
228-
expect(defaultProject).toBe('my-app');
229-
});
230-
231222
it('should not overwrite default project if already set', async () => {
232223
// ARRANGE
233224
const workspace = readWorkspaceConfiguration(appTree);
@@ -241,15 +232,6 @@ describe('app', () => {
241232
const { defaultProject } = readWorkspaceConfiguration(appTree);
242233
expect(defaultProject).toBe('some-awesome-project');
243234
});
244-
245-
it('should not set default project when "--skip-default-project=true"', async () => {
246-
// ACT
247-
await generateApp(appTree, 'my-app', { skipDefaultProject: true });
248-
249-
// ASSERT
250-
const { defaultProject } = readWorkspaceConfiguration(appTree);
251-
expect(defaultProject).toBeUndefined();
252-
});
253235
});
254236

255237
describe('nested', () => {

packages/angular/src/generators/application/application.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import {
22
formatFiles,
33
installPackagesTask,
44
moveFilesToNewDirectory,
5+
readWorkspaceConfiguration,
56
Tree,
7+
updateWorkspaceConfiguration,
68
} from '@nrwl/devkit';
79
import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter';
810
import { convertToNxProjectGenerator } from '@nrwl/workspace/generators';
@@ -20,7 +22,6 @@ import {
2022
enableStrictTypeChecking,
2123
normalizeOptions,
2224
setApplicationStrictDefault,
23-
setDefaultProject,
2425
updateAppComponentTemplate,
2526
updateComponentSpec,
2627
updateConfigFiles,
@@ -121,8 +122,10 @@ export async function applicationGenerator(
121122
await addE2e(tree, options);
122123
updateEditorTsConfig(tree, options);
123124

124-
if (!options.skipDefaultProject) {
125-
setDefaultProject(tree, options);
125+
if (options.rootProject) {
126+
const workspace = readWorkspaceConfiguration(tree);
127+
workspace.defaultProject = options.name;
128+
updateWorkspaceConfiguration(tree, workspace);
126129
}
127130

128131
if (options.backendProject) {

packages/angular/src/generators/application/application.v14.spec.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,6 @@ describe('app', () => {
214214
expect(appTsConfig.extends).toBe('../../tsconfig.base.json');
215215
});
216216

217-
it('should set default project', async () => {
218-
// ACT
219-
await generateApp(appTree);
220-
221-
// ASSERT
222-
const { defaultProject } = readWorkspaceConfiguration(appTree);
223-
expect(defaultProject).toBe('my-app');
224-
});
225-
226217
it('should not overwrite default project if already set', async () => {
227218
// ARRANGE
228219
const workspace = readWorkspaceConfiguration(appTree);
@@ -236,15 +227,6 @@ describe('app', () => {
236227
const { defaultProject } = readWorkspaceConfiguration(appTree);
237228
expect(defaultProject).toBe('some-awesome-project');
238229
});
239-
240-
it('should not set default project when "--skip-default-project=true"', async () => {
241-
// ACT
242-
await generateApp(appTree, 'my-app', { skipDefaultProject: true });
243-
244-
// ASSERT
245-
const { defaultProject } = readWorkspaceConfiguration(appTree);
246-
expect(defaultProject).toBeUndefined();
247-
});
248230
});
249231

250232
describe('nested', () => {

packages/angular/src/generators/application/lib/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export * from './nrwl-home-tpl';
1111
export * from './remove-scaffolded-e2e';
1212
export * from './root-router-config';
1313
export * from './set-app-strict-default';
14-
export * from './set-default-project';
1514
export * from './update-component-spec';
1615
export * from './update-app-component-template';
1716
export * from './update-nx-component-template';

0 commit comments

Comments
 (0)