Skip to content

Commit 96f25ce

Browse files
mehrad-rafighvsavkin
authored andcommitted
fix(angular): use selected style extension for components
ISSUES CLOSED: #4287
1 parent 1036b75 commit 96f25ce

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

packages/angular/src/schematics/init/init.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,16 @@ describe('init', () => {
214214
const workspaceJson = readJsonInTree(result, 'workspace.json');
215215
expect(workspaceJson.cli.defaultCollection).toEqual('@nrwl/angular');
216216
});
217+
218+
it.each(['css', 'scss', 'styl', 'less'])(
219+
'should set "%s" as default style extension for components',
220+
async (style) => {
221+
const result = await runSchematic('init', { style }, appTree);
222+
const workspaceJson = readJsonInTree(result, 'workspace.json');
223+
expect(
224+
workspaceJson.schematics['@nrwl/angular:component']['style']
225+
).toBe(style);
226+
}
227+
);
217228
});
218229
});

packages/angular/src/schematics/init/init.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ export function setDefaults(options: Schema): Rule {
139139
workspace.extensions.schematics['@nrwl/angular:library'].unitTestRunner =
140140
workspace.extensions.schematics['@nrwl/angular:library'].unitTestRunner ||
141141
options.unitTestRunner;
142+
143+
workspace.extensions.schematics['@nrwl/angular:component'] = workspace
144+
.extensions.schematics['@nrwl/angular:component'] || {
145+
style: options.style,
146+
};
142147
});
143148

144149
return chain([setDefaultCollection('@nrwl/angular'), updateAngularWorkspace]);
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { UnitTestRunner } from '../../utils/test-runners';
1+
import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
22
export interface Schema {
33
unitTestRunner: UnitTestRunner;
44
e2eTestRunner?: E2eTestRunner;
55
skipFormat: boolean;
66
skipInstall?: boolean;
7+
style?: string;
78
}

0 commit comments

Comments
 (0)