├── .npmrc ├── generators ├── app │ ├── templates │ │ ├── _nvmrc │ │ ├── _npmrc │ │ ├── _eslintignore │ │ ├── typings │ │ │ ├── tsd.d.ts │ │ │ ├── main │ │ │ │ ├── ambient │ │ │ │ │ ├── ng2 │ │ │ │ │ │ └── ng2.d.ts │ │ │ │ │ ├── zone.js │ │ │ │ │ │ └── zone.js.d.ts │ │ │ │ │ ├── react-dom │ │ │ │ │ │ └── index.d.ts │ │ │ │ │ └── hammerjs │ │ │ │ │ │ └── hammerjs.d.ts │ │ │ │ └── definitions │ │ │ │ │ └── es6-promise │ │ │ │ │ └── es6-promise.d.ts │ │ │ ├── browser │ │ │ │ ├── ambient │ │ │ │ │ ├── ng2 │ │ │ │ │ │ └── ng2.d.ts │ │ │ │ │ ├── zone.js │ │ │ │ │ │ └── zone.js.d.ts │ │ │ │ │ ├── react-dom │ │ │ │ │ │ └── index.d.ts │ │ │ │ │ ├── hammerjs │ │ │ │ │ │ └── hammerjs.d.ts │ │ │ │ │ └── webpack │ │ │ │ │ │ └── webpack.d.ts │ │ │ │ └── definitions │ │ │ │ │ └── es6-promise │ │ │ │ │ └── es6-promise.d.ts │ │ │ ├── main.d.ts │ │ │ ├── browser.d.ts │ │ │ └── react │ │ │ │ └── react-dom.d.ts │ │ ├── _travis.yml │ │ ├── docker-compose.yml │ │ ├── json-server │ │ │ └── db.json │ │ ├── _tsconfig.json │ │ ├── typedoc.json │ │ ├── typings.json │ │ ├── _editorconfig │ │ ├── _gitignore │ │ ├── protractor.conf.js │ │ ├── tslint.json │ │ ├── karma-shim.js │ │ ├── _jsbeautifyrc │ │ ├── karma.conf.js │ │ ├── _eslintrc.json │ │ ├── _package.json │ │ └── _README.md │ └── index.js ├── component │ ├── templates │ │ ├── _component.scss │ │ ├── ngux │ │ │ └── _component.js │ │ ├── _component.html │ │ ├── _component.ngux │ │ ├── _component.ts │ │ └── _component.spec.ts │ └── index.js ├── target │ ├── templates │ │ ├── public │ │ │ ├── service-worker.js │ │ │ ├── img │ │ │ │ ├── favicon.ico │ │ │ │ └── shield-with-beta.png │ │ │ ├── index.html │ │ │ └── index.template.html │ │ ├── app │ │ │ ├── components │ │ │ │ ├── home │ │ │ │ │ ├── template.html │ │ │ │ │ ├── style.scss │ │ │ │ │ ├── e2e.js │ │ │ │ │ ├── index.ts │ │ │ │ │ └── spec.ts │ │ │ │ └── about │ │ │ │ │ ├── style.scss │ │ │ │ │ ├── template.html │ │ │ │ │ ├── index.async.ts │ │ │ │ │ ├── spec.ts │ │ │ │ │ └── components │ │ │ │ │ └── ng-react │ │ │ │ │ └── index.tsx │ │ │ ├── services │ │ │ │ └── api │ │ │ │ │ ├── index.ts │ │ │ │ │ └── spec.ts │ │ │ ├── routes.ts │ │ │ ├── template.html │ │ │ ├── style.scss │ │ │ ├── index.ts │ │ │ ├── e2e.js │ │ │ └── root.spec.ts │ │ ├── style │ │ │ └── app.scss │ │ ├── vendor.ts │ │ ├── assert │ │ │ └── index.ts │ │ ├── bootstrap.ts │ │ └── shims │ │ │ └── shims_for_IE.js │ └── index.js ├── ngux │ ├── templates │ │ ├── _component.ngux │ │ ├── _component.ts │ │ └── _component.spec.ts │ └── index.js ├── interface │ ├── templates │ │ └── _interface.ts │ └── index.js ├── service │ ├── templates │ │ ├── _service.ts │ │ └── _service.spec.ts │ └── index.js ├── pipe │ ├── templates │ │ ├── _pipe.ts │ │ └── _pipe.spec.ts │ └── index.js ├── directive │ ├── templates │ │ ├── _directive.ts │ │ └── _directive.spec.ts │ └── index.js ├── validators.js └── componentGenerator.js ├── .eslintignore ├── set_env.sh ├── test └── mocha │ ├── target.spec.js │ ├── componentGenerator.spec.js │ ├── validators.spec.js │ ├── component.spec.js │ ├── app.spec.js │ └── testHelper.js ├── .gitignore ├── .travis.yml ├── LICENSE ├── gulp_tasks ├── tasks │ ├── changelog.js │ └── release.js └── common │ ├── constants.js │ ├── helper.js │ └── changelog-script.js ├── Dockerfile ├── .jsbeautifyrc ├── docs └── yeoman.md ├── libs ├── mixinFile.js ├── mixinNotifier.js ├── mixinLodash.js ├── mixinInspector.js └── mixinBeautify.js ├── package.json ├── .eslintrc.json └── README.md /.npmrc: -------------------------------------------------------------------------------- 1 | loglevel=error -------------------------------------------------------------------------------- /generators/app/templates/_nvmrc: -------------------------------------------------------------------------------- 1 | v5.6.0 -------------------------------------------------------------------------------- /generators/app/templates/_npmrc: -------------------------------------------------------------------------------- 1 | loglevel=error -------------------------------------------------------------------------------- /generators/component/templates/_component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/component/templates/ngux/_component.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/component/templates/_component.html: -------------------------------------------------------------------------------- 1 |
<%=componentname%>
2 | -------------------------------------------------------------------------------- /generators/target/templates/public/service-worker.js: -------------------------------------------------------------------------------- 1 | // This file is intentionally without code. -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/** 2 | bower_components/** 3 | dist/** 4 | coverage/** 5 | generators/*/templates/_** -------------------------------------------------------------------------------- /generators/target/templates/app/components/home/template.html: -------------------------------------------------------------------------------- 1 |

