fix(frontend): fix default collection
This commit is contained in:
parent
4d000d93d1
commit
2f9116ff39
@ -198,7 +198,7 @@ describe('ng-add', () => {
|
||||
it('should be set if none was set before', async () => {
|
||||
const result = await runSchematic('ng-add', {}, appTree);
|
||||
const angularJson = readJsonInTree(result, 'angular.json');
|
||||
expect(angularJson.cli.defaultCollection).toEqual('@nrwl/react');
|
||||
expect(angularJson.cli.defaultCollection).toEqual('@nrwl/angular');
|
||||
});
|
||||
|
||||
it('should be set if @nrwl/workspace was set before', async () => {
|
||||
@ -214,14 +214,14 @@ describe('ng-add', () => {
|
||||
);
|
||||
const result = await runSchematic('ng-add', {}, appTree);
|
||||
const angularJson = readJsonInTree(result, 'angular.json');
|
||||
expect(angularJson.cli.defaultCollection).toEqual('@nrwl/react');
|
||||
expect(angularJson.cli.defaultCollection).toEqual('@nrwl/angular');
|
||||
});
|
||||
|
||||
it('should not be set if something else was set before', async () => {
|
||||
appTree = await callRule(
|
||||
updateJsonInTree('angular.json', json => {
|
||||
json.cli = {
|
||||
defaultCollection: '@nrwl/angular'
|
||||
defaultCollection: '@nrwl/react'
|
||||
};
|
||||
|
||||
return json;
|
||||
@ -230,7 +230,7 @@ describe('ng-add', () => {
|
||||
);
|
||||
const result = await runSchematic('ng-add', {}, appTree);
|
||||
const angularJson = readJsonInTree(result, 'angular.json');
|
||||
expect(angularJson.cli.defaultCollection).toEqual('@nrwl/angular');
|
||||
expect(angularJson.cli.defaultCollection).toEqual('@nrwl/react');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -122,19 +122,23 @@ export function addE2eTestRunner(options: Pick<Schema, 'e2eTestRunner'>): Rule {
|
||||
export function setDefaults(options: Schema): Rule {
|
||||
return updateWorkspace(workspace => {
|
||||
workspace.extensions.schematics = workspace.extensions.schematics || {};
|
||||
|
||||
workspace.extensions.schematics['@nrwl/angular:application'] =
|
||||
workspace.extensions.schematics['@nrwl/angular:application'] || {};
|
||||
workspace.extensions.schematics['@nrwl/angular:application'] = {
|
||||
...workspace.extensions.schematics['@nrwl/angular:application'],
|
||||
unitTestRunner: options.unitTestRunner,
|
||||
e2eTestRunner: options.e2eTestRunner
|
||||
};
|
||||
workspace.extensions.schematics[
|
||||
'@nrwl/angular:application'
|
||||
].unitTestRunner =
|
||||
workspace.extensions.schematics['@nrwl/angular:application']
|
||||
.unitTestRunner || options.unitTestRunner;
|
||||
workspace.extensions.schematics['@nrwl/angular:application'].e2eTestRunner =
|
||||
workspace.extensions.schematics['@nrwl/angular:application']
|
||||
.e2eTestRunner || options.e2eTestRunner;
|
||||
|
||||
workspace.extensions.schematics['@nrwl/angular:library'] =
|
||||
workspace.extensions.schematics['@nrwl/angular:library'] || {};
|
||||
workspace.extensions.schematics['@nrwl/angular:library'] = {
|
||||
...workspace.extensions.schematics['@nrwl/angular:library'],
|
||||
unitTestRunner: options.unitTestRunner
|
||||
};
|
||||
workspace.extensions.schematics['@nrwl/angular:library'].unitTestRunner =
|
||||
workspace.extensions.schematics['@nrwl/angular:library'].unitTestRunner ||
|
||||
options.unitTestRunner;
|
||||
|
||||
workspace.extensions.cli = workspace.extensions.cli || {};
|
||||
const defaultCollection: string =
|
||||
@ -143,7 +147,7 @@ export function setDefaults(options: Schema): Rule {
|
||||
|
||||
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
|
||||
(workspace.extensions.cli as JsonObject).defaultCollection =
|
||||
'@nrwl/react';
|
||||
'@nrwl/angular';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user