From acf01bce1a5ca44ab0e589d91b95d5f3a950cfef Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Wed, 31 Aug 2016 19:57:44 -0400 Subject: [PATCH] chore(routes): remove lazy route prefix --- addon/ng2/blueprints/component/index.js | 14 ------------- .../ng2/blueprints/ng2/files/angular-cli.json | 3 +-- lib/config/schema.d.ts | 1 - lib/config/schema.json | 3 --- tests/acceptance/generate-route.spec.js | 21 ++----------------- 5 files changed, 3 insertions(+), 39 deletions(-) diff --git a/addon/ng2/blueprints/component/index.js b/addon/ng2/blueprints/component/index.js index 2f9f4cea9e9f..bed33cd23da4 100644 --- a/addon/ng2/blueprints/component/index.js +++ b/addon/ng2/blueprints/component/index.js @@ -11,7 +11,6 @@ module.exports = { availableOptions: [ { name: 'flat', type: Boolean, default: false }, - { name: 'route', type: Boolean, default: false }, { name: 'inline-template', type: Boolean, default: false, aliases: ['it'] }, { name: 'inline-style', type: Boolean, default: false, aliases: ['is'] }, { name: 'prefix', type: Boolean, default: true }, @@ -54,7 +53,6 @@ module.exports = { inlineTemplate: options.inlineTemplate, inlineStyle: options.inlineStyle, route: options.route, - isLazyRoute: !!options.isLazyRoute, isAppComponent: !!options.isAppComponent, selector: this.selector, styleExt: this.styleExt @@ -84,18 +82,6 @@ module.exports = { var dir = this.dynamicPath.dir; if (!options.locals.flat) { dir += path.sep + options.dasherizedModuleName; - - if (options.locals.isLazyRoute) { - var lazyRoutePrefix = '+'; - if (this.project.ngConfig && - this.project.ngConfig.defaults && - this.project.ngConfig.defaults.lazyRoutePrefix !== undefined) { - lazyRoutePrefix = this.project.ngConfig.defaults.lazyRoutePrefix; - } - var dirParts = dir.split(path.sep); - dirParts[dirParts.length - 1] = `${lazyRoutePrefix}${dirParts[dirParts.length - 1]}`; - dir = dirParts.join(path.sep); - } } var srcDir = this.project.ngConfig.apps[0].root; this.appDir = dir.substr(dir.indexOf(srcDir) + srcDir.length); diff --git a/addon/ng2/blueprints/ng2/files/angular-cli.json b/addon/ng2/blueprints/ng2/files/angular-cli.json index 8e2ec1e19637..d86fae02fb79 100644 --- a/addon/ng2/blueprints/ng2/files/angular-cli.json +++ b/addon/ng2/blueprints/ng2/files/angular-cli.json @@ -39,7 +39,6 @@ }, "defaults": { "styleExt": "<%= styleExt %>", - "prefixInterfaces": false, - "lazyRoutePrefix": "+" + "prefixInterfaces": false } } diff --git a/lib/config/schema.d.ts b/lib/config/schema.d.ts index 68849bc3c920..f660f183f221 100644 --- a/lib/config/schema.d.ts +++ b/lib/config/schema.d.ts @@ -59,6 +59,5 @@ export interface CliConfig { defaults?: { styleExt?: string; prefixInterfaces?: boolean; - lazyRoutePrefix?: string; }; } diff --git a/lib/config/schema.json b/lib/config/schema.json index 412f8eb0ed60..af5d76267e71 100644 --- a/lib/config/schema.json +++ b/lib/config/schema.json @@ -135,9 +135,6 @@ }, "prefixInterfaces": { "type": "boolean" - }, - "lazyRoutePrefix": { - "type": "string" } }, "additionalProperties": false diff --git a/tests/acceptance/generate-route.spec.js b/tests/acceptance/generate-route.spec.js index 579d9ad2fd21..79ec44ac5b99 100644 --- a/tests/acceptance/generate-route.spec.js +++ b/tests/acceptance/generate-route.spec.js @@ -12,9 +12,8 @@ const root = process.cwd(); const testPath = path.join(root, 'tmp', 'foo', 'src', 'app'); -function fileExpectations(lazy, expectation) { - const lazyPrefix = lazy ? '+' : ''; - const dir = `${lazyPrefix}my-route`; +function fileExpectations(expectation) { + const dir = 'my-route'; expect(existsSync(path.join(testPath, dir, 'my-route.component.ts'))).to.equal(expectation); } @@ -43,12 +42,6 @@ xdescribe('Acceptance: ng generate route', function () { }); }); - it('ng generate route my-route --lazy false', function () { - return ng(['generate', 'route', 'my-route', '--lazy', 'false']).then(() => { - fileExpectations(false, true); - }); - }); - it('ng generate route +my-route', function () { return ng(['generate', 'route', '+my-route']).then(() => { fileExpectations(true, true); @@ -102,14 +95,4 @@ xdescribe('Acceptance: ng generate route', function () { expect(afterGenerateParentHtml).to.equal(unmodifiedParentComponentHtml); }); }); - - it('lazy route prefix', () => { - return ng(['set', 'defaults.lazyRoutePrefix', 'myprefix']) - .then(() => ng(['generate', 'route', 'prefix-test'])) - .then(() => { - var folderPath = path.join(testPath, 'myprefixprefix-test', 'prefix-test.component.ts'); - expect(existsSync(folderPath)) - .to.equal(true); - }); - }); });