2 | Home Works, oh yeah baby! 3 |

4 | 5 | -------------------------------------------------------------------------------- /generators/app/templates/_eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/** 2 | bower_components/** 3 | dist/** 4 | coverage/** 5 | spec-bundle.js -------------------------------------------------------------------------------- /generators/app/templates/typings/tsd.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /generators/target/templates/app/components/about/style.scss: -------------------------------------------------------------------------------- 1 | * { 2 | color: #f87c08; 3 | } 4 | 5 | .about { 6 | height: 87px; 7 | } -------------------------------------------------------------------------------- /set_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | export DOCKER_HOST_IP=`netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}'` 6 | 7 | "$@" -------------------------------------------------------------------------------- /generators/target/templates/public/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmelion/generator-ng2-webpack/HEAD/generators/target/templates/public/img/favicon.ico -------------------------------------------------------------------------------- /generators/target/templates/app/components/about/template.html: -------------------------------------------------------------------------------- 1 |
2 |
About
3 |
4 |
5 | 6 | -------------------------------------------------------------------------------- /generators/target/templates/app/components/home/style.scss: -------------------------------------------------------------------------------- 1 | // component styles are encapsulated and only applied to their components 2 | * { 3 | color: #FFEF00; 4 | } 5 | -------------------------------------------------------------------------------- /generators/ngux/templates/_component.ngux: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /generators/component/templates/_component.ngux: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /generators/interface/templates/_interface.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | 3 | /* beautify ignore:end */ 4 | export interface <%=interfacenameClass%> { 5 | name: string; 6 | } -------------------------------------------------------------------------------- /generators/target/templates/public/img/shield-with-beta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmelion/generator-ng2-webpack/HEAD/generators/target/templates/public/img/shield-with-beta.png -------------------------------------------------------------------------------- /generators/target/templates/app/services/api/index.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | 3 | @Injectable() 4 | export class Api { 5 | title: string = 'Angular 2'; 6 | } 7 | -------------------------------------------------------------------------------- /generators/service/templates/_service.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {Injectable} from '@angular/core'; 3 | /* beautify ignore:end */ 4 | 5 | @Injectable() 6 | export class <%=servicenameClass%> { 7 | 8 | } -------------------------------------------------------------------------------- /generators/target/templates/style/app.scss: -------------------------------------------------------------------------------- 1 | // styles in src/style directory are applied to the whole page 2 | 3 | body { 4 | background: #0147A7; 5 | color: #fff; 6 | margin: 0; 7 | padding: 0; 8 | } 9 | a { 10 | color: #03A9F4; 11 | } 12 | -------------------------------------------------------------------------------- /generators/app/templates/_travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - v5 5 | 6 | cache: 7 | directories: 8 | - node_modules 9 | - bower_components 10 | 11 | after_success: 12 | - cat ./coverage/unit/lcov.info | ./node_modules/coveralls/bin/coveralls.js --verbose 13 | -------------------------------------------------------------------------------- /generators/target/templates/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ng2-webpack 7 | 8 | 9 | 10 | Loading... 11 | 12 | -------------------------------------------------------------------------------- /generators/target/templates/public/index.template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ng2-webpack 7 | 8 | 9 | 10 | Loading... 11 | 12 | -------------------------------------------------------------------------------- /generators/pipe/templates/_pipe.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {Pipe, PipeTransform} from '@angular/core'; 3 | /* beautify ignore:end */ 4 | 5 | @Pipe({ name: '<%=pipename%>' }) 6 | export class <%=pipenameClass%>Pipe implements PipeTransform { 7 | transform(value: string, ?args: string[]): any { 8 | return value; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /generators/ngux/templates/_component.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {Component} from '@angular/core'; 3 | require('./ngux/<%=componentname%>.js'); 4 | /* beautify ignore:end */ 5 | 6 | @Component({ 7 | selector: '<%=componentnameClass%>', 8 | template: require('./<%=componentname%>.ngux') 9 | }) 10 | export class <%=componentnameClass%> { 11 | 12 | } -------------------------------------------------------------------------------- /generators/app/templates/docker-compose.yml: -------------------------------------------------------------------------------- 1 | web: 2 | image: cmelion/generator-ng2-webpack:latest 3 | volumes: 4 | - ./README.md:/home/yeoman/client/README.md 5 | - ./package.json:/home/yeoman/client/package.json 6 | - ./src:/home/yeoman/client/src 7 | - ./json-server:/home/yeoman/client/json-server 8 | ports: 9 | - "2368:2368" 10 | - "3000:3000" -------------------------------------------------------------------------------- /generators/component/templates/_component.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {Component} from '@angular/core'; 3 | /* beautify ignore:end */ 4 | 5 | @Component({ 6 | selector: '<%=componentnameFile%>', 7 | styles: [require('./style.scss').toString()], 8 | template: require('./template.html') 9 | }) 10 | export class <%=componentnameClass%>Component { 11 | 12 | } -------------------------------------------------------------------------------- /generators/target/templates/app/routes.ts: -------------------------------------------------------------------------------- 1 | // src/app/routes.ts 2 | import {Home} from './components/home'; // ./components/home/index.ts 3 | 4 | export default [ 5 | {path: '/', component: Home, name: 'Home'}, 6 | // Async load a component using Webpack's require with es6-promise-loader 7 | {path: '/about', loader: () => require('./components/about')('About'), name: 'About'} 8 | ]; 9 | -------------------------------------------------------------------------------- /generators/directive/templates/_directive.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {Directive, ElementRef, Renderer, Input} from 'angular2/core'; 3 | /* beautify ignore:end */ 4 | 5 | @Directive({ 6 | selector: '[<%=directivenameFile%>]' 7 | }) 8 | export class <%=directivenameClass%> { 9 | 10 | constructor(private el: ElementRef, private renderer: Renderer) { 11 | 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /generators/app/templates/json-server/db.json: -------------------------------------------------------------------------------- 1 | { 2 | "items": [ 3 | { 4 | "id": 3, 5 | "name": "Item 3", 6 | "description": "This is a lovely item" 7 | }, 8 | { 9 | "id": 5, 10 | "name": "Item 2", 11 | "description": "Item 2 description" 12 | }, 13 | { 14 | "name": "test", 15 | "description": "test description", 16 | "id": 6 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /generators/app/templates/_tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs", 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "sourceMap": true, 8 | "moduleResolution": "node", 9 | "jsx": "react", 10 | "noEmitHelpers": true 11 | }, 12 | "exclude": [ 13 | "node_modules" 14 | ], 15 | "compileOnSave": false, 16 | "buildOnSave": false 17 | } 18 | -------------------------------------------------------------------------------- /generators/target/templates/app/services/api/spec.ts: -------------------------------------------------------------------------------- 1 | import { 2 | it, 3 | fit, 4 | describe, 5 | ddescribe, 6 | expect, 7 | inject, 8 | beforeEachProviders 9 | } from '@angular/core/testing'; 10 | import {Api} from './index'; 11 | 12 | describe('Api Service', () => { 13 | 14 | beforeEachProviders(() => [Api]); 15 | 16 | it('should ...', inject([Api], (api:Api) => { 17 | expect(api.title).toBe('Angular 2'); 18 | })); 19 | 20 | }); 21 | -------------------------------------------------------------------------------- /generators/directive/templates/_directive.spec.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {it, beforeEachProviders} from 'angular2/testing'; 3 | import {<%=directivenameClass %>} from './<%=directivenameFile%>.directive'; 4 | /* beautify ignore:end */ 5 | 6 | describe('Directive: <%=directivenameClass%>', () => { 7 | 8 | beforeEachProviders(() => []); 9 | 10 | it('should have a url', () => { 11 | expect(true).toEqual(true); 12 | }); 13 | 14 | }); -------------------------------------------------------------------------------- /generators/app/templates/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "modules", 3 | "out": "doc", 4 | "theme": "default", 5 | "ignoreCompilerErrors": "true", 6 | "experimentalDecorators": "true", 7 | "emitDecoratorMetadata": "true", 8 | "target": "ES5", 9 | "moduleResolution": "node", 10 | "preserveConstEnums": "true", 11 | "stripInternal": "true", 12 | "suppressExcessPropertyErrors": "true", 13 | "suppressImplicitAnyIndexErrors": "true", 14 | "module": "commonjs" 15 | } -------------------------------------------------------------------------------- /generators/app/templates/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientDevDependencies": { 3 | "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#dd638012d63e069f2c99d06ef4dcc9616a943ee4" 4 | }, 5 | "ambientDependencies": { 6 | "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2", 7 | "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#aee0039a2d6686ec78352125010ebb38a7a7d743" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /generators/target/templates/app/components/home/e2e.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('Home', function() { 4 | 5 | beforeEach(function() { 6 | browser.get('/'); 7 | }); 8 | 9 | it('should have ', function() { 10 | /* eslint-disable no-undef */ 11 | var home = element(by.css('app home')); 12 | /* eslint-enable no-undef */ 13 | expect(home.isPresent()).toEqual(true); 14 | expect(home.getText()).toEqual('Home Works!'); 15 | }); 16 | 17 | }); 18 | -------------------------------------------------------------------------------- /generators/target/templates/vendor.ts: -------------------------------------------------------------------------------- 1 | // Polyfills 2 | // fixes for non ES6 browsers (IE, safari, ...) 3 | // Polyfills 4 | import 'es6-shim'; 5 | import 'reflect-metadata'; 6 | require('zone.js/dist/zone'); 7 | 8 | 9 | // Angular 2 10 | import '@angular/platform-browser'; 11 | import '@angular/core'; 12 | import '@angular/router-deprecated'; 13 | import '@angular/http'; 14 | 15 | // RxJS 16 | import 'rxjs'; 17 | 18 | // Other vendors for example jQuery, Lodash or Bootstrap 19 | // You can import js, ts, css, sass, ... 20 | -------------------------------------------------------------------------------- /generators/service/templates/_service.spec.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {it, inject, beforeEachProviders} from '@angular/core/testing'; 3 | import {<%=servicenameClass%>} from './index'; 4 | /* beautify ignore:end */ 5 | 6 | describe('Service: <%=servicenameClass%>' , () => { 7 | 8 | beforeEachProviders(() => [<%=servicenameClass%>]); 9 | 10 | it('should be defined', inject([<%=servicenameClass%>], (service: <%=servicenameClass%>) => { 11 | expect(service).toBeDefined(); 12 | })); 13 | 14 | }); -------------------------------------------------------------------------------- /generators/target/templates/app/components/home/index.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {FORM_DIRECTIVES} from '@angular/common'; 3 | 4 | @Component({ 5 | selector: 'home', 6 | directives: [...FORM_DIRECTIVES], 7 | pipes: [], 8 | styles: [require('./style.scss')], 9 | template: require('./template.html') 10 | }) 11 | 12 | export class Home implements OnInit { 13 | 14 | constructor() { 15 | // Do stuff 16 | } 17 | 18 | ngOnInit() { 19 | console.log('Hello Home'); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /generators/target/templates/app/template.html: -------------------------------------------------------------------------------- 1 |
2 | 6 |
7 |
8 |

