From 8c1a8ba7e36cc38d487164c8f7b207b82148b023 Mon Sep 17 00:00:00 2001 From: Jonathan Ziller Date: Fri, 6 Nov 2015 12:05:18 +0100 Subject: [PATCH 1/8] feat(directive): directive generator follows coding best practices - templateUrl accessible from outside; don't use interface for controller --- templates/typescript/directive.ts | 25 +++++++++++---------- templates/typescript/directive.unit.spec.ts | 14 +++++------- templates/typescript/directives.module.ts | 4 ++-- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/templates/typescript/directive.ts b/templates/typescript/directive.ts index abc48e3..8789484 100644 --- a/templates/typescript/directive.ts +++ b/templates/typescript/directive.ts @@ -1,27 +1,28 @@ /// module <%= prefix %>.<%= module %>.<%= $namespace %> { - 'use strict'; + 'use strict';<% if (hasTemplate) { %> + + const templateUrl = '<%= templateUrl %>';<% } %> - class <%= classedName %>Directive implements angular.IDirective { + export class <%= classedName %>Directive implements angular.IDirective { restrict = '<%= restrict %>';<% if (hasTemplate) { %> - templateUrl = '<%= templateUrl %>';<% } %><% if (hasController) { %> + templateUrl = templateUrl;<% } %><% if (hasController) { %> controller = ID.<%= classedName %>Controller; - controllerAs = '<%= cameledName %>'; + controllerAs = 'vm'; bindToController = true;<% } %><% if (hasLinkFnc) { %> - link = (scope: angular.IScope, - instanceElement: angular.IAugmentedJQuery, - instanceAttributes: angular.IAttributes<% if (hasController) { %>, + link = (scope: ng.IScope, + instanceElement: ng.IAugmentedJQuery, + instanceAttributes: ng.IAttributes<% if (hasController) { %>, controller: <%= classedName %>Controller<% } %>) => { // TODO: link logic - };<% } %> - }<% if (hasController) { %> + };<% } %><% if (hasTemplate) { %> - export interface I<%= classedName %>Controller { - } + static getTemplateUrl = () => templateUrl;<% } %> + }<% if (hasController) { %> - class <%= classedName %>Controller implements I<%= classedName %>Controller { + export class <%= classedName %>Controller { static $inject = []; constructor() { // TODO diff --git a/templates/typescript/directive.unit.spec.ts b/templates/typescript/directive.unit.spec.ts index 7c3cfb9..a913596 100644 --- a/templates/typescript/directive.unit.spec.ts +++ b/templates/typescript/directive.unit.spec.ts @@ -4,18 +4,14 @@ module <%= prefix %>.<%= module %>.<%= $namespace %>.test { 'use strict'; describe(`Unit: ${Namespace}.<%= classedName %>Directive`, () => { - var $compile, $rootScope; + let $compile: ng.ICompileService, $rootScope: ng.IRootScopeService; - beforeEach(module(Namespace)); + beforeEach(angular.mock.module(`${Namespace}.<%= classedName %>`)); - beforeEach(angular.mock.inject( - ['$compile', '$rootScope', ($c, $r) => { - $compile = $c; - $rootScope = $r; - }] - ));<% if (hasController) { %> + beforeEach(angular.mock.inject(_$compile_ => $compile = _$compile_)); + beforeEach(angular.mock.inject(_$rootScope_ => $rootScope = _$rootScope_));<% if (hasController) { %> - var controller: I<%= classedName %>Controller; + let controller: <%= classedName %>Controller; beforeEach(inject($controller => controller = $controller(ID.<%= classedName %>Controller))); it('should contain a <%= classedName %> controller', () => should.exist(controller));<% } %> diff --git a/templates/typescript/directives.module.ts b/templates/typescript/directives.module.ts index 8469478..3681fd0 100644 --- a/templates/typescript/directives.module.ts +++ b/templates/typescript/directives.module.ts @@ -3,7 +3,7 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; - export var Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; + export const Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; angular .module(Namespace, [<% for (var i = 0, l = components.length; i < l; i++) { %> @@ -11,7 +11,7 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { `${Namespace}.<%= classedName %>` ]); - export var ID = {<% for (var i = 0, l = components.length; i < l; i++) { %> + export const ID = {<% for (var i = 0, l = components.length; i < l; i++) { %> <%= components[i] %>Controller: `${Namespace}.<%= components[i] %>Controller`, <% } %> <%= classedName %>Controller: `${Namespace}.<%= classedName %>Controller` }; From 10677c2d2a8b0aafafc16a322d9cfae7950a78b5 Mon Sep 17 00:00:00 2001 From: Jonathan Ziller Date: Fri, 6 Nov 2015 12:06:46 +0100 Subject: [PATCH 2/8] feat(filter): cleanup; filter generator follows coding best practices - during test only load module of component under test instead of whole namespace --- templates/typescript/filter.ts | 10 +++++----- templates/typescript/filter.unit.spec.ts | 10 +++++----- templates/typescript/filters.module.ts | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/templates/typescript/filter.ts b/templates/typescript/filter.ts index e568aea..0fb9c1b 100644 --- a/templates/typescript/filter.ts +++ b/templates/typescript/filter.ts @@ -3,11 +3,11 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; - export interface I<%= classedName %>Filter { + export interface I<%= classedName %> { (input: string): string; } - var <%= cameledName %> = (): I<%= classedName %>Filter => { + export const <%= cameledName %>Filter = (): I<%= classedName %> => { return input => { input = input || ''; @@ -17,9 +17,9 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { }; }; - <%= cameledName %>.$inject = []; + <%= cameledName %>Filter.$inject = []; angular - .module(`${Namespace}.<%= classedName %>Filter`, []) - .filter(ID.<%= classedName %>Filter, <%= cameledName %>); + .module(`${Namespace}.<%= classedName %>`, []) + .filter(ID.<%= classedName %>, <%= cameledName %>Filter); } diff --git a/templates/typescript/filter.unit.spec.ts b/templates/typescript/filter.unit.spec.ts index 108ce8b..281d218 100644 --- a/templates/typescript/filter.unit.spec.ts +++ b/templates/typescript/filter.unit.spec.ts @@ -3,13 +3,13 @@ module <%= prefix %>.<%= module %>.<%= $namespace %>.test { 'use strict'; - describe(`Unit: ${Namespace}.<%= classedName %>Filter`, () => { + describe(`Unit: ${Namespace}.<%= classedName %>`, () => { - beforeEach(module(Namespace)); + beforeEach(angular.mock.module(`${Namespace}.<%= classedName %>`)); - var <%= cameledName %>: I<%= classedName %>Filter; - beforeEach(inject($filter => <%= cameledName %> = $filter(ID.<%= classedName %>Filter))); + let <%= cameledName %>Filter: I<%= classedName %>; + beforeEach(inject($filter => <%= cameledName %>Filter = $filter(ID.<%= classedName %>))); - it('should contain a <%= cameledName %> filter', () => should.exist(<%= cameledName %>)); + it('should contain a <%= cameledName %> filter', () => should.exist(<%= cameledName %>Filter)); }); } diff --git a/templates/typescript/filters.module.ts b/templates/typescript/filters.module.ts index 17c3d2d..59d0c05 100644 --- a/templates/typescript/filters.module.ts +++ b/templates/typescript/filters.module.ts @@ -3,16 +3,16 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; - export var Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; + export const Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; angular .module(Namespace, [<% for (var i = 0, l = components.length; i < l; i++) { %> `${Namespace}.<%= components[i] %>`, <% } %> - `${Namespace }.<%= classedName %>Filter` + `${Namespace }.<%= classedName %>` ]); - export var ID = {<% for (var i = 0, l = components.length; i < l; i++) { %> + export const ID = {<% for (var i = 0, l = components.length; i < l; i++) { %> <%= components[i] %>: '<%= components[i].charAt(0).toLowerCase() %><%= components[i].replace(/Filter$/, '').slice(1) %>', <% } %> - <%= classedName %>Filter: '<%= cameledName %>' + <%= classedName %>: '<%= cameledName %>' }; } From 0c4c390d7f138d6903a0089b991eb71340ce6aa2 Mon Sep 17 00:00:00 2001 From: Jonathan Ziller Date: Fri, 6 Nov 2015 12:07:01 +0100 Subject: [PATCH 3/8] feat(module): cleanup --- templates/typescript/module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/typescript/module.ts b/templates/typescript/module.ts index 1c65c00..9a82914 100644 --- a/templates/typescript/module.ts +++ b/templates/typescript/module.ts @@ -3,7 +3,7 @@ module <%= prefix %>.<%= cameledName %> { 'use strict'; - export var Namespace = '<%= prefix %>.<%= cameledName %>'; + export const Namespace = '<%= prefix %>.<%= cameledName %>'; angular .module(Namespace, []); From 316b701027f4c24a2d0520504e34331ed6cceb08 Mon Sep 17 00:00:00 2001 From: Jonathan Ziller Date: Fri, 6 Nov 2015 12:08:16 +0100 Subject: [PATCH 4/8] feat(service): cleanup; service generator follows coding best practices - during test only load module of component under test instead of whole namespace, class (and factory) is exported --- templates/typescript/service.ts | 25 ++++++++++++----------- templates/typescript/service.unit.spec.ts | 6 ++---- templates/typescript/services.module.ts | 10 ++------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/templates/typescript/service.ts b/templates/typescript/service.ts index 9695a2a..af0e48f 100644 --- a/templates/typescript/service.ts +++ b/templates/typescript/service.ts @@ -7,29 +7,30 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { method(param: string): string; } - class <%= classedName %> implements I<%= classedName %> { + export class <%= classedName %> implements I<%= classedName %> { private field; - - static $inject = []; + <% if(!useFactory) { %> + static $inject = [];<% } %> constructor() { this.field = 'value'; } method = (param: string) => { return param; - } - }<% if(useFactory) { %> + };<% if(useFactory) { %> - var factory = (): I<%= classedName %> => { - // TODO: private initialization code + static createInstance = () => { + // TODO: private initialization code + + // TODO: pass initialization parameters to class + return new <%= classedName %>(); + };<% } %> + }<% if(useFactory) { %> - // TODO: pass initialization parameters to class - return new <%= classedName %>(); - }; - factory.$inject = [];<% } %> + <%= classedName %>.createInstance.$inject = [];<% } %> angular .module(ID.<%= classedName %>, [])<% if(!useFactory) { %> .service(ID.<%= classedName %>, <%= classedName %>)<% } %><% if(useFactory) { %> - .factory(ID.<%= classedName %>, factory)<% } %>; + .factory(ID.<%= classedName %>, <%= classedName %>.createInstance)<% } %>; } diff --git a/templates/typescript/service.unit.spec.ts b/templates/typescript/service.unit.spec.ts index ba1d805..55b8d36 100644 --- a/templates/typescript/service.unit.spec.ts +++ b/templates/typescript/service.unit.spec.ts @@ -5,13 +5,11 @@ module <%= prefix %>.<%= module %>.<%= $namespace %>.test { describe(`Unit: ${Namespace}.<%= classedName %>`, () => { - beforeEach(module(Namespace)); + beforeEach(angular.mock.module(ID.<%= classedName %>)); - var service: I<%= classedName %>; + let service: I<%= classedName %>; beforeEach(angular.mock.inject([ID.<%= classedName %>, s => service = s])); it('should contain a <%= classedName %> service', () => should.exist(service)); - - it('should have a method', () => should.exist(service.method)); }); } diff --git a/templates/typescript/services.module.ts b/templates/typescript/services.module.ts index e26281b..7dbe514 100644 --- a/templates/typescript/services.module.ts +++ b/templates/typescript/services.module.ts @@ -3,16 +3,10 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; - export var Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; + export const Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; - export var ID = {<% for (var i = 0, l = components.length; i < l; i++) { %> + export const ID = {<% for (var i = 0, l = components.length; i < l; i++) { %> <%= components[i] %>: `${Namespace}.<%= components[i] %>`, <% } %> <%= classedName %>: `${Namespace}.<%= classedName %>` }; - - angular - .module(Namespace, [<% for (var i = 0, l = components.length; i < l; i++) { %> - ID.<%= components[i] %>, <% } %> - ID.<%= classedName %> - ]); } From 91af13d5adfde745fa17498fbd3bf881112a86db Mon Sep 17 00:00:00 2001 From: Jonathan Ziller Date: Fri, 6 Nov 2015 12:08:52 +0100 Subject: [PATCH 5/8] feat(view): cleanup; filter generator follows coding best practices - during test only load module of component under test instead of whole namespace, don't use interface for controller --- templates/typescript/view.ts | 20 +++++++------------- templates/typescript/view.unit.spec.ts | 4 ++-- templates/typescript/views.module.ts | 4 ++-- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/templates/typescript/view.ts b/templates/typescript/view.ts index 828dffe..65a7f37 100644 --- a/templates/typescript/view.ts +++ b/templates/typescript/view.ts @@ -3,16 +3,15 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; - var stateConfig = ($stateProvider: ng.ui.IStateProvider) => { + const stateConfig = ($stateProvider: ng.ui.IStateProvider) => { $stateProvider - .state('admin.<%= module %><%= classedName %>', { + .state('root.<%= module %><%= classedName %>', { url: '/<%= url %>', - navigationKey: '<%= module %>', views: { 'content': { templateUrl: '<%= templateUrl %>', controller: ID.<%= classedName %>Controller, - controllerAs: '<%= cameledName %>' + controllerAs: 'vm' } } }); @@ -20,14 +19,7 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { stateConfig.$inject = ['$stateProvider']; - export interface I<%= classedName %>Controller { - prop: string; - asyncProp: ng.IPromise; - method(param: string): string; - action(): void; - } - - class <%= classedName %>Controller implements I<%= classedName %>Controller { + export class <%= classedName %>Controller { prop: string; asyncProp: ng.IPromise; @@ -53,7 +45,9 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { } angular - .module(`${Namespace}.<%= classedName %>`, []) + .module(`${Namespace}.<%= classedName %>`, [ + 'ui.router.state' + ]) .config(stateConfig) .controller(ID.<%= classedName %>Controller, <%= classedName %>Controller); } diff --git a/templates/typescript/view.unit.spec.ts b/templates/typescript/view.unit.spec.ts index c607612..22484d4 100644 --- a/templates/typescript/view.unit.spec.ts +++ b/templates/typescript/view.unit.spec.ts @@ -5,9 +5,9 @@ module <%= prefix %>.<%= module %>.<%= $namespace %>.test { describe(`Unit: ${Namespace}.<%= classedName %>Controller`, () => { - beforeEach(module(Namespace)); + beforeEach(angular.mock.module(`${Namespace}.<%= classedName %>`)); - var controller: I<%= classedName %>Controller; + let controller: <%= classedName %>Controller; beforeEach(inject($controller => controller = $controller(ID.<%= classedName %>Controller))); it('should contain a <%= classedName %> controller', () => should.exist(controller)); diff --git a/templates/typescript/views.module.ts b/templates/typescript/views.module.ts index 88301ad..ff618aa 100644 --- a/templates/typescript/views.module.ts +++ b/templates/typescript/views.module.ts @@ -3,7 +3,7 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; - export var Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; + export const Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; angular .module(Namespace, [ @@ -14,7 +14,7 @@ module <%= prefix %>.<%= module %>.<%= $namespace %> { `${Namespace}.<%= classedName %>` ]); - export var ID = {<% for (var i = 0, l = components.length; i < l; i++) { %> + export const ID = {<% for (var i = 0, l = components.length; i < l; i++) { %> <%= components[i] %>Controller: `${Namespace}.<%= components[i] %>Controller`, <% } %> <%= classedName %>Controller: `${Namespace}.<%= classedName %>Controller` }; From d34de164a1c49a80319a94b7f61d12be89a87ed1 Mon Sep 17 00:00:00 2001 From: Jonathan Ziller Date: Fri, 6 Nov 2015 12:10:08 +0100 Subject: [PATCH 6/8] feat(app): bump TypeScript version to 1.6; bump tslint version to 3.X.X --- app/templates/_package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/_package.json b/app/templates/_package.json index 8d67972..26a3aca 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -46,9 +46,9 @@ "main-bower-files": "^2.5.0", "wiredep": "^2.2.2"<% if (prompts.useTypescript) { %>, "tsd": "^0.6.0", - "typescript": "~1.4.0", + "typescript": "~1.6.0", "gulp-typescript": "^2.7.5", - "gulp-tslint": "^2.0.0"<% } %> + "gulp-tslint": "^3.0.0"<% } %> }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From 8c5d52d2c28e8157de5b8c3d109c44cddce50f0e Mon Sep 17 00:00:00 2001 From: Jonathan Ziller Date: Mon, 9 Nov 2015 14:49:15 +0100 Subject: [PATCH 7/8] refactor(): replaced obsolete "module" keyword with "namespace" --- app/templates/src/app-ts/app.ts | 2 +- app/templates/src/app-ts/common/util/lazy.ts | 2 +- app/templates/src/app-ts/core/config/angular.config.ts | 2 +- app/templates/src/app-ts/core/config/config.module.ts | 2 +- app/templates/src/app-ts/core/config/thirdParty.config.ts | 2 +- app/templates/src/app-ts/core/constants/constants.module.ts | 2 +- app/templates/src/app-ts/core/constants/global.constants.ts | 2 +- app/templates/src/app-ts/core/core.module.ts | 2 +- app/templates/src/app-ts/core/router/router.config.ts | 4 ++-- .../src/app-ts/core/router/router.middleware.auth.ts | 2 +- .../src/app-ts/core/router/router.middleware.errorHandling.ts | 2 +- app/templates/src/app-ts/core/router/router.module.ts | 2 +- app/templates/src/app-ts/core/router/router.service.ts | 2 +- app/templates/src/app-ts/core/util/backend.ts | 2 +- app/templates/src/app-ts/core/util/events.ts | 2 +- app/templates/src/app-ts/core/util/logger.ts | 2 +- app/templates/src/app-ts/core/util/util.module.ts | 2 +- app/templates/src/app-ts/home/home.module.ts | 2 +- app/templates/src/app-ts/home/views/home.ts | 2 +- app/templates/src/app-ts/home/views/views.module.ts | 2 +- .../src/app-ts/layout/directives/directives.module.ts | 2 +- .../src/app-ts/layout/directives/header.directive.ts | 2 +- app/templates/src/app-ts/layout/layout.module.ts | 2 +- app/templates/src/app-ts/layout/views/admin.ts | 2 +- app/templates/src/app-ts/layout/views/public.ts | 2 +- app/templates/src/app-ts/layout/views/views.module.ts | 2 +- app/templates/src/assets/config/_config.constant.ts | 2 +- app/templates/test-ts/midway/app.spec.ts | 2 +- templates/typescript/directive.ts | 2 +- templates/typescript/directive.unit.spec.ts | 2 +- templates/typescript/directives.module.ts | 2 +- templates/typescript/filter.ts | 2 +- templates/typescript/filter.unit.spec.ts | 2 +- templates/typescript/filters.module.ts | 2 +- templates/typescript/module.midway.spec.ts | 2 +- templates/typescript/module.ts | 2 +- templates/typescript/service.ts | 2 +- templates/typescript/service.unit.spec.ts | 2 +- templates/typescript/services.module.ts | 2 +- templates/typescript/view.ts | 2 +- templates/typescript/view.unit.spec.ts | 2 +- templates/typescript/views.module.ts | 2 +- 42 files changed, 43 insertions(+), 43 deletions(-) diff --git a/app/templates/src/app-ts/app.ts b/app/templates/src/app-ts/app.ts index f921855..0585653 100644 --- a/app/templates/src/app-ts/app.ts +++ b/app/templates/src/app-ts/app.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %> { +namespace <%= prompts.prefix %> { 'use strict'; angular diff --git a/app/templates/src/app-ts/common/util/lazy.ts b/app/templates/src/app-ts/common/util/lazy.ts index d0c72f1..8f92f06 100644 --- a/app/templates/src/app-ts/common/util/lazy.ts +++ b/app/templates/src/app-ts/common/util/lazy.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.common.util { +namespace <%= prompts.prefix %>.common.util { 'use strict'; export class Lazy { diff --git a/app/templates/src/app-ts/core/config/angular.config.ts b/app/templates/src/app-ts/core/config/angular.config.ts index cfe058b..5252a9c 100644 --- a/app/templates/src/app-ts/core/config/angular.config.ts +++ b/app/templates/src/app-ts/core/config/angular.config.ts @@ -3,7 +3,7 @@ /** * Defines the AngularJS Modules and configures them */ -module <%= prompts.prefix %>.core.config { +namespace <%= prompts.prefix %>.core.config { 'use strict'; /** diff --git a/app/templates/src/app-ts/core/config/config.module.ts b/app/templates/src/app-ts/core/config/config.module.ts index ba93055..49ec8a5 100644 --- a/app/templates/src/app-ts/core/config/config.module.ts +++ b/app/templates/src/app-ts/core/config/config.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.config { +namespace <%= prompts.prefix %>.core.config { 'use strict'; export var Namespace = '<%= prompts.prefix %>.core.config'; diff --git a/app/templates/src/app-ts/core/config/thirdParty.config.ts b/app/templates/src/app-ts/core/config/thirdParty.config.ts index 47e0160..bf36ddb 100644 --- a/app/templates/src/app-ts/core/config/thirdParty.config.ts +++ b/app/templates/src/app-ts/core/config/thirdParty.config.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.config { +namespace <%= prompts.prefix %>.core.config { 'use strict'; var translateConfig = ($translateProvider: ng.translate.ITranslateProvider) => { diff --git a/app/templates/src/app-ts/core/constants/constants.module.ts b/app/templates/src/app-ts/core/constants/constants.module.ts index 5076714..e02ad1e 100644 --- a/app/templates/src/app-ts/core/constants/constants.module.ts +++ b/app/templates/src/app-ts/core/constants/constants.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.constants { +namespace <%= prompts.prefix %>.core.constants { 'use strict'; export var Namespace = '<%= prompts.prefix %>.core.constants'; diff --git a/app/templates/src/app-ts/core/constants/global.constants.ts b/app/templates/src/app-ts/core/constants/global.constants.ts index 96a05f8..b7269d9 100644 --- a/app/templates/src/app-ts/core/constants/global.constants.ts +++ b/app/templates/src/app-ts/core/constants/global.constants.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.constants { +namespace <%= prompts.prefix %>.core.constants { 'use strict'; angular diff --git a/app/templates/src/app-ts/core/core.module.ts b/app/templates/src/app-ts/core/core.module.ts index cd1076b..36c0e37 100644 --- a/app/templates/src/app-ts/core/core.module.ts +++ b/app/templates/src/app-ts/core/core.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core { +namespace <%= prompts.prefix %>.core { 'use strict'; export var Namespace = '<%= prompts.prefix %>.core'; diff --git a/app/templates/src/app-ts/core/router/router.config.ts b/app/templates/src/app-ts/core/router/router.config.ts index 7fccb85..65af96d 100644 --- a/app/templates/src/app-ts/core/router/router.config.ts +++ b/app/templates/src/app-ts/core/router/router.config.ts @@ -3,13 +3,13 @@ /** * Extension for 3rd party type definition file. */ -declare module angular.ui { +declare namespace angular.ui { interface IState { includes?(name: string): void; } } -module <%= prompts.prefix %>.core.router { +namespace <%= prompts.prefix %>.core.router { // this variable is to prevent an issue with the default routes; // if the initial request to the application is for an invalid route diff --git a/app/templates/src/app-ts/core/router/router.middleware.auth.ts b/app/templates/src/app-ts/core/router/router.middleware.auth.ts index 5d744da..d699a63 100644 --- a/app/templates/src/app-ts/core/router/router.middleware.auth.ts +++ b/app/templates/src/app-ts/core/router/router.middleware.auth.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.router { +namespace <%= prompts.prefix %>.core.router { 'use strict'; var run = (logger: util.ILoggerFactory, $timeout: ng.ITimeoutService, routerService: IRouterService) => { diff --git a/app/templates/src/app-ts/core/router/router.middleware.errorHandling.ts b/app/templates/src/app-ts/core/router/router.middleware.errorHandling.ts index 46ab483..5c07fc3 100644 --- a/app/templates/src/app-ts/core/router/router.middleware.errorHandling.ts +++ b/app/templates/src/app-ts/core/router/router.middleware.errorHandling.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.router { +namespace <%= prompts.prefix %>.core.router { 'use strict'; var run = ($q: ng.IQService, routerService: IRouterService, logger: util.ILoggerFactory) => { diff --git a/app/templates/src/app-ts/core/router/router.module.ts b/app/templates/src/app-ts/core/router/router.module.ts index e629682..84e34a7 100644 --- a/app/templates/src/app-ts/core/router/router.module.ts +++ b/app/templates/src/app-ts/core/router/router.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.router { +namespace <%= prompts.prefix %>.core.router { 'use strict'; export var Namespace = '<%= prompts.prefix %>.core.router'; diff --git a/app/templates/src/app-ts/core/router/router.service.ts b/app/templates/src/app-ts/core/router/router.service.ts index a2a8bf4..ac6d3cd 100644 --- a/app/templates/src/app-ts/core/router/router.service.ts +++ b/app/templates/src/app-ts/core/router/router.service.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.router { +namespace <%= prompts.prefix %>.core.router { export interface IRouterService { /** diff --git a/app/templates/src/app-ts/core/util/backend.ts b/app/templates/src/app-ts/core/util/backend.ts index 90991ea..f88bc01 100644 --- a/app/templates/src/app-ts/core/util/backend.ts +++ b/app/templates/src/app-ts/core/util/backend.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.util { +namespace <%= prompts.prefix %>.core.util { 'use strict'; export interface IBackend { diff --git a/app/templates/src/app-ts/core/util/events.ts b/app/templates/src/app-ts/core/util/events.ts index d4616b7..99a8099 100644 --- a/app/templates/src/app-ts/core/util/events.ts +++ b/app/templates/src/app-ts/core/util/events.ts @@ -3,7 +3,7 @@ /** * Event bus. Use this class to register events and trigger them from anywhere. */ -module <%= prompts.prefix %>.core.util { +namespace <%= prompts.prefix %>.core.util { 'use strict'; export interface IAppEvents { diff --git a/app/templates/src/app-ts/core/util/logger.ts b/app/templates/src/app-ts/core/util/logger.ts index d6b35bf..e467e6d 100644 --- a/app/templates/src/app-ts/core/util/logger.ts +++ b/app/templates/src/app-ts/core/util/logger.ts @@ -7,7 +7,7 @@ interface Function { name?: string; } -module <%= prompts.prefix %>.core.util { +namespace <%= prompts.prefix %>.core.util { 'use strict'; export interface ILoggerFactory { diff --git a/app/templates/src/app-ts/core/util/util.module.ts b/app/templates/src/app-ts/core/util/util.module.ts index ebbcdae..dbe1179 100644 --- a/app/templates/src/app-ts/core/util/util.module.ts +++ b/app/templates/src/app-ts/core/util/util.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.core.util { +namespace <%= prompts.prefix %>.core.util { 'use strict'; export var Namespace = '<%= prompts.prefix %>.core.util'; diff --git a/app/templates/src/app-ts/home/home.module.ts b/app/templates/src/app-ts/home/home.module.ts index 6302cff..18e9225 100644 --- a/app/templates/src/app-ts/home/home.module.ts +++ b/app/templates/src/app-ts/home/home.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.home { +namespace <%= prompts.prefix %>.home { 'use strict'; export var Namespace = '<%= prompts.prefix %>.home'; diff --git a/app/templates/src/app-ts/home/views/home.ts b/app/templates/src/app-ts/home/views/home.ts index 4841184..61382d2 100644 --- a/app/templates/src/app-ts/home/views/home.ts +++ b/app/templates/src/app-ts/home/views/home.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.home.views { +namespace <%= prompts.prefix %>.home.views { 'use strict'; var stateConfig = ($stateProvider: ng.ui.IStateProvider) => { diff --git a/app/templates/src/app-ts/home/views/views.module.ts b/app/templates/src/app-ts/home/views/views.module.ts index eeb1c89..919f387 100644 --- a/app/templates/src/app-ts/home/views/views.module.ts +++ b/app/templates/src/app-ts/home/views/views.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.home.views { +namespace <%= prompts.prefix %>.home.views { 'use strict'; export var Namespace = '<%= prompts.prefix %>.home.views'; diff --git a/app/templates/src/app-ts/layout/directives/directives.module.ts b/app/templates/src/app-ts/layout/directives/directives.module.ts index 48cf14b..99bccd5 100644 --- a/app/templates/src/app-ts/layout/directives/directives.module.ts +++ b/app/templates/src/app-ts/layout/directives/directives.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.layout.directives { +namespace <%= prompts.prefix %>.layout.directives { 'use strict'; export var Namespace = '<%= prompts.prefix %>.layout.directives'; diff --git a/app/templates/src/app-ts/layout/directives/header.directive.ts b/app/templates/src/app-ts/layout/directives/header.directive.ts index 6340f1c..85551b4 100644 --- a/app/templates/src/app-ts/layout/directives/header.directive.ts +++ b/app/templates/src/app-ts/layout/directives/header.directive.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.layout.directives { +namespace <%= prompts.prefix %>.layout.directives { 'use strict'; /** diff --git a/app/templates/src/app-ts/layout/layout.module.ts b/app/templates/src/app-ts/layout/layout.module.ts index f7c4a12..62cb42e 100644 --- a/app/templates/src/app-ts/layout/layout.module.ts +++ b/app/templates/src/app-ts/layout/layout.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.layout { +namespace <%= prompts.prefix %>.layout { 'use strict'; export var Namespace = '<%= prompts.prefix %>.layout'; diff --git a/app/templates/src/app-ts/layout/views/admin.ts b/app/templates/src/app-ts/layout/views/admin.ts index 0a0bc78..c86af96 100644 --- a/app/templates/src/app-ts/layout/views/admin.ts +++ b/app/templates/src/app-ts/layout/views/admin.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.layout.views { +namespace <%= prompts.prefix %>.layout.views { 'use strict'; var stateConfig = ($stateProvider: ng.ui.IStateProvider) => { diff --git a/app/templates/src/app-ts/layout/views/public.ts b/app/templates/src/app-ts/layout/views/public.ts index 3977a45..263e5e6 100644 --- a/app/templates/src/app-ts/layout/views/public.ts +++ b/app/templates/src/app-ts/layout/views/public.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.layout.views { +namespace <%= prompts.prefix %>.layout.views { 'use strict'; var stateConfig = ($stateProvider: ng.ui.IStateProvider) => { diff --git a/app/templates/src/app-ts/layout/views/views.module.ts b/app/templates/src/app-ts/layout/views/views.module.ts index 202e9d6..a2054aa 100644 --- a/app/templates/src/app-ts/layout/views/views.module.ts +++ b/app/templates/src/app-ts/layout/views/views.module.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.layout.views { +namespace <%= prompts.prefix %>.layout.views { 'use strict'; export var Namespace = '<%= prompts.prefix %>.layout.views'; diff --git a/app/templates/src/assets/config/_config.constant.ts b/app/templates/src/assets/config/_config.constant.ts index 571d44f..ffc1af2 100644 --- a/app/templates/src/assets/config/_config.constant.ts +++ b/app/templates/src/assets/config/_config.constant.ts @@ -3,7 +3,7 @@ */ /// -module my.core.constants { +namespace my.core.constants { 'use strict'; export interface IAppConfig { diff --git a/app/templates/test-ts/midway/app.spec.ts b/app/templates/test-ts/midway/app.spec.ts index b65ce2c..a1888d9 100644 --- a/app/templates/test-ts/midway/app.spec.ts +++ b/app/templates/test-ts/midway/app.spec.ts @@ -1,6 +1,6 @@ /// -module <%= prompts.prefix %>.test { +namespace <%= prompts.prefix %>.test { 'use strict'; describe('Midway: Testing Modules', () => { diff --git a/templates/typescript/directive.ts b/templates/typescript/directive.ts index 8789484..2f914f5 100644 --- a/templates/typescript/directive.ts +++ b/templates/typescript/directive.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %> { +namespace <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict';<% if (hasTemplate) { %> const templateUrl = '<%= templateUrl %>';<% } %> diff --git a/templates/typescript/directive.unit.spec.ts b/templates/typescript/directive.unit.spec.ts index a913596..0d69cd6 100644 --- a/templates/typescript/directive.unit.spec.ts +++ b/templates/typescript/directive.unit.spec.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %>.test { +namespace <%= prefix %>.<%= module %>.<%= $namespace %>.test { 'use strict'; describe(`Unit: ${Namespace}.<%= classedName %>Directive`, () => { diff --git a/templates/typescript/directives.module.ts b/templates/typescript/directives.module.ts index 3681fd0..a44e0c3 100644 --- a/templates/typescript/directives.module.ts +++ b/templates/typescript/directives.module.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %> { +namespace <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; export const Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; diff --git a/templates/typescript/filter.ts b/templates/typescript/filter.ts index 0fb9c1b..01f040a 100644 --- a/templates/typescript/filter.ts +++ b/templates/typescript/filter.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %> { +namespace <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; export interface I<%= classedName %> { diff --git a/templates/typescript/filter.unit.spec.ts b/templates/typescript/filter.unit.spec.ts index 281d218..9b6a7dc 100644 --- a/templates/typescript/filter.unit.spec.ts +++ b/templates/typescript/filter.unit.spec.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %>.test { +namespace <%= prefix %>.<%= module %>.<%= $namespace %>.test { 'use strict'; describe(`Unit: ${Namespace}.<%= classedName %>`, () => { diff --git a/templates/typescript/filters.module.ts b/templates/typescript/filters.module.ts index 59d0c05..911a2ef 100644 --- a/templates/typescript/filters.module.ts +++ b/templates/typescript/filters.module.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %> { +namespace <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; export const Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; diff --git a/templates/typescript/module.midway.spec.ts b/templates/typescript/module.midway.spec.ts index a8ac8bc..5b14852 100644 --- a/templates/typescript/module.midway.spec.ts +++ b/templates/typescript/module.midway.spec.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= cameledName %>.test { +namespace <%= prefix %>.<%= cameledName %>.test { 'use strict'; describe(`Midway: ${Namespace}.`, () => { diff --git a/templates/typescript/module.ts b/templates/typescript/module.ts index 9a82914..2695eb3 100644 --- a/templates/typescript/module.ts +++ b/templates/typescript/module.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= cameledName %> { +namespace <%= prefix %>.<%= cameledName %> { 'use strict'; export const Namespace = '<%= prefix %>.<%= cameledName %>'; diff --git a/templates/typescript/service.ts b/templates/typescript/service.ts index af0e48f..2718831 100644 --- a/templates/typescript/service.ts +++ b/templates/typescript/service.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %> { +namespace <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; export interface I<%= classedName %> { diff --git a/templates/typescript/service.unit.spec.ts b/templates/typescript/service.unit.spec.ts index 55b8d36..8527ff9 100644 --- a/templates/typescript/service.unit.spec.ts +++ b/templates/typescript/service.unit.spec.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %>.test { +namespace <%= prefix %>.<%= module %>.<%= $namespace %>.test { 'use strict'; describe(`Unit: ${Namespace}.<%= classedName %>`, () => { diff --git a/templates/typescript/services.module.ts b/templates/typescript/services.module.ts index 7dbe514..054ff33 100644 --- a/templates/typescript/services.module.ts +++ b/templates/typescript/services.module.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %> { +namespace <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; export const Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; diff --git a/templates/typescript/view.ts b/templates/typescript/view.ts index 65a7f37..0d24f80 100644 --- a/templates/typescript/view.ts +++ b/templates/typescript/view.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %> { +namespace <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; const stateConfig = ($stateProvider: ng.ui.IStateProvider) => { diff --git a/templates/typescript/view.unit.spec.ts b/templates/typescript/view.unit.spec.ts index 22484d4..642f331 100644 --- a/templates/typescript/view.unit.spec.ts +++ b/templates/typescript/view.unit.spec.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %>.test { +namespace <%= prefix %>.<%= module %>.<%= $namespace %>.test { 'use strict'; describe(`Unit: ${Namespace}.<%= classedName %>Controller`, () => { diff --git a/templates/typescript/views.module.ts b/templates/typescript/views.module.ts index ff618aa..d4ae56d 100644 --- a/templates/typescript/views.module.ts +++ b/templates/typescript/views.module.ts @@ -1,6 +1,6 @@ /// -module <%= prefix %>.<%= module %>.<%= $namespace %> { +namespace <%= prefix %>.<%= module %>.<%= $namespace %> { 'use strict'; export const Namespace = '<%= prefix %>.<%= module %>.<%= $namespace %>'; From af9de8ff8bed8116d8152e6e272c53f49ee42528 Mon Sep 17 00:00:00 2001 From: hirsch88 Date: Thu, 12 Nov 2015 10:24:35 +0100 Subject: [PATCH 8/8] docs(nom): adds version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1b2d7d3..91c6ff4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-hirsch", - "version": "1.0.1", + "version": "1.0.2", "description": "Yeoman generator for large module-based AngularJS applications with the option to use typescript", "license": "MIT", "main": "app/index.js",