Skip to content

Commit 440d767

Browse files
authored
chore(routes): remove lazy route prefix (#1928)
1 parent 8a5e769 commit 440d767

File tree

5 files changed

+3
-39
lines changed

5 files changed

+3
-39
lines changed

addon/ng2/blueprints/component/index.js

-14
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111

1212
availableOptions: [
1313
{ name: 'flat', type: Boolean, default: false },
14-
{ name: 'route', type: Boolean, default: false },
1514
{ name: 'inline-template', type: Boolean, default: false, aliases: ['it'] },
1615
{ name: 'inline-style', type: Boolean, default: false, aliases: ['is'] },
1716
{ name: 'prefix', type: Boolean, default: true },
@@ -54,7 +53,6 @@ module.exports = {
5453
inlineTemplate: options.inlineTemplate,
5554
inlineStyle: options.inlineStyle,
5655
route: options.route,
57-
isLazyRoute: !!options.isLazyRoute,
5856
isAppComponent: !!options.isAppComponent,
5957
selector: this.selector,
6058
styleExt: this.styleExt
@@ -84,18 +82,6 @@ module.exports = {
8482
var dir = this.dynamicPath.dir;
8583
if (!options.locals.flat) {
8684
dir += path.sep + options.dasherizedModuleName;
87-
88-
if (options.locals.isLazyRoute) {
89-
var lazyRoutePrefix = '+';
90-
if (this.project.ngConfig &&
91-
this.project.ngConfig.defaults &&
92-
this.project.ngConfig.defaults.lazyRoutePrefix !== undefined) {
93-
lazyRoutePrefix = this.project.ngConfig.defaults.lazyRoutePrefix;
94-
}
95-
var dirParts = dir.split(path.sep);
96-
dirParts[dirParts.length - 1] = `${lazyRoutePrefix}${dirParts[dirParts.length - 1]}`;
97-
dir = dirParts.join(path.sep);
98-
}
9985
}
10086
var srcDir = this.project.ngConfig.apps[0].root;
10187
this.appDir = dir.substr(dir.indexOf(srcDir) + srcDir.length);

addon/ng2/blueprints/ng2/files/angular-cli.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
},
4040
"defaults": {
4141
"styleExt": "<%= styleExt %>",
42-
"prefixInterfaces": false,
43-
"lazyRoutePrefix": "+"
42+
"prefixInterfaces": false
4443
}
4544
}

lib/config/schema.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,5 @@ export interface CliConfig {
5959
defaults?: {
6060
styleExt?: string;
6161
prefixInterfaces?: boolean;
62-
lazyRoutePrefix?: string;
6362
};
6463
}

lib/config/schema.json

-3
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@
135135
},
136136
"prefixInterfaces": {
137137
"type": "boolean"
138-
},
139-
"lazyRoutePrefix": {
140-
"type": "string"
141138
}
142139
},
143140
"additionalProperties": false

tests/acceptance/generate-route.spec.js

+2-19
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ const root = process.cwd();
1212

1313
const testPath = path.join(root, 'tmp', 'foo', 'src', 'app');
1414

15-
function fileExpectations(lazy, expectation) {
16-
const lazyPrefix = lazy ? '+' : '';
17-
const dir = `${lazyPrefix}my-route`;
15+
function fileExpectations(expectation) {
16+
const dir = 'my-route';
1817
expect(existsSync(path.join(testPath, dir, 'my-route.component.ts'))).to.equal(expectation);
1918
}
2019

@@ -43,12 +42,6 @@ xdescribe('Acceptance: ng generate route', function () {
4342
});
4443
});
4544

46-
it('ng generate route my-route --lazy false', function () {
47-
return ng(['generate', 'route', 'my-route', '--lazy', 'false']).then(() => {
48-
fileExpectations(false, true);
49-
});
50-
});
51-
5245
it('ng generate route +my-route', function () {
5346
return ng(['generate', 'route', '+my-route']).then(() => {
5447
fileExpectations(true, true);
@@ -102,14 +95,4 @@ xdescribe('Acceptance: ng generate route', function () {
10295
expect(afterGenerateParentHtml).to.equal(unmodifiedParentComponentHtml);
10396
});
10497
});
105-
106-
it('lazy route prefix', () => {
107-
return ng(['set', 'defaults.lazyRoutePrefix', 'myprefix'])
108-
.then(() => ng(['generate', 'route', 'prefix-test']))
109-
.then(() => {
110-
var folderPath = path.join(testPath, 'myprefixprefix-test', 'prefix-test.component.ts');
111-
expect(existsSync(folderPath))
112-
.to.equal(true);
113-
});
114-
});
11598
});

0 commit comments

Comments
 (0)