Hello from {{api.title}} !

9 | 10 | 11 | 12 | 13 | 14 |
15 | 18 | -------------------------------------------------------------------------------- /generators/target/templates/app/components/about/index.async.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {NGReact} from './components/ng-react'; 3 | 4 | @Component({ 5 | selector: 'about', 6 | template: require('./template.html'), 7 | styles: [require('./style.scss')], 8 | providers: [], 9 | directives: [], 10 | pipes: [] 11 | }) 12 | 13 | export class About implements OnInit { 14 | 15 | constructor() { 16 | // Do stuff 17 | } 18 | 19 | ngOnInit() { 20 | NGReact.initialize('Hello From React!'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /generators/pipe/templates/_pipe.spec.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {it} from '@angular/core/testing'; 3 | import {<%=pipenameClass %>Pipe} from './index'; 4 | /* beautify ignore:end */ 5 | 6 | describe('Pipe: <%=pipenameClass%>Pipe', () => { 7 | let pipe: <%=pipenameClass %>Pipe; 8 | 9 | beforeEach(() => { 10 | pipe = new <%=pipenameClass %>Pipe(); 11 | }); 12 | 13 | it('should be defined', () => { 14 | expect(pipe).toBeDefined(); 15 | }); 16 | 17 | it('transforms abc to abc', () => { 18 | expect(pipe.transform('abc')).toEqual('abc'); 19 | }); 20 | 21 | }); -------------------------------------------------------------------------------- /test/mocha/target.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | //var path = require('path'); 3 | //var assert = require('yeoman-assert'); 4 | //var expect = require('chai').expect; 5 | //var helpers = require('yeoman-test'); 6 | var testHelper = require('./testHelper'); 7 | 8 | //var generatorFullname = testHelper.mixins.getGeneratorFullname(); // generator-ng2-webpack 9 | var generatorShortname = testHelper.mixins.getGeneratorShortname(); // ng2-webpack 10 | 11 | describe(generatorShortname + ':target', function() { 12 | 13 | describe('with invalid target', function() { 14 | 15 | }); 16 | 17 | }); 18 | -------------------------------------------------------------------------------- /generators/app/templates/_editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # Matches multiple files with brace expansion notation 12 | # Set default charset 13 | [*.{js,css,scss,html}] 14 | charset = utf-8 15 | 16 | # 4 space indentation 17 | [*.{js,css,scss,html}] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | # Matches the exact files either package.json or .travis.yml 22 | [{package.json,.travis.yml,bower.json}] 23 | indent_style = space 24 | indent_size = 2 25 | -------------------------------------------------------------------------------- /generators/app/templates/typings/main/ambient/ng2/ng2.d.ts: -------------------------------------------------------------------------------- 1 | // Compiled using typings@0.6.8 2 | // Source: https://raw.githubusercontent.com/gdi2290/typings-ng2/32998ff5584c0eab0cd9dc7704abb1c5c450701c/ng2.d.ts 3 | declare var assert: any; 4 | 5 | 6 | interface BrowserNodeGlobal { 7 | Object: typeof Object; 8 | Array: typeof Array; 9 | Map: typeof Map; 10 | Set: typeof Set; 11 | Date: typeof Date; 12 | RegExp: typeof RegExp; 13 | JSON: typeof JSON; 14 | Math: typeof Math; 15 | assert(condition: any): void; 16 | Reflect: any; 17 | zone: Zone; 18 | getAngularTestability: Function; 19 | getAllAngularTestabilities: Function; 20 | setTimeout: Function; 21 | clearTimeout: Function; 22 | setInterval: Function; 23 | clearInterval: Function; 24 | } -------------------------------------------------------------------------------- /generators/target/templates/app/style.scss: -------------------------------------------------------------------------------- 1 | // styles applied on :host are applied on the current component, "app" in this case 2 | :host { 3 | display: flex; 4 | flex-direction:column; 5 | height: 100vh; 6 | } 7 | 8 | header { 9 | background-color: #4E274C; 10 | padding: 16px; 11 | position: fixed; 12 | top: 0; 13 | left: 0; 14 | width: 100%; 15 | box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.5); 16 | } 17 | 18 | main { 19 | padding: 1em; 20 | font-family: Arial, Helvetica, sans-serif; 21 | text-align: center; 22 | margin-top: 50px; 23 | flex: 1 0 auto; 24 | } 25 | 26 | footer { 27 | text-align: center; 28 | font-size: 0.8em; 29 | background-color: #2C102B; 30 | } 31 | 32 | .shield { 33 | width: 750px; 34 | height: 450px; 35 | } 36 | -------------------------------------------------------------------------------- /generators/app/templates/typings/browser/ambient/ng2/ng2.d.ts: -------------------------------------------------------------------------------- 1 | // Compiled using typings@0.6.8 2 | // Source: https://raw.githubusercontent.com/gdi2290/typings-ng2/32998ff5584c0eab0cd9dc7704abb1c5c450701c/ng2.d.ts 3 | declare var assert: any; 4 | 5 | 6 | interface BrowserNodeGlobal { 7 | Object: typeof Object; 8 | Array: typeof Array; 9 | Map: typeof Map; 10 | Set: typeof Set; 11 | Date: typeof Date; 12 | RegExp: typeof RegExp; 13 | JSON: typeof JSON; 14 | Math: typeof Math; 15 | assert(condition: any): void; 16 | Reflect: any; 17 | zone: Zone; 18 | getAngularTestability: Function; 19 | getAllAngularTestabilities: Function; 20 | setTimeout: Function; 21 | clearTimeout: Function; 22 | setInterval: Function; 23 | clearInterval: Function; 24 | } -------------------------------------------------------------------------------- /generators/component/templates/_component.spec.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {it, inject, beforeEachProviders} from '@angular/core/testing'; 3 | import {TestComponentBuilder} from '@angular/compiler/testing'; 4 | import {<%=componentnameClass%>Component} from './index'; 5 | import {Assert} from '<%=assertPath%>'; 6 | /* beautify ignore:end */ 7 | 8 | describe('Component: <%=componentnameClass%>Component', () => { 9 | 10 | let providers = []; 11 | let assert = new Assert<<%=componentnameClass%>Component>(<%=componentnameClass%>Component, providers); 12 | 13 | assert.it('should be defined', (component, element, fixture) => { 14 | fixture.detectChanges(); 15 | 16 | expect(component).toBeDefined(); 17 | expect(element).toBeDefined(); 18 | }); 19 | }); -------------------------------------------------------------------------------- /generators/validators.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var chalk = require('chalk'); 3 | var _ = require('lodash'); 4 | var mixinLodash = require('../libs/mixinLodash'); 5 | var utils = {}; 6 | mixinLodash.extend(utils); 7 | 8 | var validateTarget = function(clientTargets) { 9 | 10 | return function(value) { 11 | 12 | if (_.isEmpty(value) || value[0] === '/' || value[0] === '\\') { 13 | return chalk.red('Please enter a non empty name'); 14 | } 15 | value = utils.mixins.dasherize(value); 16 | if (_.contains(clientTargets, value)) { 17 | return chalk.red('The target name ') + chalk.yellow(value) + chalk.red(' already exists'); 18 | } 19 | return true; 20 | }; 21 | }; 22 | 23 | module.exports = { 24 | validateTarget: validateTarget 25 | }; 26 | -------------------------------------------------------------------------------- /generators/app/templates/typings/main.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | -------------------------------------------------------------------------------- /generators/target/templates/app/components/about/spec.ts: -------------------------------------------------------------------------------- 1 | import { 2 | it, 3 | inject, 4 | describe, 5 | beforeEachProviders 6 | } from '@angular/core/testing'; 7 | 8 | import {Component, provide} from '@angular/core'; 9 | 10 | // Load the implementations that should be tested 11 | import {About} from './index.async'; 12 | import {NGReact} from './components/ng-react'; 13 | 14 | describe('About', () => { 15 | beforeAll(() => { 16 | spyOn(NGReact,'initialize'); 17 | }); 18 | 19 | // provide our implementations or mocks to the dependency injector 20 | beforeEachProviders(() => [ 21 | About 22 | ]); 23 | 24 | it('should log ngOnInit', inject([About], (about) => { 25 | about.ngOnInit(); 26 | expect(NGReact.initialize).toHaveBeenCalled(); 27 | })); 28 | 29 | }); -------------------------------------------------------------------------------- /generators/app/templates/typings/browser.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | -------------------------------------------------------------------------------- /generators/target/templates/app/index.ts: -------------------------------------------------------------------------------- 1 | /// src/app/index.ts 2 | import {Component} from '@angular/core'; 3 | import {RouteConfig, ROUTER_DIRECTIVES} from '@angular/router-deprecated'; 4 | import {FORM_PROVIDERS} from '@angular/common'; 5 | 6 | import '../style/app.scss'; 7 | 8 | import {Api} from './services/api'; // ./services/api/index.ts 9 | import routes from './routes'; 10 | 11 | /* 12 | * App Component 13 | * Top Level Component 14 | */ 15 | @Component({ 16 | selector: 'app', // 17 | providers: [...FORM_PROVIDERS, Api], 18 | directives: [...ROUTER_DIRECTIVES], 19 | pipes: [], 20 | styles: [require('./style.scss')], 21 | template: require('./template.html') 22 | }) 23 | 24 | @RouteConfig(routes) 25 | 26 | export class App { 27 | url: string = '//github.com/cmelion/generator-ng2-webpack'; 28 | 29 | constructor(public api: Api) { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage/ 15 | # Reports directory used by tools like protractor 16 | reports/ 17 | 18 | # Build 19 | build/ 20 | dist/ 21 | .tmp 22 | .cache/ 23 | 24 | # Vendor files 25 | node_modules 26 | bower_components 27 | vendor 28 | 29 | # Temp directories 30 | temp/ 31 | test/tmp 32 | test/temp 33 | 34 | # Other temp 35 | .sass-cache 36 | .grunt 37 | 38 | # Shippable directory 39 | shippable/ 40 | 41 | # OS generated files 42 | .DS_Store 43 | .DS_Store? 44 | ._* 45 | .Spotlight-V100 46 | .Trashes 47 | ehthumbs.db 48 | Thumbs.db 49 | 50 | # Visual Studio Code 51 | .vscode/ 52 | 53 | # Fuse 54 | .build/ 55 | 56 | # Changelog 57 | CHANGELOG.md 58 | 59 | #ide 60 | .idea 61 | workspace.xml -------------------------------------------------------------------------------- /generators/app/templates/typings/browser/ambient/zone.js/zone.js.d.ts: -------------------------------------------------------------------------------- 1 | // Compiled using typings@0.6.8 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c393f8974d44840a6c9cc6d5b5c0188a8f05143d/zone.js/zone.js.d.ts 3 | // Type definitions for Zone.js 4 | // Project: https://github.com/angular/zone.js 5 | // Definitions by: angular team 6 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 7 | 8 | 9 | declare class Zone { 10 | constructor(parentZone: Zone, data: any); 11 | 12 | fork(locals?: {[key: string]: any}): Zone; 13 | bind(fn: Function, skipEnqueue?: boolean): void; 14 | bindOnce(fn: Function): any; 15 | run(fn: Function, applyTo?: any, applyWith?: any): void; 16 | isRootZone(): boolean; 17 | 18 | static bindPromiseFn Promise>(fn: T): T; 19 | 20 | static longStackTraceZone: {[key: string]: any}; 21 | } -------------------------------------------------------------------------------- /generators/app/templates/typings/main/ambient/zone.js/zone.js.d.ts: -------------------------------------------------------------------------------- 1 | // Compiled using typings@0.6.8 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c393f8974d44840a6c9cc6d5b5c0188a8f05143d/zone.js/zone.js.d.ts 3 | // Type definitions for Zone.js 4 | // Project: https://github.com/angular/zone.js 5 | // Definitions by: angular team 6 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 7 | 8 | 9 | declare class Zone { 10 | constructor(parentZone: Zone, data: any); 11 | 12 | fork(locals?: {[key: string]: any}): Zone; 13 | bind(fn: Function, skipEnqueue?: boolean): void; 14 | bindOnce(fn: Function): any; 15 | run(fn: Function, applyTo?: any, applyWith?: any): void; 16 | isRootZone(): boolean; 17 | 18 | static bindPromiseFn Promise>(fn: T): T; 19 | 20 | static longStackTraceZone: {[key: string]: any}; 21 | } -------------------------------------------------------------------------------- /generators/target/templates/app/components/home/spec.ts: -------------------------------------------------------------------------------- 1 | import { 2 | it, 3 | fit, 4 | inject, 5 | describe, 6 | ddescribe, 7 | beforeEachProviders, 8 | } from '@angular/core/testing'; 9 | 10 | // Load the implementations that should be tested 11 | import {Home} from './index'; 12 | 13 | // Use the assert helper to get a reference to the component, element and fixture 14 | import {Assert} from './../../../assert'; 15 | 16 | describe('Home', () => { 17 | // Provide our implementations or mocks to the dependency injector 18 | let providers = []; 19 | 20 | // Set up the helper 21 | let assert = new Assert(Home, providers); 22 | 23 | assert.it('should log ngOnInit', (component, element, fixture) => { 24 | spyOn(console, 'log'); 25 | expect(console.log).not.toHaveBeenCalled(); 26 | 27 | component.ngOnInit(); 28 | expect(console.log).toHaveBeenCalledWith('Hello Home'); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /generators/ngux/templates/_component.spec.ts: -------------------------------------------------------------------------------- 1 | /* beautify ignore:start */ 2 | import {it, inject, beforeEachProviders} from '@angular/core/testing'; 3 | import {TestComponentBuilder} from '@angular/compiler/testing'; 4 | import {<%=componentnameClass %>} from './<%=componentname%>'; 5 | /* beautify ignore:end */ 6 | 7 | describe('Component: <%=componentnameClass%>', () => { 8 | 9 | beforeEachProviders(() => []); 10 | 11 | it('should be defined', inject([TestComponentBuilder], (tcb) => { 12 | return tcb.createAsync(<%=componentnameClass %>) 13 | .then((fixture) => { 14 | let element = fixture.debugElement.nativeElement; 15 | let cmpInstance = <<%=componentnameClass %>>fixture.debugElement.componentInstance; 16 | fixture.detectChanges(); 17 | expect(cmpInstance).toBeDefined(); 18 | expect(element).toBeDefined(); 19 | }); 20 | })); 21 | 22 | }); -------------------------------------------------------------------------------- /generators/target/templates/app/e2e.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | describe('App', function() { 3 | 4 | beforeEach(function() { 5 | browser.get('/'); 6 | }); 7 | 8 | it('should have a title', function() { 9 | expect(browser.getTitle()).toEqual('Angular 2 App | ng2-webpack'); 10 | }); 11 | 12 | /* eslint-disable no-undef */ 13 | it('should have
', function() { 14 | expect(element(by.css('app header')).isPresent()).toEqual(true); 15 | }); 16 | 17 | it('should have
', function() { 18 | expect(element(by.css('app main')).isPresent()).toEqual(true); 19 | }); 20 | 21 | it('should have a main title', function() { 22 | expect(element(by.css('main .title')).getText()).toEqual('Hello from Angular 2 !'); 23 | }); 24 | 25 | it('should have