├── .nvmrc ├── docs ├── documentation │ ├── config.md │ ├── e2e.md │ ├── generate │ │ ├── enum.md │ │ ├── class.md │ │ ├── interface.md │ │ ├── service.md │ │ ├── module.md │ │ ├── pipe.md │ │ ├── directive.md │ │ └── component.md │ ├── doc.md │ ├── generate.md │ ├── test.md │ ├── build.md │ ├── new.md │ ├── init.md │ └── serve.md └── publish.md ├── packages ├── universal-cli │ ├── blueprints │ │ ├── ng2 │ │ │ └── files │ │ │ │ ├── __path__ │ │ │ │ ├── assets │ │ │ │ │ └── .gitkeep │ │ │ │ ├── app │ │ │ │ │ ├── app.component.__styleext__ │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── app.component.html │ │ │ │ │ ├── app-routing.module.ts │ │ │ │ │ ├── app.component.ts │ │ │ │ │ ├── app.module.ts │ │ │ │ │ └── app.component.spec.ts │ │ │ │ ├── environments │ │ │ │ │ ├── environment.prod.ts │ │ │ │ │ └── environment.ts │ │ │ │ ├── styles.__styleext__ │ │ │ │ ├── favicon.ico │ │ │ │ ├── typings.d.ts │ │ │ │ ├── main.ts │ │ │ │ ├── tsconfig.json │ │ │ │ ├── polyfills.ts │ │ │ │ ├── test.ts │ │ │ │ └── index.html │ │ │ │ ├── e2e │ │ │ │ ├── app.po.ts │ │ │ │ ├── tsconfig.json │ │ │ │ └── app.e2e-spec.ts │ │ │ │ ├── .editorconfig │ │ │ │ ├── gitignore │ │ │ │ ├── protractor.conf.js │ │ │ │ ├── README.md │ │ │ │ └── karma.conf.js │ │ ├── component │ │ │ └── files │ │ │ │ └── __path__ │ │ │ │ ├── __name__.component.__styleext__ │ │ │ │ ├── __name__.component.html │ │ │ │ ├── __name__.component.ts │ │ │ │ └── __name__.component.spec.ts │ │ ├── universal │ │ │ ├── files │ │ │ │ ├── webpack.client.ts │ │ │ │ ├── webpack.server.ts │ │ │ │ └── __path__ │ │ │ │ │ ├── server.routes.ts │ │ │ │ │ ├── client.ts │ │ │ │ │ ├── __2.1.1.workaround.ts │ │ │ │ │ └── app │ │ │ │ │ ├── app.node.module.ts │ │ │ │ │ └── app.browser.module.ts │ │ │ └── index.js │ │ ├── class │ │ │ └── files │ │ │ │ └── __path__ │ │ │ │ ├── __name__.ts │ │ │ │ └── __name__.spec.ts │ │ ├── enum │ │ │ ├── files │ │ │ │ └── __path__ │ │ │ │ │ └── __name__.enum.ts │ │ │ └── index.js │ │ ├── interface │ │ │ ├── files │ │ │ │ └── __path__ │ │ │ │ │ └── __name__.ts │ │ │ └── index.js │ │ ├── mobile │ │ │ ├── files │ │ │ │ └── __path__ │ │ │ │ │ ├── icons │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── mstile-70x70.png │ │ │ │ │ ├── favicon-16x16.png │ │ │ │ │ ├── favicon-32x32.png │ │ │ │ │ ├── favicon-96x96.png │ │ │ │ │ ├── mstile-144x144.png │ │ │ │ │ ├── mstile-150x150.png │ │ │ │ │ ├── mstile-310x150.png │ │ │ │ │ ├── mstile-310x310.png │ │ │ │ │ ├── apple-touch-icon.png │ │ │ │ │ ├── android-chrome-36x36.png │ │ │ │ │ ├── android-chrome-48x48.png │ │ │ │ │ ├── android-chrome-72x72.png │ │ │ │ │ ├── android-chrome-96x96.png │ │ │ │ │ ├── android-chrome-144x144.png │ │ │ │ │ ├── android-chrome-192x192.png │ │ │ │ │ ├── apple-touch-icon-57x57.png │ │ │ │ │ ├── apple-touch-icon-60x60.png │ │ │ │ │ ├── apple-touch-icon-72x72.png │ │ │ │ │ ├── apple-touch-icon-76x76.png │ │ │ │ │ ├── apple-touch-icon-114x114.png │ │ │ │ │ ├── apple-touch-icon-120x120.png │ │ │ │ │ ├── apple-touch-icon-144x144.png │ │ │ │ │ ├── apple-touch-icon-152x152.png │ │ │ │ │ ├── apple-touch-icon-180x180.png │ │ │ │ │ ├── apple-touch-icon-precomposed.png │ │ │ │ │ └── safari-pinned-tab.svg │ │ │ │ │ ├── manifest.webapp │ │ │ │ │ └── main-app-shell.ts │ │ │ └── index.js │ │ ├── service │ │ │ └── files │ │ │ │ └── __path__ │ │ │ │ ├── __name__.service.ts │ │ │ │ └── __name__.service.spec.ts │ │ ├── directive │ │ │ └── files │ │ │ │ └── __path__ │ │ │ │ ├── __name__.directive.ts │ │ │ │ └── __name__.directive.spec.ts │ │ ├── pipe │ │ │ └── files │ │ │ │ └── __path__ │ │ │ │ ├── __name__.pipe.ts │ │ │ │ └── __name__.pipe.spec.ts │ │ └── module │ │ │ └── files │ │ │ └── __path__ │ │ │ ├── __name__-routing.module.ts │ │ │ ├── __name__.module.ts │ │ │ └── __name__.module.spec.ts │ ├── ember-cli │ │ ├── lib │ │ │ ├── commands.js │ │ │ ├── tasks │ │ │ │ ├── destroy-from-blueprint.js │ │ │ │ ├── npm-install.js │ │ │ │ ├── npm-uninstall.js │ │ │ │ └── create-and-step-into-directory.js │ │ │ ├── utilities │ │ │ │ ├── normalize-blueprint-option.js │ │ │ │ ├── root-command.js │ │ │ │ ├── require-local.js │ │ │ │ ├── get-package-base-name.js │ │ │ │ ├── parse-options.js │ │ │ │ ├── valid-project-name.js │ │ │ │ ├── get-option-args.js │ │ │ │ ├── deprecate.js │ │ │ │ ├── attempt-never-index.js │ │ │ │ ├── find-build-file.js │ │ │ │ ├── mk-tmp-dir-in.js │ │ │ │ ├── version-utils.js │ │ │ │ ├── doc-generator.js │ │ │ │ ├── printable-properties.js │ │ │ │ ├── require-as-hash.js │ │ │ │ ├── merge-blueprint-options.js │ │ │ │ ├── sequence.js │ │ │ │ ├── platform-checker.js │ │ │ │ ├── open-editor.js │ │ │ │ ├── path.js │ │ │ │ └── windows-admin.js │ │ │ ├── models │ │ │ │ └── task.js │ │ │ ├── tasks.js │ │ │ ├── commands │ │ │ │ └── unknown.js │ │ │ ├── ext │ │ │ │ └── core-object.js │ │ │ └── ui │ │ │ │ └── write-error.js │ │ └── LICENSE.md │ ├── utilities │ │ ├── change.ts │ │ ├── sw-install.js │ │ ├── route-utils.ts │ │ ├── ast-utils.ts │ │ ├── INITIAL_COMMIT_MESSAGE.txt │ │ └── find-parent-module.ts │ ├── models │ │ ├── index.ts │ │ ├── error.ts │ │ ├── webpack-build-development.ts │ │ ├── webpack-build-mobile.ts │ │ └── webpack-build-typescript.ts │ ├── tasks │ │ ├── doc.ts │ │ ├── link-cli.ts │ │ ├── lint.ts │ │ ├── npm-install.ts │ │ ├── e2e.ts │ │ └── test.ts │ ├── commands │ │ ├── lint.ts │ │ ├── destroy.ts │ │ ├── completion.ts │ │ ├── e2e.ts │ │ ├── doc.ts │ │ ├── get.ts │ │ ├── easter-egg.ts │ │ ├── set.ts │ │ └── version.ts │ ├── plugins │ │ └── package-chunk-sort.ts │ ├── custom-typings.d.ts │ ├── tsconfig.json │ └── addon │ │ └── index.js ├── @angular-cli │ ├── base-href-webpack │ │ ├── src │ │ │ ├── index.ts │ │ │ └── base-href-webpack-plugin.ts │ │ ├── package.json │ │ └── tsconfig.json │ └── ast-tools │ │ ├── src │ │ ├── index.ts │ │ ├── spec-utils.ts │ │ └── node.ts │ │ ├── tsconfig.json │ │ └── package.json └── @ngtools │ └── webpack │ ├── src │ ├── index.ts │ ├── utils.ts │ ├── webpack.ts │ └── reflector_host.ts │ ├── tsconfig.json │ └── package.json ├── tests ├── e2e │ ├── assets │ │ ├── webpack │ │ │ ├── test-app │ │ │ │ ├── app │ │ │ │ │ ├── app.component.scss │ │ │ │ │ ├── app.component.html │ │ │ │ │ ├── main.jit.ts │ │ │ │ │ ├── main.aot.ts │ │ │ │ │ ├── app.component.ts │ │ │ │ │ ├── feature │ │ │ │ │ │ ├── feature.module.ts │ │ │ │ │ │ └── lazy-feature.module.ts │ │ │ │ │ ├── app.module.ts │ │ │ │ │ └── lazy.module.ts │ │ │ │ ├── index.html │ │ │ │ ├── tsconfig.json │ │ │ │ ├── webpack.config.js │ │ │ │ └── package.json │ │ │ └── test-app-weird │ │ │ │ ├── not │ │ │ │ └── so │ │ │ │ │ └── source │ │ │ │ │ ├── app │ │ │ │ │ ├── app.component.scss │ │ │ │ │ ├── app.component.html │ │ │ │ │ ├── main.jit.ts │ │ │ │ │ ├── app.component.ts │ │ │ │ │ ├── feature │ │ │ │ │ │ ├── feature.module.ts │ │ │ │ │ │ └── lazy-feature.module.ts │ │ │ │ │ ├── app.module.ts │ │ │ │ │ └── lazy.module.ts │ │ │ │ │ ├── index.html │ │ │ │ │ └── tsconfig.json │ │ │ │ ├── aotplugin.config.json │ │ │ │ ├── webpack.config.js │ │ │ │ └── package.json │ │ └── ssl │ │ │ ├── server.crt │ │ │ └── server.key │ ├── tests │ │ ├── test │ │ │ ├── lint.ts │ │ │ ├── test.ts │ │ │ └── e2e.ts │ │ ├── commands │ │ │ ├── help │ │ │ │ ├── help.ts │ │ │ │ ├── help-option.ts │ │ │ │ └── help-option-command.ts │ │ │ └── new │ │ │ │ └── new-routing.ts │ │ ├── build │ │ │ ├── no-implicit-any.ts │ │ │ ├── base-href.ts │ │ │ ├── fail-build.ts │ │ │ ├── aot.ts │ │ │ ├── vendor-chunk.ts │ │ │ ├── sourcemap.ts │ │ │ ├── filename.ts │ │ │ ├── dev-build.ts │ │ │ ├── output-dir.ts │ │ │ ├── environment.ts │ │ │ ├── styles │ │ │ │ ├── postcss.ts │ │ │ │ ├── css.ts │ │ │ │ ├── loaders.ts │ │ │ │ ├── stylus.ts │ │ │ │ ├── scss.ts │ │ │ │ └── less.ts │ │ │ ├── ts-paths.ts │ │ │ └── aot-i18n.ts │ │ ├── misc │ │ │ ├── version.ts │ │ │ ├── coverage.ts │ │ │ ├── universal-serve.ts │ │ │ ├── ssl-default.ts │ │ │ ├── ssl-with-cert.ts │ │ │ └── assets.ts │ │ ├── generate │ │ │ ├── interface.ts │ │ │ ├── class.ts │ │ │ ├── pipe.ts │ │ │ ├── service.ts │ │ │ ├── component │ │ │ │ ├── component-basic.ts │ │ │ │ └── component-path-case.ts │ │ │ └── module │ │ │ │ ├── module-basic.ts │ │ │ │ └── module-routing.ts │ │ ├── packages │ │ │ └── webpack │ │ │ │ ├── test.ts │ │ │ │ └── weird.ts │ │ ├── mobile │ │ │ └── prod-features.ts │ │ └── third-party │ │ │ └── bootstrap.ts │ ├── setup │ │ ├── 000-pwd.ts │ │ ├── 200-create-tmp-dir.ts │ │ ├── 300-log-environment.ts │ │ └── 100-npm-link.ts │ └── utils │ │ ├── env.ts │ │ ├── ast.ts │ │ ├── http.ts │ │ ├── utils.ts │ │ └── git.ts ├── helpers │ ├── ng.js │ ├── mock-analytics.js │ ├── tmp.js │ └── mock-ui.js ├── models │ ├── spec-schema.d.ts │ └── spec-schema.json ├── runner.js └── acceptance │ ├── destroy.spec.js │ ├── generate-class.spec.js │ └── find-lazy-module.spec.ts ├── bin └── ung ├── .gitignore ├── plugins └── karma.js ├── .editorconfig ├── .eslintignore ├── .appveyor.yml ├── scripts ├── publish │ ├── shrinkwrap.js │ └── changelog.js └── run-packages-spec.js ├── .github └── ISSUE_TEMPLATE.md ├── tsconfig.json ├── LICENSE ├── lib └── packages.js └── tslint.json /.nvmrc: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /docs/documentation/config.md: -------------------------------------------------------------------------------- 1 | `ng get` 2 | `ng set` 3 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/app/app.component.__styleext__: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/component/files/__path__/__name__.component.__styleext__: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/universal/files/webpack.client.ts: -------------------------------------------------------------------------------- 1 | module.exports = {}; 2 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/universal/files/webpack.server.ts: -------------------------------------------------------------------------------- 1 | module.exports = {}; 2 | -------------------------------------------------------------------------------- /docs/documentation/e2e.md: -------------------------------------------------------------------------------- 1 | # ng e2e 2 | 3 | ## Overview 4 | `ng e2e` executes end-to-end tests 5 | -------------------------------------------------------------------------------- /packages/@angular-cli/base-href-webpack/src/index.ts: -------------------------------------------------------------------------------- 1 | 2 | export * from './base-href-webpack-plugin'; 3 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/app.component.scss: -------------------------------------------------------------------------------- 1 | :host { 2 | background-color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/commands.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 'Unknown': require('./commands/unknown') }; -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/class/files/__path__/__name__.ts: -------------------------------------------------------------------------------- 1 | export class <%= classifiedModuleName %> { 2 | } 3 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/enum/files/__path__/__name__.enum.ts: -------------------------------------------------------------------------------- 1 | export enum <%= classifiedModuleName %> { 2 | } 3 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/app/app.component.scss: -------------------------------------------------------------------------------- 1 | :host { 2 | background-color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /docs/documentation/generate/enum.md: -------------------------------------------------------------------------------- 1 | # ng generate enum 2 | 3 | ## Overview 4 | `ng generate enum [name]` generates an enumeration 5 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/component/files/__path__/__name__.component.html: -------------------------------------------------------------------------------- 1 |

2 | <%= dasherizedModuleName %> works! 3 |

4 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/interface/files/__path__/__name__.ts: -------------------------------------------------------------------------------- 1 | export interface <%= prefix %><%= classifiedModuleName %> { 2 | } 3 | -------------------------------------------------------------------------------- /docs/documentation/doc.md: -------------------------------------------------------------------------------- 1 | # ng doc 2 | 3 | ## Overview 4 | `ng doc [search term]` searches documentation on [angular.io](https://angular.io) 5 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /tests/e2e/tests/test/lint.ts: -------------------------------------------------------------------------------- 1 | import {ng} from '../../utils/process'; 2 | 3 | 4 | export default function() { 5 | return ng('lint'); 6 | } 7 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/styles.__styleext__: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/aotplugin.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "tsConfigPath": "./not/so/source/tsconfig.json", 3 | "mainPath": "app/main.jit.ts" 4 | } -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/app/index.ts: -------------------------------------------------------------------------------- 1 | export * from './app.component';<% if(!universal) { %> 2 | export * from './app.module';<% } %> 3 | -------------------------------------------------------------------------------- /packages/@angular-cli/ast-tools/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ast-utils'; 2 | export * from './change'; 3 | export * from './node'; 4 | export * from './route-utils'; 5 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/app/app.component.html: -------------------------------------------------------------------------------- 1 |

2 | {{title}} 3 |

<% if (routing) { %> 4 | <% } %> 5 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |

hello world

3 | lazy 4 | 5 |
6 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/ng2/files/__path__/favicon.ico -------------------------------------------------------------------------------- /docs/documentation/generate/class.md: -------------------------------------------------------------------------------- 1 | # ng generate class 2 | 3 | ## Overview 4 | `ng generate class [name]` generates a class 5 | 6 | ## Options 7 | `--spec` specifies if a spec file is generated -------------------------------------------------------------------------------- /packages/@ngtools/webpack/src/index.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | 3 | export * from './plugin'; 4 | export {ngcLoader as default} from './loader'; 5 | export {PathsPlugin} from './paths-plugin'; 6 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/icon.png -------------------------------------------------------------------------------- /packages/universal-cli/utilities/change.ts: -------------------------------------------------------------------------------- 1 | export { 2 | Change, 3 | NoopChange, 4 | MultiChange, 5 | InsertChange, 6 | RemoveChange, 7 | ReplaceChange 8 | } from '@angular-cli/ast-tools'; 9 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |

hello world

3 | lazy 4 | 5 |
6 | -------------------------------------------------------------------------------- /tests/e2e/setup/000-pwd.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | 3 | 4 | export default function() { 5 | // Setup to use the local universal-cli copy. 6 | process.chdir(join(__dirname, '../..')); 7 | } 8 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-70x70.png -------------------------------------------------------------------------------- /packages/universal-cli/utilities/sw-install.js: -------------------------------------------------------------------------------- 1 | // this file is used in ../models/webpack-build-mobile.ts to add 2 | // service worker functionality to mobile projects 3 | require('offline-plugin/runtime').install(); -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/favicon-16x16.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/favicon-32x32.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/favicon-96x96.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-144x144.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-150x150.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-310x150.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/mstile-310x310.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/typings.d.ts: -------------------------------------------------------------------------------- 1 | // Typings reference file, you can add your own global typings here 2 | // https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html 3 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /bin/ung: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | 4 | // Provide a title to the process in `ps` 5 | process.title = 'universal-cli'; 6 | 7 | require('../lib/bootstrap-local'); 8 | require('../packages/universal-cli/bin/ung'); 9 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-36x36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-36x36.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-48x48.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-72x72.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-96x96.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-144x144.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/android-chrome-192x192.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-57x57.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-72x72.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/documentation/generate/interface.md: -------------------------------------------------------------------------------- 1 | # ng generate interface 2 | 3 | ## Overview 4 | `ng generate interface [name] ` generates an interface 5 | 6 | ## Arguments 7 | 8 | `type` optional string to specify the type of interface 9 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-114x114.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-144x144.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/service/files/__path__/__name__.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class <%= classifiedModuleName %>Service { 5 | 6 | constructor() { } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devCrossNet/universal-cli/HEAD/packages/universal-cli/blueprints/mobile/files/__path__/icons/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | npm-debug.log* 4 | 5 | # IDEs 6 | .idea/ 7 | jsconfig.json 8 | .vscode/ 9 | 10 | # Typings file. 11 | typings/ 12 | 13 | # Misc 14 | tmp/ 15 | 16 | # Mac OSX Finder files. 17 | **/.DS_Store 18 | .DS_Store 19 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/main.jit.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; 3 | import {AppModule} from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /tests/e2e/tests/test/test.ts: -------------------------------------------------------------------------------- 1 | import {ng} from '../../utils/process'; 2 | 3 | 4 | export default function() { 5 | // make sure both --watch=false and --single-run work 6 | return ng('test', '--single-run') 7 | .then(() => ng('test', '--watch=false')); 8 | } 9 | -------------------------------------------------------------------------------- /docs/documentation/generate/service.md: -------------------------------------------------------------------------------- 1 | # ng generate service 2 | 3 | ## Overview 4 | `ng generate service [name]` generates a service 5 | 6 | ## Options 7 | `--flat` flag to indicate if a dir is created 8 | 9 | `--spec` specifies if a spec file is generated 10 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/tasks/destroy-from-blueprint.js: -------------------------------------------------------------------------------- 1 | /*jshint quotmark: false*/ 2 | 3 | 'use strict'; 4 | 5 | var Generate = require('./generate-from-blueprint'); 6 | 7 | module.exports = Generate.extend({ 8 | blueprintFunction: 'uninstall' 9 | }); 10 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/app/main.jit.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; 3 | import {AppModule} from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /docs/documentation/generate/module.md: -------------------------------------------------------------------------------- 1 | # ng generate module 2 | 3 | ## Overview 4 | `ng generate module [name]` generates an NgModule 5 | 6 | ## Options 7 | `--spec` specifies if a spec file is generated 8 | 9 | `--routing` specifies if a routing module file should be generated 10 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/main.aot.ts: -------------------------------------------------------------------------------- 1 | import 'core-js/es7/reflect'; 2 | import {platformBrowser} from '@angular/platform-browser'; 3 | import {AppModuleNgFactory} from './ngfactory/app/app.module.ngfactory'; 4 | 5 | platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); 6 | -------------------------------------------------------------------------------- /tests/e2e/tests/commands/help/help.ts: -------------------------------------------------------------------------------- 1 | import {silentNg} from '../../../utils/process'; 2 | 3 | 4 | export default function() { 5 | return Promise.resolve() 6 | .then(() => silentNg('help')) 7 | .then(() => process.chdir('/')) 8 | .then(() => silentNg('help')); 9 | } 10 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/directive/files/__path__/__name__.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive } from '@angular/core'; 2 | 3 | @Directive({ 4 | selector: '[<%= selector %>]' 5 | }) 6 | export class <%= classifiedModuleName %>Directive { 7 | 8 | constructor() { } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/normalize-blueprint-option.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var path = require('path'); 4 | 5 | module.exports = function normalizeBlueprintOption(blueprint) { 6 | return blueprint[0] === '.' ? path.resolve(process.cwd(), blueprint) : blueprint; 7 | }; 8 | -------------------------------------------------------------------------------- /packages/universal-cli/models/index.ts: -------------------------------------------------------------------------------- 1 | export * from './webpack-build-common'; 2 | export * from './webpack-build-production'; 3 | export * from './webpack-build-development'; 4 | export * from './webpack-build-mobile'; 5 | export * from './webpack-build-utils'; 6 | export * from './webpack-build-node'; 7 | -------------------------------------------------------------------------------- /plugins/karma.js: -------------------------------------------------------------------------------- 1 | // This file is necessary when using a linked universal-cli to this repo, meaning that 2 | // require('universal-cli/plugins/karma') will load this file, and we just forward to 3 | // the actual published file. 4 | module.exports = require('../packages/universal-cli/plugins/karma'); 5 | -------------------------------------------------------------------------------- /tests/e2e/tests/commands/help/help-option.ts: -------------------------------------------------------------------------------- 1 | import {silentNg} from '../../../utils/process'; 2 | 3 | 4 | export default function() { 5 | return Promise.resolve() 6 | .then(() => silentNg('--help')) 7 | .then(() => process.chdir('/')) 8 | .then(() => silentNg('--help')); 9 | } 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | insert_final_newline = false 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # /node_modules and /bower_components ignored by default 2 | dist/ 3 | .git/ 4 | tmp/ 5 | typings/ 6 | 7 | # Ignore all blueprint files. We e2e tests those later on. 8 | packages/universal-cli/blueprints/*/files/ 9 | 10 | # Ignore ember cli. 11 | packages/universal-cli/ember-cli/ 12 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/root-command.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Command = require('../models/command'); 4 | 5 | module.exports = Command.extend({ 6 | isRoot: true, 7 | name: 'ember', 8 | 9 | anonymousOptions: [ 10 | '' 11 | ] 12 | }); 13 | -------------------------------------------------------------------------------- /packages/universal-cli/models/error.ts: -------------------------------------------------------------------------------- 1 | export class NgToolkitError extends Error { 2 | constructor(message?: string) { 3 | super(); 4 | 5 | if (message) { 6 | this.message = message; 7 | } else { 8 | this.message = (this.constructor).name; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/require-local.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var path = require('path'); 4 | var nodeModulesPath = require('node-modules-path'); 5 | 6 | module.exports = function requireLocal(lib) { 7 | return require(path.join(nodeModulesPath(process.cwd()), lib)); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/class/files/__path__/__name__.spec.ts: -------------------------------------------------------------------------------- 1 | import {<%= classifiedModuleName %>} from './<%= fileName %>'; 2 | 3 | describe('<%= classifiedModuleName %>', () => { 4 | it('should create an instance', () => { 5 | expect(new <%= classifiedModuleName %>()).toBeTruthy(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /docs/documentation/generate/pipe.md: -------------------------------------------------------------------------------- 1 | # ng generate pipe 2 | 3 | ## Overview 4 | `ng generate pipe [name]` generates a pipe 5 | 6 | ## Options 7 | `--flat` flag to indicate if a dir is created 8 | 9 | `--spec` specifies if a spec file is generated 10 | 11 | `--skip-import` allows for skipping the module import 12 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/get-package-base-name.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (name) { 4 | var packageParts; 5 | 6 | if (!name) { 7 | return null; 8 | } 9 | 10 | packageParts = name.split('/'); 11 | return packageParts[(packageParts.length - 1)]; 12 | }; 13 | -------------------------------------------------------------------------------- /tests/e2e/tests/commands/help/help-option-command.ts: -------------------------------------------------------------------------------- 1 | import {silentNg} from '../../../utils/process'; 2 | 3 | 4 | export default function() { 5 | return Promise.resolve() 6 | .then(() => silentNg('--help', 'build')) 7 | .then(() => process.chdir('/')) 8 | .then(() => silentNg('--help', 'build')); 9 | } 10 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/no-implicit-any.ts: -------------------------------------------------------------------------------- 1 | import {updateTsConfig} from '../../utils/project'; 2 | import {ng} from '../../utils/process'; 3 | 4 | 5 | export default function() { 6 | return updateTsConfig(json => { 7 | json['compilerOptions']['noImplicitAny'] = true; 8 | }) 9 | .then(() => ng('build')); 10 | } 11 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, element, by } from 'protractor'; 2 | 3 | export class <%= jsComponentName %>Page { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('<%= prefix %>-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, ViewEncapsulation} from '@angular/core'; 2 | 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.scss'], 8 | encapsulation: ViewEncapsulation.None 9 | }) 10 | export class AppComponent { } 11 | -------------------------------------------------------------------------------- /tests/e2e/tests/misc/version.ts: -------------------------------------------------------------------------------- 1 | import {deleteFile} from '../../utils/fs'; 2 | import {ng} from '../../utils/process'; 3 | 4 | 5 | export default function() { 6 | return ng('version') 7 | .then(() => deleteFile('angular-cli.json')) 8 | // doesn't fail on a project with missing angular-cli.json 9 | .then(() => ng('version')); 10 | } 11 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/documentation/generate.md: -------------------------------------------------------------------------------- 1 | # ng generate 2 | 3 | ## Overview 4 | `ng generate [name]` generates the specified blueprint 5 | 6 | ## Available blueprints: 7 | - [class](class) 8 | - [component](component) 9 | - [directive](directive) 10 | - [enum](enum) 11 | - [interface](interface) 12 | - [module](module) 13 | - [pipe](pipe) 14 | - [service](service) -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/pipe/files/__path__/__name__.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ 4 | name: '<%= camelizedModuleName %>' 5 | }) 6 | export class <%= classifiedModuleName %>Pipe implements PipeTransform { 7 | 8 | transform(value: any, args?: any): any { 9 | return null; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/e2e/tests/misc/coverage.ts: -------------------------------------------------------------------------------- 1 | import {expectFileToExist} from '../../utils/fs'; 2 | import {ng} from '../../utils/process'; 3 | 4 | 5 | export default function() { 6 | return ng('test', '--single-run', '--code-coverage') 7 | .then(() => expectFileToExist('coverage/src/app')) 8 | .then(() => expectFileToExist('coverage/coverage.lcov')); 9 | } 10 | -------------------------------------------------------------------------------- /packages/universal-cli/tasks/doc.ts: -------------------------------------------------------------------------------- 1 | const Task = require('../ember-cli/lib/models/task'); 2 | const opn = require('opn'); 3 | 4 | export const DocTask: any = Task.extend({ 5 | run: function(keyword: string) { 6 | const searchUrl = `https://angular.io/docs/ts/latest/api/#!?query=${keyword}`; 7 | return opn(searchUrl, { wait: false }); 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, ViewEncapsulation} from '@angular/core'; 2 | 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.scss'], 8 | encapsulation: ViewEncapsulation.None 9 | }) 10 | export class AppComponent { } 11 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/parse-options.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var reduce = require('lodash/reduce'); 4 | 5 | module.exports = function parseOptions(args) { 6 | return reduce(args, function(result, arg) { 7 | var parts = arg.split(':'); 8 | result[parts[0]] = parts.slice(1).join(':'); 9 | return result; 10 | }, {}); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/tasks/npm-install.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Runs `npm install` in cwd 4 | 5 | var NpmTask = require('./npm-task'); 6 | 7 | module.exports = NpmTask.extend({ 8 | command: 'install', 9 | startProgressMessage: 'Installing packages for tooling via npm', 10 | completionMessage: 'Installed packages for tooling via npm.' 11 | }); 12 | -------------------------------------------------------------------------------- /.appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | matrix: 3 | - nodejs_version: "6.0" 4 | 5 | matrix: 6 | fast_finish: true 7 | 8 | install: 9 | - ps: Install-Product node $env:nodejs_version 10 | - npm install -g npm 11 | - npm install 12 | 13 | test_script: 14 | - node --version 15 | - npm --version 16 | - npm test 17 | - node tests\e2e_runner.js 18 | 19 | build: off 20 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/tasks/npm-uninstall.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Runs `npm uninstall` in cwd 4 | 5 | var NpmTask = require('./npm-task'); 6 | 7 | module.exports = NpmTask.extend({ 8 | command: 'uninstall', 9 | startProgressMessage: 'Uninstalling packages for tooling via npm', 10 | completionMessage: 'Uninstalled packages for tooling via npm.' 11 | }); 12 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/base-href.ts: -------------------------------------------------------------------------------- 1 | import { ng } from '../../utils/process'; 2 | import { expectFileToMatch } from '../../utils/fs'; 3 | import { getClientDist } from '../../utils/utils'; 4 | 5 | 6 | export default function () { 7 | return ng('build', '--base-href', '/myUrl') 8 | .then(() => expectFileToMatch(`${getClientDist()}index.html`, //)); 9 | } 10 | -------------------------------------------------------------------------------- /tests/e2e/tests/commands/new/new-routing.ts: -------------------------------------------------------------------------------- 1 | import {ng} from '../../../utils/process'; 2 | import {createProject} from '../../../utils/project'; 3 | 4 | 5 | export default function() { 6 | return Promise.resolve() 7 | .then(() => createProject('routing-project', '--routing')) 8 | 9 | // Try to run the unit tests. 10 | .then(() => ng('test', '--single-run')); 11 | } 12 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/fail-build.ts: -------------------------------------------------------------------------------- 1 | import {ng} from '../../utils/process'; 2 | import {expectToFail} from '../../utils/utils'; 3 | import {deleteFile} from '../../utils/fs'; 4 | 5 | export default function() { 6 | return deleteFile('src/app/app.component.ts') 7 | // This is supposed to fail since there's a missing file 8 | .then(() => expectToFail(() => ng('build'))); 9 | } 10 | -------------------------------------------------------------------------------- /docs/documentation/generate/directive.md: -------------------------------------------------------------------------------- 1 | # ng generate directive 2 | 3 | ## Overview 4 | `ng generate directive [name]` generates a directive 5 | 6 | ## Options 7 | `--flat` flag to indicate if a dir is created 8 | 9 | `--prefix` specifies whether to use the prefix 10 | 11 | `--spec` specifies if a spec file is generated 12 | 13 | `--skip-import` allows for skipping the module import 14 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/models/task.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var CoreObject = require('../ext/core-object'); 4 | 5 | function Task() { 6 | CoreObject.apply(this, arguments); 7 | } 8 | 9 | module.exports = Task; 10 | 11 | Task.__proto__ = CoreObject; 12 | 13 | Task.prototype.run = function(/*options*/) { 14 | throw new Error('Task needs to have run() defined.'); 15 | }; 16 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/module/files/__path__/__name__-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forChild(routes)], 8 | exports: [RouterModule], 9 | providers: [] 10 | }) 11 | export class <%= classifiedModuleName %>RoutingModule { } 12 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/valid-project-name.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(name) { 4 | name = name.toLowerCase(); 5 | 6 | if (['test', 'ember', 'ember-cli', 'vendor', 'app'].indexOf(name) > -1) { return false; } 7 | if (name.indexOf('.') > -1) { return false; } 8 | if (!isNaN(parseInt(name.charAt(0), 10))) { return false; } 9 | 10 | return true; 11 | }; 12 | -------------------------------------------------------------------------------- /packages/universal-cli/utilities/route-utils.ts: -------------------------------------------------------------------------------- 1 | // In order to keep refactoring low, simply export from ast-tools. 2 | // TODO: move all dependencies of this file to ast-tools directly. 3 | export { 4 | bootstrapItem, 5 | insertImport, 6 | addPathToRoutes, 7 | addItemsToRouteProperties, 8 | confirmComponentExport, 9 | resolveComponentPath, 10 | applyChanges 11 | } from '@angular-cli/ast-tools'; 12 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/universal/files/__path__/server.routes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Server-side routes. Only the listed routes support html5pushstate. 3 | * Has to match client side routes. 4 | * 5 | * Index (/) route does not have to be listed here. 6 | * 7 | * @example 8 | * export const routes: string[] = [ 9 | * 'home', 'about' 10 | * ]; 11 | **/ 12 | export const routes: string[] = [ 13 | 14 | ]; 15 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/aot.ts: -------------------------------------------------------------------------------- 1 | import { ng } from '../../utils/process'; 2 | import { expectFileToMatch } from '../../utils/fs'; 3 | import { getClientDist, getAppMain, getMainAppModuleRegex } from '../../utils/utils'; 4 | 5 | export default function () { 6 | return ng('build', '--aot') 7 | .then(() => expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, 8 | getMainAppModuleRegex())); 9 | } 10 | -------------------------------------------------------------------------------- /tests/e2e/utils/env.ts: -------------------------------------------------------------------------------- 1 | const global: {[name: string]: any} = Object.create(null); 2 | 3 | 4 | export function setGlobalVariable(name: string, value: any) { 5 | global[name] = value; 6 | } 7 | 8 | export function getGlobalVariable(name: string): any { 9 | if (!(name in global)) { 10 | throw new Error(`Trying to access variable "${name}" but it's not defined.`); 11 | } 12 | return global[name]; 13 | } 14 | -------------------------------------------------------------------------------- /packages/universal-cli/utilities/ast-utils.ts: -------------------------------------------------------------------------------- 1 | // In order to keep refactoring low, simply export from ast-tools. 2 | // TODO: move all dependencies of this file to ast-tools directly. 3 | export { 4 | getSource, 5 | getSourceNodes, 6 | findNodes, 7 | insertAfterLastOccurrence, 8 | getContentOfKeyLiteral, 9 | getDecoratorMetadata, 10 | addDeclarationToModule, 11 | addProviderToModule 12 | } from '@angular-cli/ast-tools'; 13 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | const routes: Routes = [ 5 | { 6 | path: '', 7 | children: [] 8 | } 9 | ]; 10 | 11 | @NgModule({ 12 | imports: [RouterModule.forRoot(routes)], 13 | exports: [RouterModule], 14 | providers: [] 15 | }) 16 | export class AppRoutingModule { } 17 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/main.ts: -------------------------------------------------------------------------------- 1 | import './polyfills.ts'; 2 | 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 4 | import { enableProdMode } from '@angular/core'; 5 | import { environment } from './environments/environment'; 6 | import { AppModule } from './app/app.module'; 7 | 8 | if (environment.production) { 9 | enableProdMode(); 10 | } 11 | 12 | platformBrowserDynamic().bootstrapModule(AppModule); 13 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "outDir": "../dist/out-tsc-e2e", 10 | "sourceMap": true, 11 | "target": "es5", 12 | "typeRoots": [ 13 | "../node_modules/@types" 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/pipe/files/__path__/__name__.pipe.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async } from '@angular/core/testing'; 4 | import { <%= classifiedModuleName %>Pipe } from './<%= dasherizedModuleName %>.pipe'; 5 | 6 | describe('<%= classifiedModuleName %>Pipe', () => { 7 | it('create an instance', () => { 8 | let pipe = new <%= classifiedModuleName %>Pipe(); 9 | expect(pipe).toBeTruthy(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ung build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/get-option-args.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(option, commandArgs) { 4 | var results = [], value, i; 5 | var optionIndex = commandArgs.indexOf(option); 6 | if (optionIndex === -1) { return results; } 7 | 8 | for (i = optionIndex + 1; i < commandArgs.length; i++) { 9 | value = commandArgs[i]; 10 | if (/^\-+/.test(value)) { break; } 11 | results.push(value); 12 | } 13 | 14 | return results; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { <%= jsComponentName %>Page } from './app.po'; 2 | 3 | describe('<%= htmlComponentName %> App', function() { 4 | let page: <%= jsComponentName %>Page; 5 | 6 | beforeEach(() => { 7 | page = new <%= jsComponentName %>Page(); 8 | }); 9 | 10 | it('should display message saying app works', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('<%= prefix %> works!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/vendor-chunk.ts: -------------------------------------------------------------------------------- 1 | import {ng} from '../../utils/process'; 2 | import {expectFileToExist} from '../../utils/fs'; 3 | import {expectToFail, getClientDist} from '../../utils/utils'; 4 | 5 | 6 | export default function() { 7 | return ng('build') 8 | .then(() => expectFileToExist(`${getClientDist()}vendor.bundle.js`)) 9 | .then(() => ng('build', '--no-vendor-chunk')) 10 | .then(() => expectToFail(() => expectFileToExist(`${getClientDist()}vendor.bundle.js`))); 11 | } 12 | -------------------------------------------------------------------------------- /tests/helpers/ng.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var MockUI = require('./mock-ui'); 4 | var MockAnalytics = require('./mock-analytics'); 5 | var Cli = require('universal-cli/lib/cli'); 6 | 7 | module.exports = function ng(args) { 8 | var cli; 9 | 10 | process.env.PWD = process.cwd(); 11 | 12 | cli = new Cli({ 13 | inputStream: [], 14 | outputStream: [], 15 | cliArgs: args, 16 | Leek: MockAnalytics, 17 | UI: MockUI, 18 | testing: true 19 | }); 20 | 21 | return cli; 22 | }; 23 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/lint.ts: -------------------------------------------------------------------------------- 1 | const Command = require('../ember-cli/lib/models/command'); 2 | import LintTask from '../tasks/lint'; 3 | 4 | export default Command.extend({ 5 | name: 'lint', 6 | description: 'Lints code in existing project', 7 | works: 'insideProject', 8 | run: function () { 9 | const lintTask = new LintTask({ 10 | ui: this.ui, 11 | analytics: this.analytics, 12 | project: this.project 13 | }); 14 | 15 | return lintTask.run(); 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /packages/universal-cli/models/webpack-build-development.ts: -------------------------------------------------------------------------------- 1 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); 2 | 3 | export const getWebpackDevConfigPartial = function(projectRoot: string, appConfig: any) { 4 | return { 5 | output: { 6 | filename: '[name].bundle.js', 7 | sourceMapFilename: '[name].bundle.map', 8 | chunkFilename: '[id].chunk.js' 9 | }, 10 | plugins: [ 11 | new ExtractTextPlugin({filename: '[name].bundle.css'}) 12 | ] 13 | }; 14 | }; 15 | -------------------------------------------------------------------------------- /packages/universal-cli/plugins/package-chunk-sort.ts: -------------------------------------------------------------------------------- 1 | export function packageChunkSort(packages: string[]) { 2 | return function sort(left: any, right: any) { 3 | let leftIndex = packages.indexOf(left.names[0]); 4 | let rightindex = packages.indexOf(right.names[0]); 5 | 6 | if ( leftIndex < 0 || rightindex < 0) { 7 | // Unknown packages are loaded last 8 | return 1; 9 | } 10 | 11 | if (leftIndex > rightindex) { 12 | return 1; 13 | } 14 | 15 | return -1; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /tests/e2e/setup/200-create-tmp-dir.ts: -------------------------------------------------------------------------------- 1 | import {setGlobalVariable, getGlobalVariable} from '../utils/env'; 2 | 3 | 4 | const temp = require('temp'); 5 | 6 | export default function() { 7 | const argv = getGlobalVariable('argv'); 8 | 9 | // Get to a temporary directory. 10 | let tempRoot = argv.reuse || temp.mkdirSync('universal-cli-e2e-'); 11 | console.log(` Using "${tempRoot}" as temporary directory for a new project.`); 12 | setGlobalVariable('tmp-root', tempRoot); 13 | process.chdir(tempRoot); 14 | } 15 | -------------------------------------------------------------------------------- /tests/models/spec-schema.d.ts: -------------------------------------------------------------------------------- 1 | export interface CliConfig { 2 | requiredKey: number; 3 | stringKeyDefault?: string; 4 | stringKey?: string; 5 | booleanKey?: boolean; 6 | numberKey?: number; 7 | objectKey1?: { 8 | stringKey?: string; 9 | objectKey?: { 10 | stringKey?: string; 11 | }; 12 | }; 13 | objectKey2?: { 14 | [name: string]: any; 15 | stringKey?: string; 16 | }; 17 | arrayKey1?: any[]; 18 | arrayKey2?: any[]; 19 | } 20 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/directive/files/__path__/__name__.directive.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async } from '@angular/core/testing'; 4 | import { <%= classifiedModuleName %>Directive } from './<%= dasherizedModuleName %>.directive'; 5 | 6 | describe('<%= classifiedModuleName %>Directive', () => { 7 | it('should create an instance', () => { 8 | let directive = new <%= classifiedModuleName %>Directive(); 9 | expect(directive).toBeTruthy(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/module/files/__path__/__name__.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common';<% if (routing) { %> 3 | import { <%= classifiedModuleName %>RoutingModule } from './<%= dasherizedModuleName %>-routing.module';<% } %> 4 | 5 | @NgModule({ 6 | imports: [ 7 | CommonModule<% if (routing) { %>, 8 | <%= classifiedModuleName %>RoutingModule<% } %> 9 | ], 10 | declarations: [] 11 | }) 12 | export class <%= classifiedModuleName %>Module { } 13 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/feature/feature.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule, Component} from '@angular/core'; 2 | import {RouterModule} from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'feature-component', 6 | template: 'foo.html' 7 | }) 8 | export class FeatureComponent {} 9 | 10 | @NgModule({ 11 | declarations: [ 12 | FeatureComponent 13 | ], 14 | imports: [ 15 | RouterModule.forChild([ 16 | { path: '', component: FeatureComponent} 17 | ]) 18 | ] 19 | }) 20 | export class FeatureModule {} 21 | -------------------------------------------------------------------------------- /docs/documentation/test.md: -------------------------------------------------------------------------------- 1 | # ng test 2 | 3 | ## Overview 4 | `ng test` compiles the application into an output directory 5 | 6 | ## Options 7 | `--watch` (`-w`) flag to run builds when files change 8 | 9 | `--browsers` override which browsers tests are run against 10 | 11 | `--colors` enable or disable colors in the output (reporters and logs) 12 | 13 | `--log-level` level of logging 14 | 15 | `--port` port where the web server will be listening 16 | 17 | `--reporters` list of reporters to use 18 | 19 | `--build` flag to build prior to running tests -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/tasks.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | CreateAndStepIntoDirectory: require('./tasks/create-and-step-into-directory'), 4 | DestroyFromBlueprint: require('./tasks/destroy-from-blueprint'), 5 | GenerateFromBlueprint: require('./tasks/generate-from-blueprint'), 6 | GitInit: require('./tasks/git-init'), 7 | InstallBlueprint: require('./tasks/install-blueprint'), 8 | NpmInstall: require('./tasks/npm-install'), 9 | NpmTask: require('./tasks/npm-task'), 10 | NpmUninstall: require('./tasks/npm-uninstall'), 11 | }; -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/app/feature/feature.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule, Component} from '@angular/core'; 2 | import {RouterModule} from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'feature-component', 6 | template: 'foo.html' 7 | }) 8 | export class FeatureComponent {} 9 | 10 | @NgModule({ 11 | declarations: [ 12 | FeatureComponent 13 | ], 14 | imports: [ 15 | RouterModule.forChild([ 16 | { path: '', component: FeatureComponent} 17 | ]) 18 | ] 19 | }) 20 | export class FeatureModule {} 21 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/deprecate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var chalk = require('chalk'); 4 | 5 | module.exports = function(message, test) { 6 | if (test) { 7 | console.log(chalk.yellow('DEPRECATION: ' + message)); 8 | } 9 | }; 10 | 11 | module.exports.deprecateUI = function(ui) { 12 | return function(message, test) { 13 | ui.writeDeprecateLine('The deprecateUI utility has been deprecated in favor of ui.writeDeprecateLine'); 14 | 15 | test = !test; 16 | 17 | ui.writeDeprecateLine(message, test); 18 | }; 19 | }; 20 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/sourcemap.ts: -------------------------------------------------------------------------------- 1 | import { ng } from '../../utils/process'; 2 | import { expectFileToExist } from '../../utils/fs'; 3 | import { expectToFail, getAppMain, getClientDist } from '../../utils/utils'; 4 | 5 | 6 | export default function () { 7 | return ng('build') 8 | .then(() => expectFileToExist(`${getClientDist()}${getAppMain()}.bundle.map`)) 9 | .then(() => ng('build', '--no-sourcemap')) 10 | .then(() => expectToFail(() => expectFileToExist( 11 | `${getClientDist()}${getAppMain()}.bundle.map` 12 | )) 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /tests/e2e/tests/generate/interface.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {ng} from '../../utils/process'; 3 | import {expectFileToExist} from '../../utils/fs'; 4 | 5 | 6 | export default function() { 7 | const interfaceDir = join('src', 'app'); 8 | 9 | return ng('generate', 'interface', 'test-interface', 'model') 10 | .then(() => expectFileToExist(interfaceDir)) 11 | .then(() => expectFileToExist(join(interfaceDir, 'test-interface.model.ts'))) 12 | 13 | // Try to run the unit tests. 14 | .then(() => ng('test', '--single-run')); 15 | } 16 | -------------------------------------------------------------------------------- /tests/e2e/utils/ast.ts: -------------------------------------------------------------------------------- 1 | import { 2 | insertImport as _insertImport, 3 | addImportToModule as _addImportToModule, 4 | NodeHost 5 | } from '@angular-cli/ast-tools'; 6 | 7 | 8 | export function insertImport(file: string, symbol: string, module: string) { 9 | return _insertImport(file, symbol, module) 10 | .then(change => change.apply(NodeHost)); 11 | } 12 | 13 | export function addImportToModule(file: string, symbol: string, module: string) { 14 | return _addImportToModule(file, symbol, module) 15 | .then(change => change.apply(NodeHost)); 16 | } 17 | -------------------------------------------------------------------------------- /docs/documentation/build.md: -------------------------------------------------------------------------------- 1 | # ng build 2 | 3 | ## Overview 4 | `ng build` compiles the application into an output directory 5 | 6 | ## Options 7 | `--target` (`-t`, `-dev`, `prod`) define the build target 8 | 9 | `--environment` (`-e`) 10 | 11 | `--output-path` (`-o`) path where output will be placed 12 | 13 | `--watch` (`-w`) flag to run builds when files change 14 | 15 | `--surpress-sizes` flag to suppress sizes from build output 16 | 17 | `--base-href` (`-bh`) base url for the application being built 18 | 19 | `--aot` flag whether to build using Ahead of Time compilation -------------------------------------------------------------------------------- /packages/universal-cli/utilities/INITIAL_COMMIT_MESSAGE.txt: -------------------------------------------------------------------------------- 1 | chore: initial commit from universal-cli 2 | .__ .__ .__ .__ 3 | __ __ ____ |__|__ __ ___________ ___________ | | ____ | | |__| 4 | | | \/ \| \ \/ // __ \_ __ \/ ___/\__ \ | | ______ _/ ___\| | | | 5 | | | / | \ |\ /\ ___/| | \/\___ \ / __ \| |__ /_____/ \ \___| |_| | 6 | |____/|___| /__| \_/ \___ >__| /____ >(____ /____/ \___ >____/__| 7 | \/ \/ \/ \/ \/ 8 | -------------------------------------------------------------------------------- /tests/e2e/tests/generate/class.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {ng} from '../../utils/process'; 3 | import {expectFileToExist} from '../../utils/fs'; 4 | 5 | 6 | export default function() { 7 | const classDir = join('src', 'app'); 8 | 9 | return ng('generate', 'class', 'test-class', '--spec') 10 | .then(() => expectFileToExist(classDir)) 11 | .then(() => expectFileToExist(join(classDir, 'test-class.ts'))) 12 | .then(() => expectFileToExist(join(classDir, 'test-class.spec.ts'))) 13 | 14 | // Try to run the unit tests. 15 | .then(() => ng('test', '--single-run')); 16 | } 17 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "", 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": ["es6", "dom"], 8 | "mapRoot": "./", 9 | "module": "es6", 10 | "moduleResolution": "node", 11 | "outDir": "<%= relativeRootPath %>/dist/out-tsc", 12 | "sourceMap": true, 13 | "target": "es5", 14 | "typeRoots": [ 15 | "<%= relativeRootPath %>/node_modules/@types" 16 | ]<% if(universal) { %>, 17 | "types": [ "node" ]<% } %> 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/helpers/mock-analytics.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = MockAnalytics; 4 | function MockAnalytics() { 5 | this.tracks = []; 6 | this.trackTimings = []; 7 | this.trackErrors = []; 8 | } 9 | 10 | MockAnalytics.prototype = Object.create({}); 11 | MockAnalytics.prototype.track = function(arg) { 12 | this.tracks.push(arg); 13 | }; 14 | 15 | MockAnalytics.prototype.trackTiming = function(arg) { 16 | this.trackTimings.push(arg); 17 | }; 18 | 19 | MockAnalytics.prototype.trackError = function(arg) { 20 | this.trackErrors.push(arg); 21 | }; 22 | 23 | MockAnalytics.prototype.constructor = MockAnalytics; 24 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/destroy.ts: -------------------------------------------------------------------------------- 1 | const Command = require('../ember-cli/lib/models/command'); 2 | const SilentError = require('silent-error'); 3 | 4 | 5 | const DestroyCommand = Command.extend({ 6 | name: 'destroy', 7 | aliases: ['d'], 8 | works: 'insideProject', 9 | 10 | anonymousOptions: [ 11 | '' 12 | ], 13 | 14 | run: function() { 15 | console.log('RUN'); 16 | return Promise.reject( 17 | new SilentError('The destroy command is not supported by Universal-CLI.') 18 | ); 19 | } 20 | }); 21 | 22 | export default DestroyCommand; 23 | DestroyCommand.overrideCore = true; 24 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/module/files/__path__/__name__.module.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async } from '@angular/core/testing'; 4 | import <%= classifiedModuleName %>Module from './<%= dasherizedModuleName %>.module'; 5 | 6 | describe('<%= classifiedModuleName %>Module', () => { 7 | let <%= camelizedModuleName %>Module; 8 | 9 | beforeEach(() => { 10 | <%= camelizedModuleName %>Module = new <%= classifiedModuleName %>Module(); 11 | }); 12 | 13 | it('should create an instance', () => { 14 | expect(<%= camelizedModuleName %>Module).toBeTruthy(); 15 | }) 16 | }); 17 | -------------------------------------------------------------------------------- /packages/@ngtools/webpack/src/utils.ts: -------------------------------------------------------------------------------- 1 | const ContextElementDependency = require('webpack/lib/dependencies/ContextElementDependency'); 2 | 3 | export function createResolveDependenciesFromContextMap(createContextMap: Function) { 4 | return (fs: any, resource: any, recursive: any, regExp: RegExp, callback: any) => { 5 | createContextMap(fs, function(err: Error, map: any) { 6 | if (err) { 7 | return callback(err); 8 | } 9 | 10 | const dependencies = Object.keys(map) 11 | .map((key) => new ContextElementDependency(map[key], key)); 12 | 13 | callback(null, dependencies); 14 | }); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/completion.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as fs from 'fs'; 3 | 4 | const Command = require('../ember-cli/lib/models/command'); 5 | 6 | const CompletionCommand = Command.extend({ 7 | name: 'completion', 8 | description: 'Adds autocomplete functionality to `ng` commands and subcommands', 9 | works: 'everywhere', 10 | run: function() { 11 | const scriptPath = path.resolve(__dirname, '..', 'utilities', 'completion.sh'); 12 | const scriptOutput = fs.readFileSync(scriptPath, 'utf8'); 13 | 14 | console.log(scriptOutput); 15 | } 16 | }); 17 | 18 | export default CompletionCommand; 19 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "target": "es5", 7 | "noImplicitAny": false, 8 | "sourceMap": true, 9 | "mapRoot": "", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "lib": [ 13 | "es2015", 14 | "dom" 15 | ], 16 | "outDir": "lib", 17 | "skipLibCheck": true, 18 | "rootDir": "." 19 | }, 20 | "angularCompilerOptions": { 21 | "genDir": "./app/ngfactory", 22 | "entryModule": "app/app.module#AppModule" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/e2e/tests/generate/pipe.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {ng} from '../../utils/process'; 3 | import {expectFileToExist} from '../../utils/fs'; 4 | 5 | 6 | export default function() { 7 | // Create the pipe in the same directory. 8 | const pipeDir = join('src', 'app'); 9 | 10 | return ng('generate', 'pipe', 'test-pipe') 11 | .then(() => expectFileToExist(pipeDir)) 12 | .then(() => expectFileToExist(join(pipeDir, 'test-pipe.pipe.ts'))) 13 | .then(() => expectFileToExist(join(pipeDir, 'test-pipe.pipe.spec.ts'))) 14 | 15 | // Try to run the unit tests. 16 | .then(() => ng('test', '--single-run')); 17 | } 18 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/attempt-never-index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var isDarwin = /darwin/i.test(require('os').type()); 4 | var debug = require('debug')('ember-cli:utilities/attempt-metadata-index-file'); 5 | 6 | module.exports = function(dir) { 7 | var path = dir + '/.metadata_never_index'; 8 | 9 | if (!isDarwin) { 10 | debug('not darwin, skipping %s (which hints to spotlight to prevent indexing)', path); 11 | return; 12 | } 13 | 14 | debug('creating: %s (to prevent spotlight indexing)', path); 15 | 16 | var fs = require('fs-extra'); 17 | 18 | fs.mkdirsSync(dir); 19 | fs.writeFileSync(path); 20 | }; 21 | -------------------------------------------------------------------------------- /tests/helpers/tmp.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var fs = require('fs-extra'); 4 | var existsSync = require('exists-sync'); 5 | var Promise = require('universal-cli/ember-cli/lib/ext/promise'); 6 | var remove = Promise.denodeify(fs.remove); 7 | var root = process.cwd(); 8 | 9 | module.exports.setup = function (path) { 10 | process.chdir(root); 11 | 12 | return remove(path).then(function () { 13 | fs.mkdirsSync(path); 14 | }); 15 | }; 16 | 17 | module.exports.teardown = function (path) { 18 | process.chdir(root); 19 | 20 | if (existsSync(path)) { 21 | return remove(path); 22 | } else { 23 | return Promise.resolve(); 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /tests/runner.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console */ 2 | 'use strict'; 3 | 4 | require('../lib/bootstrap-local'); 5 | 6 | var Mocha = require('mocha'); 7 | var glob = require('glob'); 8 | var path = require('path'); 9 | 10 | var root = 'tests/{acceptance,models}'; 11 | var specFiles = glob.sync(root + '/**/*.spec.*'); 12 | var mocha = new Mocha({ timeout: 5000, reporter: 'spec' }); 13 | 14 | process.env.CLI_ROOT = process.env.CLI_ROOT || path.resolve(__dirname, '..'); 15 | 16 | specFiles.forEach(mocha.addFile.bind(mocha)); 17 | 18 | mocha.run(function (failures) { 19 | process.on('exit', function () { 20 | process.exit(failures); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "target": "es5", 7 | "noImplicitAny": false, 8 | "sourceMap": true, 9 | "mapRoot": "", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "lib": [ 13 | "es2015", 14 | "dom" 15 | ], 16 | "outDir": "lib", 17 | "skipLibCheck": true, 18 | "rootDir": "." 19 | }, 20 | "angularCompilerOptions": { 21 | "genDir": "app/generated/", 22 | "entryModule": "app/app.module#AppModule" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/commands/unknown.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Command = require('../models/command'); 4 | var SilentError = require('silent-error'); 5 | var chalk = require('chalk'); 6 | 7 | module.exports = Command.extend({ 8 | skipHelp: true, 9 | unknown: true, 10 | 11 | printBasicHelp: function() { 12 | return chalk.red('No help entry for \'' + this.name + '\''); 13 | }, 14 | 15 | validateAndRun: function() { 16 | throw new SilentError('The specified command ' + this.name + 17 | ' is invalid. For available options, see' + 18 | ' `ember help`.'); 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /tests/e2e/tests/generate/service.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {ng} from '../../utils/process'; 3 | import {expectFileToExist} from '../../utils/fs'; 4 | 5 | 6 | export default function() { 7 | // Does not create a sub directory. 8 | const serviceDir = join('src', 'app'); 9 | 10 | return ng('generate', 'service', 'test-service') 11 | .then(() => expectFileToExist(serviceDir)) 12 | .then(() => expectFileToExist(join(serviceDir, 'test-service.service.ts'))) 13 | .then(() => expectFileToExist(join(serviceDir, 'test-service.service.spec.ts'))) 14 | 15 | // Try to run the unit tests. 16 | .then(() => ng('test', '--single-run')); 17 | } 18 | -------------------------------------------------------------------------------- /tests/e2e/utils/http.ts: -------------------------------------------------------------------------------- 1 | import {IncomingMessage} from 'http'; 2 | import * as _request from 'request'; 3 | 4 | 5 | export function request(url: string): Promise { 6 | return new Promise((resolve, reject) => { 7 | let options = { url: url, agentOptions: { rejectUnauthorized: false }}; 8 | _request(options, (error: any, response: IncomingMessage, body: string) => { 9 | if (error) { 10 | reject(error); 11 | } else if (response.statusCode >= 400) { 12 | reject(new Error(`Requesting "${url}" returned status code ${response.statusCode}.`)); 13 | } else { 14 | resolve(body); 15 | } 16 | }); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/service/files/__path__/__name__.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async, inject } from '@angular/core/testing'; 4 | import { <%= classifiedModuleName %>Service } from './<%= dasherizedModuleName %>.service'; 5 | 6 | describe('<%= classifiedModuleName %>Service', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | providers: [<%= classifiedModuleName %>Service] 10 | }); 11 | }); 12 | 13 | it('should ...', inject([<%= classifiedModuleName %>Service], (service: <%= classifiedModuleName %>Service) => { 14 | expect(service).toBeTruthy(); 15 | })); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/@angular-cli/base-href-webpack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@angular-cli/base-href-webpack", 3 | "version": "1.0.9", 4 | "description": "Base HREF Webpack plugin", 5 | "main": "./src/index.js", 6 | "keywords": [ 7 | "angular", 8 | "cli", 9 | "webpack", 10 | "plugin", 11 | "tool" 12 | ], 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/angular/angular-cli.git" 16 | }, 17 | "author": "angular", 18 | "license": "MIT", 19 | "bugs": { 20 | "url": "https://github.com/angular/angular-cli/issues" 21 | }, 22 | "homepage": "https://github.com/angular/angular-cli", 23 | "dependencies": { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core';<% if (isMobile) { %> 2 | import { APP_SHELL_DIRECTIVES } from '@angular/app-shell';<% } %> 3 | 4 | @Component({ 5 | selector: '<%= prefix %>-root',<% if (inlineTemplate) { %> 6 | template: ` 7 |

8 | {{title}} 9 |

<% if (routing) { %> 10 | <% } %> 11 | `,<% } else { %> 12 | templateUrl: './app.component.html',<% } %><% if (inlineStyle) { %> 13 | styles: []<% } else { %> 14 | styleUrls: ['./app.component.<%= styleExt %>']<% } %> 15 | }) 16 | export class AppComponent { 17 | title = '<%= prefix %> works!'; 18 | } 19 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/e2e.ts: -------------------------------------------------------------------------------- 1 | const Command = require('../ember-cli/lib/models/command'); 2 | import {E2eTask} from '../tasks/e2e'; 3 | import {CliConfig} from '../models/config'; 4 | 5 | const E2eCommand = Command.extend({ 6 | name: 'e2e', 7 | description: 'Run e2e tests in existing project', 8 | works: 'insideProject', 9 | run: function () { 10 | this.project.ngConfig = this.project.ngConfig || CliConfig.fromProject(); 11 | 12 | const e2eTask = new E2eTask({ 13 | ui: this.ui, 14 | analytics: this.analytics, 15 | project: this.project 16 | }); 17 | 18 | return e2eTask.run(); 19 | } 20 | }); 21 | 22 | 23 | export default E2eCommand; 24 | -------------------------------------------------------------------------------- /packages/universal-cli/tasks/link-cli.ts: -------------------------------------------------------------------------------- 1 | const Task = require('../ember-cli/lib/models/task'); 2 | import * as chalk from 'chalk'; 3 | import {exec} from 'child_process'; 4 | 5 | export default Task.extend({ 6 | run: function() { 7 | const ui = this.ui; 8 | 9 | return new Promise(function(resolve, reject) { 10 | exec('npm link universal-cli', (err) => { 11 | if (err) { 12 | ui.writeLine(chalk.red('Couldn\'t do \'npm link universal-cli\'.')); 13 | reject(); 14 | } else { 15 | ui.writeLine(chalk.green('Successfully linked to universal-cli.')); 16 | resolve(); 17 | } 18 | }); 19 | }); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /packages/@angular-cli/ast-tools/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "experimentalDecorators": true, 5 | "mapRoot": "", 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "noEmitOnError": true, 9 | "noImplicitAny": true, 10 | "outDir": "../../../dist/@angular-cli/ast-tools", 11 | "rootDir": ".", 12 | "sourceMap": true, 13 | "sourceRoot": "/", 14 | "target": "es5", 15 | "lib": ["es6"], 16 | "typeRoots": [ 17 | "../../node_modules/@types" 18 | ], 19 | "types": [ 20 | "jasmine", 21 | "node" 22 | ] 23 | }, 24 | "exclude": [ 25 | "**/*.spec.ts" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /docs/documentation/generate/component.md: -------------------------------------------------------------------------------- 1 | # ng generate component 2 | 3 | ## Overview 4 | `ng generate component [name]` generates a component 5 | 6 | ## Options 7 | `--flat` flag to indicate if a dir is created 8 | 9 | `--inline-template` (`-it`) specifies if the template will be in the ts file 10 | 11 | `--inline-style` (`-is`) specifies if the style will be in the ts file 12 | 13 | `--prefix` specifies whether to use the prefix 14 | 15 | `--spec` specifies if a spec file is generated 16 | 17 | `--view-encapsulation` (`-ve`) set the view encapsulation strategy 18 | 19 | `--change-detection` (`-cd`) set the change detection strategy 20 | 21 | `--skip-import` allows for skipping the module import 22 | -------------------------------------------------------------------------------- /packages/@ngtools/webpack/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "experimentalDecorators": true, 5 | "mapRoot": "", 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "noEmitOnError": true, 9 | "noImplicitAny": true, 10 | "outDir": "../../../dist/@ngtools/webpack", 11 | "rootDir": ".", 12 | "lib": ["es2015", "es6", "dom"], 13 | "target": "es5", 14 | "sourceMap": true, 15 | "sourceRoot": "/", 16 | "baseUrl": "./", 17 | "paths": { 18 | }, 19 | "typeRoots": [ 20 | "../../node_modules/@types" 21 | ], 22 | "types": [ 23 | "jasmine", 24 | "node" 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/universal-cli/tasks/lint.ts: -------------------------------------------------------------------------------- 1 | const Task = require('../ember-cli/lib/models/task'); 2 | import * as chalk from 'chalk'; 3 | import {exec} from 'child_process'; 4 | 5 | export default Task.extend({ 6 | run: function () { 7 | const ui = this.ui; 8 | 9 | return new Promise(function(resolve, reject) { 10 | exec('npm run lint', (err, stdout) => { 11 | ui.writeLine(stdout); 12 | if (err) { 13 | ui.writeLine(chalk.red('Lint errors found in the listed files.')); 14 | reject(); 15 | } else { 16 | ui.writeLine(chalk.green('All files pass linting.')); 17 | resolve(); 18 | } 19 | }); 20 | }); 21 | } 22 | }); 23 | -------------------------------------------------------------------------------- /packages/@angular-cli/base-href-webpack/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "experimentalDecorators": true, 5 | "mapRoot": "", 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "noEmitOnError": true, 9 | "noImplicitAny": true, 10 | "outDir": "../../../dist/@angular-cli/base-href-webpack", 11 | "rootDir": ".", 12 | "sourceMap": true, 13 | "sourceRoot": "/", 14 | "target": "es5", 15 | "lib": ["es6"], 16 | "typeRoots": [ 17 | "../../node_modules/@types" 18 | ], 19 | "types": [ 20 | "jasmine", 21 | "node" 22 | ] 23 | }, 24 | "exclude": [ 25 | "**/*.spec.ts" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/find-build-file.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var findUp = require('findup').sync; 4 | var path = require('path'); 5 | 6 | module.exports = function(file) { 7 | var buildFilePath = findUp(file); 8 | 9 | // Note 10 | // In the future this should throw 11 | if (buildFilePath === null) { 12 | return null; 13 | } 14 | 15 | var baseDir = path.dirname(buildFilePath); 16 | 17 | process.chdir(baseDir); 18 | 19 | var buildFile = null; 20 | try { 21 | buildFile = require(buildFilePath); 22 | } catch (err) { 23 | err.message = 'Could not require \'' + file + '\': ' + err.message; 24 | throw err; 25 | } 26 | 27 | return buildFile; 28 | }; 29 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/mk-tmp-dir-in.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Promise = require('../ext/promise'); 4 | var fs = require('fs-extra'); 5 | var temp = require('temp'); 6 | var mkdir = Promise.denodeify(fs.mkdir); 7 | var mkdirTemp = Promise.denodeify(temp.mkdir); 8 | 9 | function exists(dir) { 10 | return new Promise(function(resolve) { 11 | fs.exists(dir, resolve); 12 | }); 13 | } 14 | 15 | function mkTmpDirIn(dir) { 16 | return exists(dir).then(function(doesExist) { 17 | if (!doesExist) { 18 | return mkdir(dir); 19 | } 20 | }).then(function() { 21 | return mkdirTemp({ dir: dir }); 22 | }); 23 | } 24 | 25 | module.exports = mkTmpDirIn; 26 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/universal/files/__path__/client.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * the polyfills must be the first thing imported 3 | */ 4 | import './polyfills.ts'; 5 | import './__2.1.1.workaround.ts'; // temporary until 2.1.1 things are patched in Core 6 | import { enableProdMode } from '@angular/core'; 7 | import { environment } from './environments/environment'; 8 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 9 | import { BrowserAppModule } from './app/app.browser.module'; 10 | 11 | /** 12 | * enable prod mode for production environments 13 | */ 14 | if (environment.production) { 15 | enableProdMode(); 16 | } 17 | 18 | platformBrowserDynamic().bootstrapModule(BrowserAppModule); 19 | -------------------------------------------------------------------------------- /tests/e2e/setup/300-log-environment.ts: -------------------------------------------------------------------------------- 1 | import {node, ng, npm} from '../utils/process'; 2 | 3 | const packages = require('../../../lib/packages'); 4 | 5 | 6 | export default function() { 7 | return Promise.resolve() 8 | .then(() => console.log('Environment:')) 9 | .then(() => { 10 | Object.keys(process.env).forEach(envName => { 11 | console.log(` ${envName}: ${process.env[envName].replace(/[\n\r]+/g, '\n ')}`); 12 | }); 13 | }) 14 | .then(() => { 15 | console.log('Packages:'); 16 | console.log(JSON.stringify(packages, null, 2)); 17 | }) 18 | .then(() => node('--version')) 19 | .then(() => npm('--version')) 20 | .then(() => ng('version')); 21 | } 22 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/filename.ts: -------------------------------------------------------------------------------- 1 | import {ng} from '../../utils/process'; 2 | import {expectFileToExist} from '../../utils/fs'; 3 | import {updateJsonFile} from '../../utils/project'; 4 | import {copyFile} from '../../utils/fs'; 5 | 6 | 7 | export default function() { 8 | return Promise.resolve() 9 | .then(() => copyFile('src/index.html', 'src/config-index.html')) 10 | .then(() => updateJsonFile('angular-cli.json', configJson => { 11 | const app = configJson['apps'][0]; 12 | app['outDir'] = 'config-build-output'; 13 | app['index'] = 'config-index.html'; 14 | })) 15 | .then(() => ng('build')) 16 | .then(() => expectFileToExist('./config-build-output/config-index.html')); 17 | } 18 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/doc.ts: -------------------------------------------------------------------------------- 1 | const Command = require('../ember-cli/lib/models/command'); 2 | import { DocTask } from '../tasks/doc'; 3 | 4 | const DocCommand = Command.extend({ 5 | name: 'doc', 6 | description: 'Opens the official Angular documentation for a given keyword.', 7 | works: 'everywhere', 8 | 9 | anonymousOptions: [ 10 | '' 11 | ], 12 | 13 | run: function(commandOptions: any, rawArgs: Array) { 14 | const keyword = rawArgs[0]; 15 | 16 | const docTask = new DocTask({ 17 | ui: this.ui, 18 | analytics: this.analytics, 19 | project: this.project 20 | }); 21 | 22 | return docTask.run(keyword); 23 | } 24 | }); 25 | 26 | export default DocCommand; 27 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | 19 | # IDE - VSCode 20 | .vscode/* 21 | !.vscode/settings.json 22 | !.vscode/tasks.json 23 | !.vscode/launch.json 24 | !.vscode/extensions.json 25 | 26 | # misc 27 | /.sass-cache 28 | /connect.lock 29 | /coverage/* 30 | /libpeerconnection.log 31 | npm-debug.log 32 | testem.log 33 | /typings 34 | 35 | # e2e 36 | /e2e/*.js 37 | /e2e/*.map 38 | 39 | #System Files 40 | .DS_Store 41 | Thumbs.db 42 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/feature/lazy-feature.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule, Component} from '@angular/core'; 2 | import {RouterModule} from '@angular/router'; 3 | import {HttpModule, Http} from '@angular/http'; 4 | 5 | @Component({ 6 | selector: 'lazy-feature-comp', 7 | template: 'lazy feature!' 8 | }) 9 | export class LazyFeatureComponent {} 10 | 11 | @NgModule({ 12 | imports: [ 13 | RouterModule.forChild([ 14 | {path: '', component: LazyFeatureComponent, pathMatch: 'full'}, 15 | {path: 'feature', loadChildren: './feature.module#FeatureModule'} 16 | ]), 17 | HttpModule 18 | ], 19 | declarations: [LazyFeatureComponent] 20 | }) 21 | export class LazyFeatureModule { 22 | constructor(http: Http) {} 23 | } 24 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Component } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouterModule } from '@angular/router'; 4 | import { AppComponent } from './app.component'; 5 | 6 | @Component({ 7 | selector: 'home-view', 8 | template: 'home!' 9 | }) 10 | export class HomeView {} 11 | 12 | 13 | @NgModule({ 14 | declarations: [ 15 | AppComponent, 16 | HomeView 17 | ], 18 | imports: [ 19 | BrowserModule, 20 | RouterModule.forRoot([ 21 | {path: 'lazy', loadChildren: './lazy.module#LazyModule'}, 22 | {path: '', component: HomeView} 23 | ]) 24 | ], 25 | bootstrap: [AppComponent] 26 | }) 27 | export class AppModule { } 28 | -------------------------------------------------------------------------------- /tests/e2e/tests/packages/webpack/test.ts: -------------------------------------------------------------------------------- 1 | import {createProjectFromAsset} from '../../../utils/assets'; 2 | import {exec} from '../../../utils/process'; 3 | import {expectFileSizeToBeUnder} from '../../../utils/fs'; 4 | 5 | 6 | export default function(skipCleaning: () => void) { 7 | if (process.platform.startsWith('win')) { 8 | // Disable the test on Windows. 9 | return Promise.resolve(); 10 | } 11 | 12 | return Promise.resolve() 13 | .then(() => createProjectFromAsset('webpack/test-app')) 14 | .then(() => exec('node_modules/.bin/webpack', '-p')) 15 | .then(() => expectFileSizeToBeUnder('dist/app.main.js', 400000)) 16 | .then(() => expectFileSizeToBeUnder('dist/0.app.main.js', 40000)) 17 | .then(() => skipCleaning()); 18 | } 19 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/ext/core-object.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function CoreObject(options) { 4 | Object.assign(this, options); 5 | } 6 | 7 | module.exports = CoreObject; 8 | 9 | CoreObject.prototype.constructor = CoreObject; 10 | 11 | CoreObject.extend = function(options) { 12 | var constructor = this; 13 | function Class() { 14 | constructor.apply(this, arguments); 15 | if (this.init) { 16 | this.init(options); 17 | } 18 | } 19 | 20 | Class.__proto__ = CoreObject; 21 | 22 | Class.prototype = Object.create(constructor.prototype); 23 | Object.assign(Class.prototype, options); 24 | Class.prototype.constructor = Class; 25 | Class.prototype._super = constructor.prototype; 26 | 27 | return Class; 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/app/feature/lazy-feature.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule, Component} from '@angular/core'; 2 | import {RouterModule} from '@angular/router'; 3 | import {HttpModule, Http} from '@angular/http'; 4 | 5 | @Component({ 6 | selector: 'lazy-feature-comp', 7 | template: 'lazy feature!' 8 | }) 9 | export class LazyFeatureComponent {} 10 | 11 | @NgModule({ 12 | imports: [ 13 | RouterModule.forChild([ 14 | {path: '', component: LazyFeatureComponent, pathMatch: 'full'}, 15 | {path: 'feature', loadChildren: './feature.module#FeatureModule'} 16 | ]), 17 | HttpModule 18 | ], 19 | declarations: [LazyFeatureComponent] 20 | }) 21 | export class LazyFeatureModule { 22 | constructor(http: Http) {} 23 | } 24 | -------------------------------------------------------------------------------- /packages/@ngtools/webpack/src/webpack.ts: -------------------------------------------------------------------------------- 1 | // Declarations for (some) Webpack types. Only what's needed. 2 | 3 | export interface Request { 4 | request?: Request; 5 | relativePath: string; 6 | } 7 | 8 | export interface Callback { 9 | (err?: Error | null, result?: T): void; 10 | } 11 | 12 | export interface ResolverCallback { 13 | (request: Request, callback: Callback): void; 14 | } 15 | 16 | export interface Tapable { 17 | apply(plugin: ResolverPlugin): void; 18 | } 19 | 20 | export interface ResolverPlugin extends Tapable { 21 | plugin(source: string, cb: ResolverCallback): void; 22 | doResolve(target: string, req: Request, desc: string, callback: Callback): void; 23 | join(relativePath: string, innerRequest: Request): Request; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Component } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouterModule } from '@angular/router'; 4 | import { AppComponent } from './app.component'; 5 | 6 | @Component({ 7 | selector: 'home-view', 8 | template: 'home!' 9 | }) 10 | export class HomeView {} 11 | 12 | 13 | @NgModule({ 14 | declarations: [ 15 | AppComponent, 16 | HomeView 17 | ], 18 | imports: [ 19 | BrowserModule, 20 | RouterModule.forRoot([ 21 | {path: 'lazy', loadChildren: './lazy.module#LazyModule'}, 22 | {path: '', component: HomeView} 23 | ]) 24 | ], 25 | bootstrap: [AppComponent] 26 | }) 27 | export class AppModule { } 28 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/ui/write-error.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var chalk = require('chalk'); 3 | 4 | module.exports = function writeError(ui, error) { 5 | if (!error) { return; } 6 | 7 | // Uglify errors have a filename instead 8 | var fileName = error.file || error.filename; 9 | if (fileName) { 10 | if (error.line) { 11 | fileName += error.col ? ' (' + error.line + ':' + error.col + ')' : ' (' + error.line + ')'; 12 | } 13 | ui.writeLine(chalk.red('File: ' + fileName), 'ERROR'); 14 | } 15 | 16 | if (error.message) { 17 | ui.writeLine(chalk.red(error.message), 'ERROR'); 18 | } else { 19 | ui.writeLine(chalk.red(error), 'ERROR'); 20 | } 21 | 22 | if (error.stack) { 23 | ui.writeLine(error.stack, 'ERROR'); 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /tests/e2e/tests/misc/universal-serve.ts: -------------------------------------------------------------------------------- 1 | import { request } from '../../utils/http'; 2 | import { killAllProcesses } from '../../utils/process'; 3 | import { ngUniversalServe } from '../../utils/project'; 4 | import { isUniversalTest } from '../../utils/utils'; 5 | 6 | 7 | export default function () { 8 | if (!isUniversalTest()) { 9 | return Promise.resolve(); 10 | } 11 | return Promise.resolve() 12 | .then(() => ngUniversalServe()) 13 | .then(() => request('http://localhost:4200')) 14 | .then(body => { 15 | if (!body.match(/app works!/)) { 16 | throw new Error('Response does not match expected value.'); 17 | } 18 | }) 19 | .then(() => killAllProcesses(), (err) => { 20 | killAllProcesses(); 21 | throw err; 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/webpack.config.js: -------------------------------------------------------------------------------- 1 | const ngToolsWebpack = require('@ngtools/webpack'); 2 | 3 | module.exports = { 4 | resolve: { 5 | extensions: ['.ts', '.js'] 6 | }, 7 | entry: './not/so/source/app/main.jit.ts', 8 | output: { 9 | path: './dist', 10 | publicPath: 'dist/', 11 | filename: 'app.main.js' 12 | }, 13 | plugins: [ 14 | new ngToolsWebpack.AotPlugin(require('./aotplugin.config.json')) 15 | ], 16 | module: { 17 | loaders: [ 18 | { test: /\.scss$/, loaders: ['raw-loader', 'sass-loader'] }, 19 | { test: /\.css$/, loader: 'raw-loader' }, 20 | { test: /\.html$/, loader: 'raw-loader' }, 21 | { test: /\.ts$/, loader: '@ngtools/webpack' } 22 | ] 23 | }, 24 | devServer: { 25 | historyApiFallback: true 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/webpack.config.js: -------------------------------------------------------------------------------- 1 | const ngToolsWebpack = require('@ngtools/webpack'); 2 | 3 | module.exports = { 4 | resolve: { 5 | extensions: ['.ts', '.js'] 6 | }, 7 | entry: './app/main.aot.ts', 8 | output: { 9 | path: './dist', 10 | publicPath: 'dist/', 11 | filename: 'app.main.js' 12 | }, 13 | plugins: [ 14 | new ngToolsWebpack.AotPlugin({ 15 | tsConfigPath: './tsconfig.json' 16 | }) 17 | ], 18 | module: { 19 | loaders: [ 20 | { test: /\.scss$/, loaders: ['raw-loader', 'sass-loader'] }, 21 | { test: /\.css$/, loader: 'raw-loader' }, 22 | { test: /\.html$/, loader: 'raw-loader' }, 23 | { test: /\.ts$/, loader: '@ngtools/webpack' } 24 | ] 25 | }, 26 | devServer: { 27 | historyApiFallback: true 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /scripts/publish/shrinkwrap.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | 4 | 5 | function removeResolvedKeys(json) { 6 | if (json['resolved']) { 7 | delete json['resolved']; 8 | } 9 | if (json['_resolved']) { 10 | delete json['_resolved']; 11 | } 12 | 13 | const deps = json['dependencies'] || {}; 14 | for (const key of Object.keys(deps)) { 15 | deps[key] = removeResolvedKeys(deps[key]); 16 | } 17 | 18 | return json; 19 | } 20 | 21 | 22 | const fs = require('fs'); 23 | const path = require('path'); 24 | 25 | const shrinkwrapPath = path.join(__dirname, '../../npm-shrinkwrap.json'); 26 | const shrinkwrap = JSON.parse(fs.readFileSync(shrinkwrapPath, 'utf-8')); 27 | 28 | const newJson = removeResolvedKeys(shrinkwrap); 29 | fs.writeFileSync(shrinkwrapPath, JSON.stringify(newJson, null, 2), 'utf-8'); 30 | -------------------------------------------------------------------------------- /tests/e2e/tests/misc/ssl-default.ts: -------------------------------------------------------------------------------- 1 | import { request } from '../../utils/http'; 2 | import { killAllProcesses } from '../../utils/process'; 3 | import { ngServe } from '../../utils/project'; 4 | import { isUniversalTest } from '../../utils/utils'; 5 | 6 | 7 | export default function() { 8 | /** This test is disabled for universal */ 9 | if (isUniversalTest()) { 10 | return Promise.resolve(); 11 | } 12 | 13 | return Promise.resolve() 14 | .then(() => ngServe('--ssl', 'true')) 15 | .then(() => request('https://localhost:4200/')) 16 | .then(body => { 17 | if (!body.match(/Loading...<\/app-root>/)) { 18 | throw new Error('Response does not match expected value.'); 19 | } 20 | }) 21 | .then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; }); 22 | } 23 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/app/lazy.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule, Component} from '@angular/core'; 2 | import {RouterModule} from '@angular/router'; 3 | import {HttpModule, Http} from '@angular/http'; 4 | 5 | @Component({ 6 | selector: 'lazy-comp', 7 | template: 'lazy!' 8 | }) 9 | export class LazyComponent {} 10 | 11 | @NgModule({ 12 | imports: [ 13 | RouterModule.forChild([ 14 | {path: '', component: LazyComponent, pathMatch: 'full'}, 15 | {path: 'feature', loadChildren: './feature/feature.module#FeatureModule'}, 16 | {path: 'lazy-feature', loadChildren: './feature/lazy-feature.module#LazyFeatureModule'} 17 | ]), 18 | HttpModule 19 | ], 20 | declarations: [LazyComponent] 21 | }) 22 | export class LazyModule { 23 | constructor(http: Http) {} 24 | } 25 | 26 | export class SecondModule {} 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | > Please provide us with the following information: 2 | > --------------------------------------------------------------- 3 | 4 | ### OS? 5 | > Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) 6 | 7 | 8 | ### Versions. 9 | > Please run `ung --version`. If there's nothing outputted, please run in a Terminal: `node --version` and paste the result here: 10 | 11 | 12 | ### Repro steps. 13 | > Was this an app that wasn't created using the CLI? What change did you do on your code? etc. 14 | 15 | 16 | ### The log given by the failure. 17 | > Normally this include a stack trace and some more information. 18 | 19 | 20 | ### Mention any other details that might be useful. 21 | 22 | > --------------------------------------------------------------- 23 | > Thanks! We'll be in touch soon. 24 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/version-utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var existsSync = require('exists-sync'); 4 | var path = require('path'); 5 | var getRepoInfo = require('git-repo-info'); 6 | 7 | module.exports = { 8 | emberCLIVersion: function emberCLIVersion() { 9 | var gitPath = path.join(__dirname, '..','..','.git'); 10 | var output = [require('../../../package.json').version]; 11 | 12 | if (existsSync(gitPath)) { 13 | var repoInfo = getRepoInfo(gitPath); 14 | 15 | output.push(repoInfo.branch); 16 | output.push(repoInfo.abbreviatedSha); 17 | } 18 | 19 | return output.join('-'); 20 | }, 21 | 22 | isDevelopment: function isDevelopment(version) { 23 | // match postfix SHA in dev version 24 | return !!version.match(/\b[0-9a-f]{5,40}\b/); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /packages/@angular-cli/ast-tools/src/spec-utils.ts: -------------------------------------------------------------------------------- 1 | // This file exports a version of the Jasmine `it` that understands promises. 2 | // To use this, simply `import {it} from './spec-utils`. 3 | // TODO(hansl): move this to its own Jasmine-TypeScript package. 4 | 5 | function async(fn: () => PromiseLike | void) { 6 | return (done: DoneFn) => { 7 | let result: PromiseLike | void = null; 8 | 9 | try { 10 | result = fn(); 11 | 12 | if (result && 'then' in result) { 13 | (result as Promise).then(done, done.fail); 14 | } else { 15 | done(); 16 | } 17 | } catch (err) { 18 | done.fail(err); 19 | } 20 | }; 21 | } 22 | 23 | 24 | export function it(description: string, fn: () => PromiseLike | void) { 25 | return (global as any)['it'](description, async(fn)); 26 | } 27 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/polyfills.ts: -------------------------------------------------------------------------------- 1 | // This file includes polyfills needed by Angular 2 and is loaded before 2 | // the app. You can add your own extra polyfills to this file. 3 | <% if(universal) { %> 4 | import 'angular2-universal-polyfills';<% } %> 5 | import 'core-js/es6/symbol'; 6 | import 'core-js/es6/object'; 7 | import 'core-js/es6/function'; 8 | import 'core-js/es6/parse-int'; 9 | import 'core-js/es6/parse-float'; 10 | import 'core-js/es6/number'; 11 | import 'core-js/es6/math'; 12 | import 'core-js/es6/string'; 13 | import 'core-js/es6/date'; 14 | import 'core-js/es6/array'; 15 | import 'core-js/es6/regexp'; 16 | import 'core-js/es6/map'; 17 | import 'core-js/es6/set'; 18 | import 'core-js/es6/reflect'; 19 | 20 | import 'core-js/es7/reflect';<% if(!universal) { %> 21 | import 'zone.js/dist/zone';<% } %> 22 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/not/so/source/app/lazy.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule, Component} from '@angular/core'; 2 | import {RouterModule} from '@angular/router'; 3 | import {HttpModule, Http} from '@angular/http'; 4 | 5 | @Component({ 6 | selector: 'lazy-comp', 7 | template: 'lazy!' 8 | }) 9 | export class LazyComponent {} 10 | 11 | @NgModule({ 12 | imports: [ 13 | RouterModule.forChild([ 14 | {path: '', component: LazyComponent, pathMatch: 'full'}, 15 | {path: 'feature', loadChildren: './feature/feature.module#FeatureModule'}, 16 | {path: 'lazy-feature', loadChildren: './feature/lazy-feature.module#LazyFeatureModule'} 17 | ]), 18 | HttpModule 19 | ], 20 | declarations: [LazyComponent] 21 | }) 22 | export class LazyModule { 23 | constructor(http: Http) {} 24 | } 25 | 26 | export class SecondModule {} 27 | -------------------------------------------------------------------------------- /packages/@angular-cli/ast-tools/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@angular-cli/ast-tools", 3 | "version": "1.0.10", 4 | "description": "CLI tool for Angular", 5 | "main": "./src/index.js", 6 | "keywords": [ 7 | "angular", 8 | "cli", 9 | "ast", 10 | "tool" 11 | ], 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/angular/angular-cli.git" 15 | }, 16 | "author": "angular", 17 | "license": "MIT", 18 | "bugs": { 19 | "url": "https://github.com/angular/angular-cli/issues" 20 | }, 21 | "homepage": "https://github.com/angular/angular-cli", 22 | "engines": { 23 | "node": ">= 4.1.0", 24 | "npm": ">= 3.0.0" 25 | }, 26 | "dependencies": { 27 | "@angular/tsc-wrapped": "0.4.0", 28 | "rxjs": "5.0.0-beta.12", 29 | "denodeify": "^1.2.1", 30 | "typescript": "~2.0.3" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/universal-cli/tasks/npm-install.ts: -------------------------------------------------------------------------------- 1 | const Task = require('../ember-cli/lib/models/task'); 2 | import * as chalk from 'chalk'; 3 | import {exec} from 'child_process'; 4 | 5 | 6 | export default Task.extend({ 7 | run: function() { 8 | const ui = this.ui; 9 | 10 | return new Promise(function(resolve, reject) { 11 | ui.writeLine(chalk.green('Installing packages for tooling via npm.')); 12 | exec('npm install', 13 | (err: NodeJS.ErrnoException, stdout: string, stderr: string) => { 14 | if (err) { 15 | ui.writeLine(stderr); 16 | ui.writeLine(chalk.red('Package install failed, see above.')); 17 | reject(); 18 | } else { 19 | ui.writeLine(chalk.green('Installed packages for tooling via npm.')); 20 | resolve(); 21 | } 22 | }); 23 | }); 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test", 3 | "license": "MIT", 4 | "dependencies": { 5 | "@angular/common": "2.2.3", 6 | "@angular/compiler": "2.2.3", 7 | "@angular/compiler-cli": "2.2.3", 8 | "@angular/core": "2.2.3", 9 | "@angular/http": "2.2.3", 10 | "@angular/platform-browser": "2.2.3", 11 | "@angular/platform-browser-dynamic": "2.2.3", 12 | "@angular/platform-server": "2.2.3", 13 | "@angular/router": "3.2.3", 14 | "@ngtools/webpack": "0.0.0", 15 | "core-js": "^2.4.1", 16 | "rxjs": "5.0.0-beta.12", 17 | "zone.js": "^0.6.23" 18 | }, 19 | "devDependencies": { 20 | "node-sass": "^4.1.1", 21 | "performance-now": "^0.2.0", 22 | "raw-loader": "^0.5.1", 23 | "sass-loader": "^4.1.1", 24 | "typescript": "~2.0.3", 25 | "webpack": "2.1.0-beta.25" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/e2e/tests/generate/component/component-basic.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {ng} from '../../../utils/process'; 3 | import {expectFileToExist} from '../../../utils/fs'; 4 | 5 | 6 | export default function() { 7 | const componentDir = join('src', 'app', 'test-component'); 8 | 9 | return ng('generate', 'component', 'test-component') 10 | .then(() => expectFileToExist(componentDir)) 11 | .then(() => expectFileToExist(join(componentDir, 'test-component.component.ts'))) 12 | .then(() => expectFileToExist(join(componentDir, 'test-component.component.spec.ts'))) 13 | .then(() => expectFileToExist(join(componentDir, 'test-component.component.html'))) 14 | .then(() => expectFileToExist(join(componentDir, 'test-component.component.css'))) 15 | 16 | // Try to run the unit tests. 17 | .then(() => ng('test', '--single-run')); 18 | } 19 | -------------------------------------------------------------------------------- /tests/e2e/assets/webpack/test-app-weird/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test", 3 | "license": "MIT", 4 | "dependencies": { 5 | "@angular/common": "2.2.1", 6 | "@angular/compiler": "2.2.1", 7 | "@angular/compiler-cli": "2.2.1", 8 | "@angular/core": "2.2.1", 9 | "@angular/http": "2.2.1", 10 | "@angular/platform-browser": "2.2.1", 11 | "@angular/platform-browser-dynamic": "2.2.1", 12 | "@angular/platform-server": "2.2.1", 13 | "@angular/router": "3.2.1", 14 | "@ngtools/webpack": "0.0.0", 15 | "core-js": "^2.4.1", 16 | "rxjs": "^5.0.0-beta.12", 17 | "zone.js": "^0.6.21" 18 | }, 19 | "devDependencies": { 20 | "node-sass": "^4.1.1", 21 | "performance-now": "^0.2.0", 22 | "raw-loader": "^0.5.1", 23 | "sass-loader": "^4.1.1", 24 | "typescript": "~2.0.3", 25 | "webpack": "2.1.0-beta.22" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/dev-build.ts: -------------------------------------------------------------------------------- 1 | import { ng } from '../../utils/process'; 2 | import { expectFileToMatch, expectFileToExist } from '../../utils/fs'; 3 | import { expectGitToBeClean } from '../../utils/git'; 4 | import { getAppMain, isUniversalTest, getClientDist } from '../../utils/utils'; 5 | 6 | 7 | export default function () { 8 | return ng('build', '--env=dev') 9 | .then(() => expectFileToMatch(`${getClientDist()}index.html`, getAppMain() + '.bundle.js')) 10 | .then(() => expectGitToBeClean()) 11 | .then(() => { 12 | if (!isUniversalTest()) { 13 | return; 14 | } 15 | 16 | return Promise.resolve() 17 | .then(() => expectFileToExist('dist/server/server.bundle.js')) 18 | .then(() => expectFileToMatch( 19 | `${getClientDist()}index.html`, 20 | 'livereload.js') 21 | ); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /docs/publish.md: -------------------------------------------------------------------------------- 1 | #Change versions 2 | - There is a main `package.json` which should keep with the latest universal-cli version (e.g. `1.0.0-beta.17`). 3 | - There is one `package.json` per packages. Update the version of every packages independently. 4 | - Run the CHANGELOG script. 5 | - `node ./scripts/publish/changelog.js OLD_VERSION_TAG` 6 | - (for example, `v1.0.0-beta.17`) 7 | - Create a commit. The commit message should be only the version number starting with a v. 8 | - Create a tag. The tag should be only the version number starting with a v. 9 | - Push to upstream with tags. 10 | - `git push master` 11 | - `git push --tags` 12 | - Publish to npm 13 | - `npm run build` 14 | - `cd ./dist/universal-cli` 15 | - `npm publish --tag experimental` (install it with `npm install -g universal-cli@experimental` and test it) 16 | - `npm publish` (the new version is now available at npm) -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/doc-generator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var versionUtils = require('./version-utils'); 4 | var emberCLIVersion = versionUtils.emberCLIVersion; 5 | var fs = require('fs'); 6 | 7 | function DocGenerator(options) { 8 | options = options || {}; 9 | this.exec = options.exec || require('child_process').exec; 10 | } 11 | 12 | DocGenerator.prototype.generate = function() { 13 | var command = 'cd docs && ' + fs.realpathSync('./node_modules/.bin/yuidoc') + 14 | ' -q --project-version ' + emberCLIVersion(); // add '-p' flag to produce only JSON and not HTML 15 | 16 | console.log('Executing command: ' + command); 17 | this.exec(command, function(error) { // stdout, stderr 18 | if (error !== null) { 19 | console.log('Error: ' + error); 20 | } 21 | }); 22 | }; 23 | 24 | module.exports = DocGenerator; 25 | -------------------------------------------------------------------------------- /packages/universal-cli/tasks/e2e.ts: -------------------------------------------------------------------------------- 1 | const Task = require('../ember-cli/lib/models/task'); 2 | import * as chalk from 'chalk'; 3 | import {exec} from 'child_process'; 4 | 5 | 6 | export const E2eTask = Task.extend({ 7 | run: function () { 8 | const ui = this.ui; 9 | let exitCode = 0; 10 | 11 | return new Promise((resolve) => { 12 | exec(`npm run e2e -- ${this.project.ngConfig.config.e2e.protractor.config}`, 13 | (err: NodeJS.ErrnoException, stdout: string, stderr: string) => { 14 | ui.writeLine(stdout); 15 | if (err) { 16 | ui.writeLine(stderr); 17 | ui.writeLine(chalk.red('Some end-to-end tests failed, see above.')); 18 | exitCode = 1; 19 | } else { 20 | ui.writeLine(chalk.green('All end-to-end tests pass.')); 21 | } 22 | resolve(exitCode); 23 | }); 24 | }); 25 | } 26 | }); 27 | -------------------------------------------------------------------------------- /scripts/run-packages-spec.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | 4 | require('../lib/bootstrap-local'); 5 | const glob = require('glob'); 6 | 7 | const path = require('path'); 8 | const Jasmine = require('jasmine'); 9 | const JasmineSpecReporter = require('jasmine-spec-reporter'); 10 | 11 | const projectBaseDir = path.join(__dirname, '../packages'); 12 | 13 | // Create a Jasmine runner and configure it. 14 | const jasmine = new Jasmine({ projectBaseDir: projectBaseDir }); 15 | jasmine.loadConfig({}); 16 | jasmine.addReporter(new JasmineSpecReporter()); 17 | // Manually set exit code (needed with custom reporters) 18 | jasmine.onComplete((success) => process.exitCode = !success); 19 | 20 | // Run the tests. 21 | const allTests = 22 | glob.sync('packages/**/*.spec.ts') 23 | .map(p => path.relative(projectBaseDir, p)) 24 | .filter(p => !/blueprints/.test(p)); 25 | 26 | jasmine.execute(allTests); 27 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/get.ts: -------------------------------------------------------------------------------- 1 | import * as chalk from 'chalk'; 2 | import {CliConfig} from '../models/config'; 3 | 4 | const Command = require('../ember-cli/lib/models/command'); 5 | 6 | const GetCommand = Command.extend({ 7 | name: 'get', 8 | description: 'Get a value from the configuration.', 9 | works: 'everywhere', 10 | 11 | availableOptions: [], 12 | 13 | run: function (commandOptions: any, rawArgs: string[]): Promise { 14 | return new Promise(resolve => { 15 | const config = CliConfig.fromProject(); 16 | const value = config.get(rawArgs[0]); 17 | 18 | if (value === null) { 19 | console.error(chalk.red('Value cannot be found.')); 20 | } else if (typeof value == 'object') { 21 | console.log(JSON.stringify(value)); 22 | } else { 23 | console.log(value); 24 | } 25 | resolve(); 26 | }); 27 | } 28 | }); 29 | 30 | export default GetCommand; 31 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | /*global jasmine */ 5 | var SpecReporter = require('jasmine-spec-reporter'); 6 | 7 | exports.config = { 8 | allScriptsTimeout: 11000, 9 | specs: [ 10 | './e2e/**/*.e2e-spec.ts' 11 | ], 12 | capabilities: { 13 | 'browserName': 'chrome' 14 | }, 15 | directConnect: true, 16 | baseUrl: 'http://localhost:4200/', 17 | framework: 'jasmine', 18 | jasmineNodeOpts: { 19 | showColors: true, 20 | defaultTimeoutInterval: 30000, 21 | print: function() {} 22 | }, 23 | useAllAngular2AppRoots: true, 24 | beforeLaunch: function() { 25 | require('ts-node').register({ 26 | project: 'e2e' 27 | }); 28 | }, 29 | onPrepare: function() { 30 | jasmine.getEnv().addReporter(new SpecReporter()); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /tests/e2e/tests/mobile/prod-features.ts: -------------------------------------------------------------------------------- 1 | import { isMobileTest, expectToFail, getClientDist } from '../../utils/utils'; 2 | import {expectFileToMatch, expectFileToExist} from '../../utils/fs'; 3 | 4 | 5 | export default function() { 6 | if (!isMobileTest()) { 7 | return; 8 | } 9 | 10 | return Promise.resolve() 11 | // Service Worker 12 | .then(() => expectToFail(() => expectFileToMatch(`${getClientDist()}index.html`, 13 | 'if (\'serviceWorker\' in navigator) {'))) 14 | .then(() => expectToFail(() => expectFileToExist(`${getClientDist()}worker.js`))) 15 | 16 | // Asynchronous bundle 17 | .then(() => expectToFail(() => expectFileToMatch(`${getClientDist()}index.html`, 18 | ''))) 19 | .then(() => expectToFail(() => expectFileToExist(`${getClientDist()}app-concat.js`))); 20 | } 21 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/app/app.module.ts: -------------------------------------------------------------------------------- 1 | <% if(!universal) { %> 2 | import { BrowserModule } from '@angular/platform-browser';<% } else { %> 3 | import { CommonModule } from '@angular/common';<% } %> 4 | import { NgModule } from '@angular/core'; 5 | import { FormsModule } from '@angular/forms'; 6 | import { HttpModule } from '@angular/http';<% if (routing) { %> 7 | import { AppRoutingModule } from './app-routing.module';<% } %> 8 | 9 | import { AppComponent } from './app.component'; 10 | 11 | @NgModule({ 12 | declarations: [ 13 | AppComponent 14 | ], 15 | imports: [<% if(!universal) { %> 16 | BrowserModule,<% } else { %> 17 | CommonModule,<% } %> 18 | FormsModule, 19 | HttpModule<% if (routing) { %>, 20 | AppRoutingModule<% } %> 21 | ], 22 | providers: [],<% if(universal) { %> 23 | exports: [AppComponent]<% } else { %> 24 | bootstrap: [AppComponent]<% } %> 25 | }) 26 | export class AppModule { } 27 | -------------------------------------------------------------------------------- /docs/documentation/new.md: -------------------------------------------------------------------------------- 1 | # ng new 2 | 3 | ## Overview 4 | `ng new [name]` creates a new angular application. 5 | 6 | Default applications are created in a directory of the same name, with an initialized Angular application. 7 | 8 | ## Options 9 | `--dry-run` (`-d`) run through without making any changes 10 | 11 | `--skip-npm` (`-sn`) skip installing npm packages 12 | 13 | `--skip-git` (`-sg`) skip initializing a git repository 14 | 15 | `--directory` (`-dir`) the directory name to create the app in 16 | 17 | `--source-dir` (`-sd`) the name of the source directory 18 | 19 | `--style` the style file default extension 20 | 21 | `--prefix` (`p`) the prefix to use for all component selectors 22 | 23 | `--routing` flag to indicate whether to generate a routing module 24 | 25 | `--inline-style` (`is`) flag to indicate if the app component should have an inline style 26 | 27 | `--inline-template` (`it`) flag to indicate if the app component should have an inline template -------------------------------------------------------------------------------- /packages/universal-cli/custom-typings.d.ts: -------------------------------------------------------------------------------- 1 | interface IWebpackDevServerConfigurationOptions { 2 | contentBase?: string; 3 | hot?: boolean; 4 | historyApiFallback?: {[key: string]: any} | boolean; 5 | compress?: boolean; 6 | proxy?: {[key: string]: string}; 7 | staticOptions?: any; 8 | quiet?: boolean; 9 | noInfo?: boolean; 10 | lazy?: boolean; 11 | filename?: string; 12 | watchOptions?: { 13 | aggregateTimeout?: number; 14 | poll?: number; 15 | }; 16 | publicPath?: string; 17 | headers?: { [key: string]: string }; 18 | stats?: { [key: string]: boolean }; 19 | inline: boolean; 20 | https?: boolean; 21 | key?: string; 22 | cert?: string; 23 | } 24 | 25 | interface WebpackProgressPluginOutputOptions { 26 | colors?: boolean; 27 | chunks?: boolean; 28 | modules?: boolean; 29 | reasons?: boolean; 30 | chunkModules?: boolean; 31 | } 32 | 33 | declare var HtmlWebpackPlugin: any; 34 | declare var LoaderOptionsPlugin: any; 35 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/printable-properties.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var commandProperties = [ 4 | 'name', 5 | 'description', 6 | 'aliases', 7 | 'works', 8 | 'availableOptions', 9 | 'anonymousOptions' 10 | ]; 11 | var blueprintProperties = [ 12 | 'name', 13 | 'description', 14 | 'availableOptions', 15 | 'anonymousOptions', 16 | 'overridden' 17 | ]; 18 | 19 | function forEachWithProperty(properties, forEach, context) { 20 | return properties.filter(function(key) { 21 | return this[key] !== undefined; 22 | }, context).forEach(forEach, context); 23 | } 24 | 25 | module.exports = { 26 | command: { 27 | forEachWithProperty: function(forEach, context) { 28 | return forEachWithProperty(commandProperties, forEach, context); 29 | } 30 | }, 31 | blueprint: { 32 | forEachWithProperty: function(forEach, context) { 33 | return forEachWithProperty(blueprintProperties, forEach, context); 34 | } 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /tests/e2e/tests/generate/module/module-basic.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {ng} from '../../../utils/process'; 3 | import {expectFileToExist, expectFileToMatch} from '../../../utils/fs'; 4 | import {expectToFail} from '../../../utils/utils'; 5 | 6 | 7 | export default function() { 8 | const moduleDir = join('src', 'app', 'test'); 9 | 10 | return ng('generate', 'module', 'test') 11 | .then(() => expectFileToExist(moduleDir)) 12 | .then(() => expectFileToExist(join(moduleDir, 'test.module.ts'))) 13 | .then(() => expectToFail(() => expectFileToExist(join(moduleDir, 'test-routing.module.ts')))) 14 | .then(() => expectToFail(() => expectFileToExist(join(moduleDir, 'test.component.ts')))) 15 | .then(() => expectToFail(() => expectFileToExist(join(moduleDir, 'test.spec.ts')))) 16 | .then(() => expectFileToMatch(join(moduleDir, 'test.module.ts'), 'TestModule')) 17 | 18 | // Try to run the unit tests. 19 | .then(() => ng('test', '--single-run')); 20 | } 21 | -------------------------------------------------------------------------------- /docs/documentation/init.md: -------------------------------------------------------------------------------- 1 | # ng init 2 | 3 | ## Overview 4 | `ng init [name]` initializes, or re-initializes, an angular application. 5 | 6 | Initialization is done in-place, meaning that the generated application is initialized in the current directory. 7 | 8 | ## Options 9 | `--dry-run` (`-d`) run through without making any changes 10 | 11 | `--skip-npm` (`-sn`) skip installing npm packages 12 | 13 | `--skip-git` (`-sg`) skip initializing a git repository 14 | 15 | `--directory` (`-dir`) the directory name to create the app in 16 | 17 | `--source-dir` (`-sd`) the name of the source directory 18 | 19 | `--style` the style file default extension 20 | 21 | `--prefix` (`p`) the prefix to use for all component selectors 22 | 23 | `--routing` flag to indicate whether to generate a routing module 24 | 25 | `--inline-style` (`is`) flag to indicate if the app component should have an inline style 26 | 27 | `--inline-template` (`it`) flag to indicate if the app component should have an inline template -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/component/files/__path__/__name__.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit<% if(viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection) { %>, ChangeDetectionStrategy<% }%> } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: '<%= selector %>',<% if(inlineTemplate) { %> 5 | template: ` 6 |

7 | <%= dasherizedModuleName %> Works! 8 |

9 | `,<% } else { %> 10 | templateUrl: './<%= dasherizedModuleName %>.component.html',<% } if(inlineStyle) { %> 11 | styles: []<% } else { %> 12 | styleUrls: ['./<%= dasherizedModuleName %>.component.<%= styleExt %>']<% } %><% if(viewEncapsulation) { %>, 13 | encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection) { %>, 14 | changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %> 15 | }) 16 | export class <%= classifiedModuleName %>Component implements OnInit { 17 | 18 | constructor() { } 19 | 20 | ngOnInit() { 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /docs/documentation/serve.md: -------------------------------------------------------------------------------- 1 | # ng serve 2 | 3 | ## Overview 4 | `ng serve` builds the application and starts a web server 5 | 6 | ## Options 7 | `--port` (`-p`) port to serve the application on 8 | 9 | `--host` (`-H`) 10 | 11 | `--proxy-config` (`-pc`) 12 | 13 | `--watcher` (`-w`) provide a new watcher 14 | 15 | `--live-reload` (`-lr`) flag to turn off live reloading 16 | 17 | `--live-reload-host` (`-lrh`) specify the host for live reloading 18 | 19 | `--live-reload-base-url` (`-lrbu`) specify the base URL for live reloading 20 | 21 | `--live-reload-port` (`-lrp`) port for live reloading 22 | 23 | `--live-reload-live-css` flag to live reload CSS 24 | 25 | `--target` (`-t`, `-dev`, `-prod`) target environment 26 | 27 | `--environment` (`-e`) build environment 28 | 29 | `--ssl` flag to turn on SSL 30 | 31 | `--ssl-key` path to the SSL key 32 | 33 | `--ssl-cert` path to the SSL cert 34 | 35 | `--aot` flag to turn on Ahead of Time compilation 36 | 37 | `--open` (`-o`) opens the app in the default browser -------------------------------------------------------------------------------- /tests/e2e/tests/misc/ssl-with-cert.ts: -------------------------------------------------------------------------------- 1 | import { request } from '../../utils/http'; 2 | import { assetDir } from '../../utils/assets'; 3 | import { killAllProcesses } from '../../utils/process'; 4 | import { ngServe } from '../../utils/project'; 5 | import { isUniversalTest } from '../../utils/utils'; 6 | 7 | 8 | export default function() { 9 | /** This test is disabled for universal */ 10 | if (isUniversalTest()) { 11 | return Promise.resolve(); 12 | } 13 | 14 | return Promise.resolve() 15 | .then(() => ngServe( 16 | '--ssl', 'true', 17 | '--ssl-key', assetDir('ssl/server.key'), 18 | '--ssl-cert', assetDir('ssl/server.crt') 19 | )) 20 | .then(() => request('https://localhost:4200/')) 21 | .then(body => { 22 | if (!body.match(/Loading...<\/app-root>/)) { 23 | throw new Error('Response does not match expected value.'); 24 | } 25 | }) 26 | .then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; }); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/require-as-hash.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var stringUtils = require('ember-cli-string-utils'); 3 | 4 | // Gathers subclasses of a certain specified base class into a hash. 5 | // 6 | // e.g.: 7 | // Files: 8 | // - ./hamster.js which exports an class of Hamster subclass of Rodent 9 | // - ./parrot.js which exports an instance of Parrot (not a Rodent!) 10 | // 11 | // requireAsHash('./*.js', Rodent): 12 | // { 13 | // Hamster: Hamster // Same as require('./hamster.js') 14 | // } 15 | 16 | 17 | var globSync = require('glob').sync; 18 | var path = require('path'); 19 | 20 | module.exports = requireAsHash; 21 | function requireAsHash(pattern, type) { 22 | return globSync(pattern) 23 | .reduce(function(hash, file) { 24 | 25 | var klass = require(file); 26 | if (!type || (klass.prototype instanceof type)) { 27 | hash[stringUtils.classify(path.basename(file, '.js'))] = klass; 28 | } 29 | return hash; 30 | }, {}); 31 | } 32 | -------------------------------------------------------------------------------- /tests/e2e/utils/utils.ts: -------------------------------------------------------------------------------- 1 | 2 | export function expectToFail(fn: () => Promise): Promise { 3 | return fn() 4 | .then(() => { 5 | throw new Error(`Function ${fn.source} was expected to fail, but succeeded.`); 6 | }, () => {}); 7 | } 8 | 9 | export function isMobileTest() { 10 | return !!process.env['MOBILE_TEST']; 11 | } 12 | 13 | export function isUniversalTest() { 14 | return !!process.env['UNIVERSAL']; 15 | } 16 | 17 | export function getAppMain() { 18 | return isUniversalTest() ? 'client' : 'main'; 19 | } 20 | 21 | export function getClientDist() { 22 | return isUniversalTest() ? 'dist/client/' : 'dist/'; 23 | } 24 | 25 | export function getMainAppModuleRegex() { 26 | return isUniversalTest() ? 27 | /bootstrapModuleFactory.*\/\* BrowserAppModuleNgFactory \*\// : 28 | /bootstrapModuleFactory.*\/\* AppModuleNgFactory \*\//; 29 | } 30 | 31 | export function wait(msecs: number) { 32 | return new Promise((resolve) => { 33 | setTimeout(resolve, msecs); 34 | }); 35 | } 36 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/universal/index.js: -------------------------------------------------------------------------------- 1 | const stringUtils = require('ember-cli-string-utils'); 2 | 3 | module.exports = { 4 | description: '', 5 | 6 | availableOptions: [ 7 | { name: 'source-dir', type: String, default: 'src', aliases: ['sd'] }, 8 | { name: 'prefix', type: String, default: 'app', aliases: ['p'] } 9 | ], 10 | 11 | locals: function (options) { 12 | const fullAppName = stringUtils.dasherize(options.entity.name) 13 | .replace(/-(.)/g, (_, l) => ' ' + l.toUpperCase()) 14 | .replace(/^./, (l) => l.toUpperCase()); 15 | 16 | return { 17 | jsComponentName: stringUtils.classify(options.entity.name), 18 | fullAppName: fullAppName, 19 | sourceDir: options.sourceDir, 20 | prefix: options.prefix 21 | }; 22 | }, 23 | 24 | fileMapTokens: function (options) { 25 | // Return custom template variables here. 26 | return { 27 | __path__: () => { 28 | return options.locals.sourceDir; 29 | } 30 | }; 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /packages/universal-cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "emitDecoratorMetadata": true, 5 | "experimentalDecorators": true, 6 | "mapRoot": "", 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "noEmitOnError": true, 10 | "noImplicitAny": true, 11 | "outDir": "../../dist/universal-cli", 12 | "rootDir": ".", 13 | "sourceMap": true, 14 | "sourceRoot": "/", 15 | "target": "es5", 16 | "lib": ["es6"], 17 | "skipLibCheck": true, 18 | "typeRoots": [ 19 | "../../node_modules/@types" 20 | ], 21 | "baseUrl": "", 22 | "paths": { 23 | "@angular-cli/ast-tools": [ "../../dist/@angular-cli/ast-tools/src" ], 24 | "@angular-cli/base-href-webpack": [ "../../dist/@angular-cli/base-href-webpack/src" ], 25 | "@ngtools/webpack": [ "../../dist/@ngtools/webpack/src" ] 26 | } 27 | }, 28 | "include": [ 29 | "**/*" 30 | ], 31 | "exclude": [ 32 | "blueprints/*/files/**/*" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/output-dir.ts: -------------------------------------------------------------------------------- 1 | import { ng } from '../../utils/process'; 2 | import { expectFileToExist } from '../../utils/fs'; 3 | import { expectToFail, getAppMain } from '../../utils/utils'; 4 | import { expectGitToBeClean } from '../../utils/git'; 5 | import { updateJsonFile } from '../../utils/project'; 6 | 7 | 8 | export default function() { 9 | return ng('build', '-o', './build-output') 10 | .then(() => expectFileToExist('./build-output/index.html')) 11 | .then(() => expectFileToExist(`./build-output/${getAppMain()}.bundle.js`)) 12 | .then(() => expectToFail(expectGitToBeClean)) 13 | .then(() => updateJsonFile('angular-cli.json', configJson => { 14 | const app = configJson['apps'][0]; 15 | app['outDir'] = 'config-build-output'; 16 | })) 17 | .then(() => ng('build')) 18 | .then(() => expectFileToExist('./config-build-output/index.html')) 19 | .then(() => expectFileToExist(`./config-build-output/${getAppMain()}.bundle.js`)) 20 | .then(() => expectToFail(expectGitToBeClean)); 21 | } 22 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/index.js: -------------------------------------------------------------------------------- 1 | const stringUtils = require('ember-cli-string-utils'); 2 | 3 | module.exports = { 4 | description: '', 5 | 6 | availableOptions: [ 7 | { name: 'source-dir', type: String, default: 'src', aliases: ['sd'] }, 8 | { name: 'prefix', type: String, default: 'app', aliases: ['p'] }, 9 | { name: 'mobile', type: Boolean, default: false } 10 | ], 11 | 12 | locals: function (options) { 13 | const fullAppName = stringUtils.dasherize(options.entity.name) 14 | .replace(/-(.)/g, (_, l) => ' ' + l.toUpperCase()) 15 | .replace(/^./, (l) => l.toUpperCase()); 16 | 17 | return { 18 | jsComponentName: stringUtils.classify(options.entity.name), 19 | fullAppName: fullAppName, 20 | sourceDir: options.sourceDir 21 | }; 22 | }, 23 | 24 | fileMapTokens: function (options) { 25 | // Return custom template variables here. 26 | return { 27 | __path__: () => { 28 | return options.locals.sourceDir; 29 | } 30 | }; 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/enum/index.js: -------------------------------------------------------------------------------- 1 | const stringUtils = require('ember-cli-string-utils'); 2 | var dynamicPathParser = require('../../utilities/dynamic-path-parser'); 3 | 4 | module.exports = { 5 | description: '', 6 | 7 | normalizeEntityName: function (entityName) { 8 | var parsedPath = dynamicPathParser(this.project, entityName); 9 | 10 | this.dynamicPath = parsedPath; 11 | return parsedPath.name; 12 | }, 13 | 14 | locals: function (options) { 15 | this.fileName = stringUtils.dasherize(options.entity.name); 16 | 17 | return { 18 | dynamicPath: this.dynamicPath.dir, 19 | flat: options.flat, 20 | fileName: this.fileName 21 | }; 22 | }, 23 | 24 | fileMapTokens: function () { 25 | // Return custom template variables here. 26 | return { 27 | __path__: () => { 28 | this.generatePath = this.dynamicPath.dir; 29 | return this.generatePath; 30 | }, 31 | __name__: () => { 32 | return this.fileName; 33 | } 34 | }; 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/merge-blueprint-options.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var SilentError = require('silent-error'); 4 | var Blueprint = require('../models/blueprint'); 5 | 6 | /* 7 | * Helper for commands that use a blueprint to merge the blueprint's options 8 | * into the command's options so they can be passed in. Needs to be invoked 9 | * with `this` pointing to the command object, e.g. 10 | * 11 | * var mergeBlueprintOptions = require('../utilities/merge-blueprint-options'); 12 | * 13 | * Command.extend({ 14 | * beforeRun: mergeBlueprintOptions 15 | * }) 16 | */ 17 | module.exports = function(rawArgs) { 18 | if (rawArgs.length === 0) { 19 | return; 20 | } 21 | // merge in blueprint availableOptions 22 | var blueprint; 23 | try { 24 | blueprint = Blueprint.lookup(rawArgs[0], { 25 | paths: this.project.blueprintLookupPaths() 26 | }); 27 | this.registerOptions(blueprint); 28 | } catch (e) { 29 | SilentError.debugOrThrow('ember-cli/commands/' + this.name, e); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/manifest.webapp: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= fullAppName %>", 3 | "short_name": "<%= fullAppName %>", 4 | "icons": [ 5 | { 6 | "src": "icons/android-chrome-36x36.png", 7 | "sizes": "36x36", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "icons/android-chrome-48x48.png", 12 | "sizes": "48x48", 13 | "type": "image/png" 14 | }, 15 | { 16 | "src": "icons/android-chrome-72x72.png", 17 | "sizes": "72x72", 18 | "type": "image/png" 19 | }, 20 | { 21 | "src": "icons/android-chrome-96x96.png", 22 | "sizes": "96x96", 23 | "type": "image/png" 24 | }, 25 | { 26 | "src": "icons/android-chrome-144x144.png", 27 | "sizes": "144x144", 28 | "type": "image/png" 29 | }, 30 | { 31 | "src": "icons/android-chrome-192x192.png", 32 | "sizes": "192x192", 33 | "type": "image/png" 34 | } 35 | ], 36 | "theme_color": "#000000", 37 | "background_color": "#e0e0e0", 38 | "start_url": "/index.html", 39 | "display": "standalone", 40 | "orientation": "portrait" 41 | } 42 | -------------------------------------------------------------------------------- /tests/e2e/tests/generate/module/module-routing.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {ng} from '../../../utils/process'; 3 | import {expectFileToExist} from '../../../utils/fs'; 4 | import {expectToFail} from '../../../utils/utils'; 5 | 6 | 7 | export default function() { 8 | const moduleDir = join('src', 'app', 'test'); 9 | 10 | return ng('generate', 'module', 'test', '--routing') 11 | .then(() => expectFileToExist(moduleDir)) 12 | .then(() => expectFileToExist(join(moduleDir, 'test.module.ts'))) 13 | .then(() => expectFileToExist(join(moduleDir, 'test-routing.module.ts'))) 14 | .then(() => expectFileToExist(join(moduleDir, 'test.component.ts'))) 15 | .then(() => expectFileToExist(join(moduleDir, 'test.component.spec.ts'))) 16 | .then(() => expectFileToExist(join(moduleDir, 'test.component.html'))) 17 | .then(() => expectFileToExist(join(moduleDir, 'test.component.css'))) 18 | .then(() => expectToFail(() => expectFileToExist(join(moduleDir, 'test.spec.ts')))) 19 | // Try to run the unit tests. 20 | .then(() => ng('test', '--single-run')); 21 | } 22 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/component/files/__path__/__name__.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { <%= classifiedModuleName %>Component } from './<%= dasherizedModuleName %>.component'; 7 | 8 | describe('<%= classifiedModuleName %>Component', () => { 9 | let component: <%= classifiedModuleName %>Component; 10 | let fixture: ComponentFixture<<%= classifiedModuleName %>Component>; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ <%= classifiedModuleName %>Component ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(<%= classifiedModuleName %>Component); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/environment.ts: -------------------------------------------------------------------------------- 1 | import { ng } from '../../utils/process'; 2 | import { expectFileToMatch } from '../../utils/fs'; 3 | import { expectGitToBeClean } from '../../utils/git'; 4 | import { expectToFail, getAppMain, isUniversalTest, getClientDist } from '../../utils/utils'; 5 | 6 | 7 | export default function () { 8 | // Try a prod build. 9 | return ng('build', '--env=prod') 10 | .then(() => 11 | expectFileToMatch( 12 | `${getClientDist()}${getAppMain()}.bundle.js`, 13 | 'production: true' 14 | ) 15 | ) 16 | .then(() => { 17 | if (!isUniversalTest()) { 18 | return; 19 | } 20 | 21 | return Promise.resolve() 22 | .then(() => { 23 | expectFileToMatch('dist/server/server.bundle.js', 'production: true'); 24 | }); 25 | }) 26 | .then(() => expectGitToBeClean()) 27 | 28 | // Build fails on invalid build target 29 | .then(() => expectToFail(() => ng('build', '--target=potato'))) 30 | 31 | // This is a valid target. 32 | .then(() => ng('build', '--target=production')); 33 | } 34 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/universal/files/__path__/__2.1.1.workaround.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS IS TEMPORARY TO PATCH 2.1.1+ Core bugs 3 | */ 4 | 5 | /* tslint:disable */ 6 | let __compiler__: any = require('@angular/compiler'); 7 | import { __platform_browser_private__ } from '@angular/platform-browser'; 8 | var __core_private__: any = require('@angular/core'); 9 | let patch: Boolean = false; 10 | 11 | if (!__core_private__.hasOwnProperty('ViewUtils')) { 12 | patch = true; 13 | __core_private__.ViewUtils = __core_private__.view_utils; 14 | } 15 | 16 | if (!__compiler__.__compiler_private__) { 17 | patch = true; 18 | (__compiler__).__compiler_private__ = { 19 | SelectorMatcher: __compiler__.SelectorMatcher, 20 | CssSelector: __compiler__.CssSelector 21 | } 22 | } 23 | 24 | var __universal__: any = require('angular2-platform-node/__private_imports__'); 25 | if (patch) { 26 | __universal__.ViewUtils = __core_private__.view_utils; 27 | __universal__.CssSelector = __compiler__.CssSelector 28 | __universal__.SelectorMatcher = __compiler__.SelectorMatcher 29 | } 30 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/sequence.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Promise = require('../ext/promise'); 4 | /* 5 | * 6 | * given an array of functions, that may or may not return promises sequence 7 | * will invoke them sequentially. If a promise is encountered sequence will 8 | * wait until it fulfills before moving to the next entry. 9 | * 10 | * ```js 11 | * var tasks = [ 12 | * function() { return Promise.resolve(1); }, 13 | * 2, 14 | * function() { return timeout(1000).then(function() { return 3; } }, 15 | * ]; 16 | * 17 | * sequence(tasks).then(function(results) { 18 | * results === [ 19 | * 1, 20 | * 2, 21 | * 3 22 | * ] 23 | * }); 24 | * ``` 25 | * 26 | * @method sequence 27 | * @param tasks 28 | * @return Promise 29 | * 30 | */ 31 | module.exports = function sequence(tasks) { 32 | var length = tasks.length; 33 | var current = Promise.resolve(); 34 | var results = new Array(length); 35 | 36 | for (var i = 0; i < length; ++i) { 37 | current = results[i] = current.then(tasks[i]); 38 | } 39 | 40 | return Promise.all(results); 41 | }; 42 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "experimentalDecorators": true, 4 | "mapRoot": "", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "noEmitOnError": true, 8 | "noImplicitAny": true, 9 | "noUnusedParameters": true, 10 | "noUnusedLocals": true, 11 | "outDir": "./dist", 12 | "rootDir": ".", 13 | "sourceMap": true, 14 | "sourceRoot": "", 15 | "inlineSourceMap": true, 16 | "target": "es5", 17 | "lib": ["es6"], 18 | "baseUrl": "", 19 | "typeRoots": [ 20 | "./node_modules/@types" 21 | ], 22 | "types": [ 23 | "jasmine", 24 | "node" 25 | ], 26 | "paths": { 27 | "universal-cli/*": [ "./packages/universal-cli/*" ], 28 | "@angular-cli/ast-tools": [ "./packages/ast-tools/src" ], 29 | "@angular-cli/base-href-webpack": [ "./packages/base-href-webpack/src" ], 30 | "@ngtools/webpack": [ "./packages/webpack/src" ] 31 | } 32 | }, 33 | "exclude": [ 34 | "packages/universal-cli/blueprints/*/files/**/*", 35 | "dist/**/*", 36 | "node_modules/**/*", 37 | "tmp/**/*" 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/platform-checker.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var semver = require('semver'); 4 | var debug = require('debug')('ember-cli:platform-checker:'); 5 | 6 | var LOWER_RANGE = '0.12.0'; 7 | var UPPER_RANGE = '6.0.0'; 8 | 9 | module.exports = PlatformChecker; 10 | function PlatformChecker(version) { 11 | this.version = version; 12 | this.isValid = this.checkIsValid(); 13 | this.isUntested = this.checkIsUntested(); 14 | this.isDeprecated = this.checkIsDeprecated(); 15 | 16 | debug('%o', { 17 | version: this.version, 18 | isValid: this.isValid, 19 | isUntested: this.isUntested, 20 | isDeprecated: this.isDeprecated 21 | }); 22 | } 23 | 24 | PlatformChecker.prototype.checkIsValid = function() { 25 | return semver.satisfies(this.version, '>=' + LOWER_RANGE + ' <' + UPPER_RANGE); 26 | }; 27 | 28 | PlatformChecker.prototype.checkIsDeprecated = function() { 29 | return semver.satisfies(this.version, '<' + LOWER_RANGE); 30 | }; 31 | 32 | PlatformChecker.prototype.checkIsUntested = function() { 33 | return semver.satisfies(this.version, '>=' + UPPER_RANGE); 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/easter-egg.ts: -------------------------------------------------------------------------------- 1 | const Command = require('../ember-cli/lib/models/command'); 2 | const stringUtils = require('ember-cli-string-utils'); 3 | import * as chalk from 'chalk'; 4 | 5 | 6 | function pickOne(of: string[]): string { 7 | return of[Math.floor(Math.random() * of.length)]; 8 | } 9 | 10 | 11 | const MakeThisAwesomeCommand = Command.extend({ 12 | name: 'make-this-awesome', 13 | works: 'insideProject', 14 | 15 | run: function (commandOptions: any, rawArgs: string[]): Promise { 16 | (this as any)[stringUtils.camelize(this.name)](commandOptions, rawArgs); 17 | 18 | return Promise.resolve(); 19 | }, 20 | 21 | makeThisAwesome: function() { 22 | const phrase = pickOne([ 23 | `You're on it, there's nothing for me to do!`, 24 | `Let's take a look... nope, it's all good!`, 25 | `You're doing fine.`, 26 | `You're already doing great.`, 27 | `Nothing to do; already awesome. Exiting.`, 28 | `Error 418: As Awesome As Can Get.` 29 | ]); 30 | console.log(chalk.green(phrase)); 31 | } 32 | }); 33 | 34 | export default MakeThisAwesomeCommand; 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2016 Google, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/e2e/utils/git.ts: -------------------------------------------------------------------------------- 1 | import {git, silentGit} from './process'; 2 | 3 | 4 | export function gitClean() { 5 | console.log(' Cleaning git...'); 6 | return silentGit('clean', '-df') 7 | .then(() => silentGit('reset', '--hard')) 8 | .then(() => { 9 | // Checkout missing files 10 | return silentGit('status', '--porcelain') 11 | .then(output => output 12 | .split(/[\n\r]+/g) 13 | .filter(line => line.match(/^ D/)) 14 | .map(line => line.replace(/^\s*\S+\s+/, ''))) 15 | .then(files => silentGit('checkout', ...files)); 16 | }) 17 | .then(() => expectGitToBeClean()); 18 | } 19 | 20 | export function expectGitToBeClean() { 21 | return git('status', '--porcelain') 22 | .then(output => { 23 | if (output != '') { 24 | throw new Error('Git repo is not clean...'); 25 | } 26 | }); 27 | } 28 | 29 | export function gitCommit(message: string) { 30 | return git('add', '-A') 31 | .then(() => git('status', '--porcelain')) 32 | .then(output => { 33 | if (output != '') { 34 | return git('commit', '-am', message); 35 | } 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/styles/postcss.ts: -------------------------------------------------------------------------------- 1 | import * as glob from 'glob'; 2 | import { writeFile, expectFileToMatch } from '../../../utils/fs'; 3 | import { ng } from '../../../utils/process'; 4 | import { stripIndents } from 'common-tags'; 5 | import { getClientDist } from '../../../utils/utils'; 6 | 7 | export default function () { 8 | return writeFile('src/styles.css', stripIndents` 9 | /* normal-comment */ 10 | /*! important-comment */ 11 | div { flex: 1 } 12 | `) 13 | // uses autoprefixer plugin for all builds 14 | .then(() => ng('build')) 15 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, stripIndents` 16 | /* normal-comment */ 17 | /*! important-comment */ 18 | div { -webkit-box-flex: 1; -ms-flex: 1; flex: 1 } 19 | `)) 20 | // uses postcss-discard-comments plugin for prod 21 | .then(() => ng('build', '--prod')) 22 | .then(() => glob.sync(`${getClientDist()}styles.*.bundle.css`).find(file => !!file)) 23 | .then((stylesBundle) => expectFileToMatch(stylesBundle, stripIndents` 24 | /*! important-comment */div{-webkit-box-flex:1;-ms-flex:1;flex:1} 25 | `)); 26 | } 27 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/open-editor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Promise = require('../ext/promise'); 4 | var spawn = require('child_process').spawn; 5 | 6 | function openEditor(file) { 7 | if (!openEditor.canEdit()) { 8 | throw new Error('EDITOR environment variable is not set'); 9 | } 10 | 11 | if (!file) { 12 | throw new Error('No `file` option provided'); 13 | } 14 | 15 | var editorArgs = openEditor._env().EDITOR.split(' '); 16 | var editor = editorArgs.shift(); 17 | var editProcess = openEditor._spawn(editor, [file].concat(editorArgs), {stdio: 'inherit'}); 18 | 19 | return new Promise(function(resolve, reject) { 20 | editProcess.on('close', function (code) { 21 | if (code === 0) { 22 | resolve(); 23 | } else { 24 | reject(); 25 | } 26 | }); 27 | }); 28 | } 29 | 30 | openEditor.canEdit = function() { 31 | return openEditor._env().EDITOR !== undefined; 32 | }; 33 | 34 | openEditor._env = function() { 35 | return process.env; 36 | }; 37 | 38 | openEditor._spawn = function() { 39 | return spawn.apply(this, arguments); 40 | }; 41 | 42 | module.exports = openEditor; 43 | -------------------------------------------------------------------------------- /tests/e2e/tests/misc/assets.ts: -------------------------------------------------------------------------------- 1 | import {writeFile, expectFileToExist, expectFileToMatch} from '../../utils/fs'; 2 | import {ng} from '../../utils/process'; 3 | import {updateJsonFile} from '../../utils/project'; 4 | import { expectToFail, getClientDist } from '../../utils/utils'; 5 | 6 | 7 | export default function() { 8 | return writeFile('src/assets/.file', '') 9 | .then(() => writeFile('src/assets/test.abc', 'hello world')) 10 | .then(() => ng('build')) 11 | .then(() => expectFileToExist(`${getClientDist()}favicon.ico`)) 12 | .then(() => expectFileToExist(`${getClientDist()}assets/.file`)) 13 | .then(() => expectFileToMatch(`${getClientDist()}assets/test.abc`, 'hello world')) 14 | .then(() => expectToFail(() => expectFileToExist(`${getClientDist()}assets/.gitkeep`))) 15 | // doesn't break beta.16 projects 16 | .then(() => updateJsonFile('angular-cli.json', configJson => { 17 | const app = configJson['apps'][0]; 18 | app['assets'] = 'assets'; 19 | })) 20 | .then(() => expectFileToExist(`${getClientDist()}assets/.file`)) 21 | .then(() => expectFileToMatch(`${getClientDist()}assets/test.abc`, 'hello world')); 22 | } 23 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/styles/css.ts: -------------------------------------------------------------------------------- 1 | import { 2 | writeMultipleFiles, 3 | expectFileToMatch, 4 | } from '../../../utils/fs'; 5 | import { ng } from '../../../utils/process'; 6 | import { stripIndents } from 'common-tags'; 7 | import { getClientDist, getAppMain } from '../../../utils/utils'; 8 | 9 | export default function () { 10 | return writeMultipleFiles({ 11 | 'src/styles.css': stripIndents` 12 | @import './imported-styles.css'; 13 | body { background-color: blue; } 14 | `, 15 | 'src/imported-styles.css': stripIndents` 16 | p { background-color: red; } 17 | `, 18 | 'src/app/app.component.css': stripIndents` 19 | .outer { 20 | .inner { 21 | background: #fff; 22 | } 23 | } 24 | `}) 25 | .then(() => ng('build')) 26 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 27 | /body\s*{\s*background-color: blue;\s*}/)) 28 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 29 | /p\s*{\s*background-color: red;\s*}/)) 30 | .then(() => expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, 31 | /.outer.*.inner.*background:\s*#[fF]+/)); 32 | } 33 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/path.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | /** 5 | Returns a relative parent path string using the path provided 6 | 7 | @method getRelativeParentPath 8 | @param {String} path The path to relatively get to. 9 | @return {String} the relative path string. 10 | */ 11 | getRelativeParentPath: function getRelativeParentPath(path, offset, slash) { 12 | var offsetValue = offset || 0; 13 | var trailingSlash = typeof slash === 'undefined' ? true : slash; 14 | var outputPath = new Array(path.split('/').length + 1 - offsetValue).join('../'); 15 | 16 | return trailingSlash ? outputPath : outputPath.substr(0, outputPath.length - 1); 17 | }, 18 | 19 | /** 20 | Returns a relative path string using the path provided 21 | 22 | @method getRelativePath 23 | @param {String} path The path to relatively get to. 24 | @return {String} the relative path string. 25 | */ 26 | getRelativePath: function getRelativePath(path, offset) { 27 | var offsetValue = offset || 0; 28 | var relativePath = new Array(path.split('/').length - offsetValue).join('../'); 29 | return relativePath || './'; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /packages/@ngtools/webpack/src/reflector_host.ts: -------------------------------------------------------------------------------- 1 | import {CodeGenerator} from '@angular/compiler-cli'; 2 | 3 | 4 | /** 5 | * Patch the CodeGenerator instance to use a custom reflector host. 6 | */ 7 | export function patchReflectorHost(codeGenerator: CodeGenerator) { 8 | const reflectorHost = (codeGenerator as any).reflectorHost; 9 | const oldGIP = reflectorHost.getImportPath; 10 | 11 | reflectorHost.getImportPath = function(containingFile: string, importedFile: string): string { 12 | // Hack together SCSS and LESS files URLs so that they match what the default ReflectorHost 13 | // is expected. We only do that for shimmed styles. 14 | const m = importedFile.match(/(.*)(\.css|\.scss|\.less|\.stylus)((?:\.shim)?)(\..+)/); 15 | if (!m) { 16 | return oldGIP.call(this, containingFile, importedFile); 17 | } 18 | 19 | // We call the original, with `css` in its name instead of the extension, and replace the 20 | // extension from the result. 21 | const [, baseDirAndName, styleExt, shim, ext] = m; 22 | const result = oldGIP.call(this, containingFile, baseDirAndName + '.css' + shim + ext); 23 | 24 | return result.replace(/\.css($|\.)/, styleExt + '$1'); 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /packages/universal-cli/utilities/find-parent-module.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs'; 2 | import * as path from 'path'; 3 | const SilentError = require('silent-error'); 4 | 5 | export default function findParentModule(project: any, currentDir: string): string[] { 6 | const root = 'app'; 7 | const sourceRoot = path.join(project.root, project.ngConfig.apps[0].root, root); 8 | 9 | // trim currentDir 10 | currentDir = currentDir.replace(path.join(project.ngConfig.apps[0].root, root), ''); 11 | 12 | let pathToCheck = path.join(sourceRoot, currentDir); 13 | 14 | while (pathToCheck.length >= sourceRoot.length) { 15 | // TODO: refactor to not be based upon file name 16 | const files = fs.readdirSync(pathToCheck) 17 | .filter(fileName => !fileName.endsWith('routing.module.ts')) 18 | .filter(fileName => fileName.endsWith('.module.ts')) 19 | .filter(fileName => fs.statSync(path.join(pathToCheck, fileName)).isFile()); 20 | 21 | if (files.length > 0) { 22 | return files.map(file => path.join(pathToCheck, file)); 23 | } 24 | 25 | // move to parent directory 26 | pathToCheck = path.dirname(pathToCheck); 27 | } 28 | 29 | throw new SilentError('No module files found'); 30 | }; 31 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2016 Stefan Penner, Robert Jackson and ember-cli contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/universal/files/__path__/app/app.node.module.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file and `main.browser.ts` are identical, at the moment(!) 3 | * By splitting these, you're able to create logic, imports, etc that are "Platform" specific. 4 | * If you want your code to be completely Universal and don't need that 5 | * You can also just have 1 file, that is imported into both 6 | * client.ts and server.ts 7 | */ 8 | 9 | import { NgModule } from '@angular/core'; 10 | import { UniversalModule } from 'angular2-universal'; 11 | import { AppModule } from './app.module'; 12 | import { AppComponent } from './index'; 13 | // import { RouterModule } from '@angular/router'; 14 | // import { appRoutes } from './app/app.routing'; 15 | 16 | /** 17 | * Top-level NgModule "container" 18 | */ 19 | @NgModule({ 20 | /** Root App Component */ 21 | bootstrap: [ AppComponent ], 22 | imports: [ 23 | /** 24 | * NOTE: Needs to be your first import (!) 25 | * NodeModule, NodeHttpModule, NodeJsonpModule are included 26 | */ 27 | UniversalModule, 28 | AppModule 29 | /** 30 | * using routes 31 | */ 32 | // RouterModule.forRoot(appRoutes) 33 | ] 34 | }) 35 | export class NodeAppModule { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /packages/@angular-cli/ast-tools/src/node.ts: -------------------------------------------------------------------------------- 1 | import ts = require('typescript'); 2 | import {RemoveChange, Change} from './change'; 3 | 4 | 5 | /** 6 | * Find all nodes from the AST in the subtree of node of SyntaxKind kind. 7 | * @param node 8 | * @param kind 9 | * @param max The maximum number of items to return. 10 | * @return all nodes of kind, or [] if none is found 11 | */ 12 | export function findNodes(node: ts.Node, kind: ts.SyntaxKind, max: number = Infinity): ts.Node[] { 13 | if (!node || max == 0) { 14 | return []; 15 | } 16 | 17 | let arr: ts.Node[] = []; 18 | if (node.kind === kind) { 19 | arr.push(node); 20 | max--; 21 | } 22 | if (max > 0) { 23 | for (const child of node.getChildren()) { 24 | findNodes(child, kind, max).forEach(node => { 25 | if (max > 0) { 26 | arr.push(node); 27 | } 28 | max--; 29 | }); 30 | 31 | if (max <= 0) { 32 | break; 33 | } 34 | } 35 | } 36 | return arr; 37 | } 38 | 39 | 40 | export function removeAstNode(node: ts.Node): Change { 41 | const source = node.getSourceFile(); 42 | return new RemoveChange( 43 | source.path, 44 | node.getStart(source), 45 | node.getFullText(source) 46 | ); 47 | } 48 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/test.ts: -------------------------------------------------------------------------------- 1 | import './polyfills.ts'; 2 | <% if(universal) { %>import './__2.1.1.workaround.ts';<% } %> 3 | 4 | import 'zone.js/dist/long-stack-trace-zone'; 5 | import 'zone.js/dist/proxy.js'; 6 | import 'zone.js/dist/sync-test'; 7 | import 'zone.js/dist/jasmine-patch'; 8 | import 'zone.js/dist/async-test'; 9 | import 'zone.js/dist/fake-async-test'; 10 | import { getTestBed } from '@angular/core/testing'; 11 | import { 12 | BrowserDynamicTestingModule, 13 | platformBrowserDynamicTesting 14 | } from '@angular/platform-browser-dynamic/testing'; 15 | 16 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 17 | declare var __karma__: any; 18 | declare var require: any; 19 | 20 | // Prevent Karma from running prematurely. 21 | __karma__.loaded = function () {}; 22 | 23 | // First, initialize the Angular testing environment. 24 | getTestBed().initTestEnvironment( 25 | BrowserDynamicTestingModule, 26 | platformBrowserDynamicTesting() 27 | ); 28 | // Then we find all the tests. 29 | let context = require.context('./', true, /\.spec\.ts$/); 30 | // And load the modules. 31 | context.keys().map(context); 32 | // Finally, start Karma to run the tests. 33 | __karma__.start(); 34 | -------------------------------------------------------------------------------- /packages/@ngtools/webpack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@ngtools/webpack", 3 | "version": "1.1.9", 4 | "description": "Webpack plugin that AoT compiles your Angular components and modules.", 5 | "main": "./src/index.js", 6 | "typings": "src/index.d.ts", 7 | "license": "MIT", 8 | "keywords": [ 9 | "angular", 10 | "webpack", 11 | "plugin", 12 | "aot" 13 | ], 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/angular/angular-cli.git" 17 | }, 18 | "author": "angular", 19 | "bugs": { 20 | "url": "https://github.com/angular/angular-cli/issues" 21 | }, 22 | "homepage": "https://github.com/angular/angular-cli/tree/master/packages/webpack", 23 | "engines": { 24 | "node": ">= 4.1.0", 25 | "npm": ">= 3.0.0" 26 | }, 27 | "dependencies": { 28 | "enhanced-resolve": "^2.3.0", 29 | "loader-utils": "^0.2.16", 30 | "magic-string": "^0.16.0", 31 | "source-map": "^0.5.6" 32 | }, 33 | "peerDependencies": { 34 | "@angular/compiler": "2.2.3", 35 | "@angular/compiler-cli": "2.2.3", 36 | "@angular/core": "2.2.3", 37 | "@angular/tsc-wrapped": "0.4.0", 38 | "typescript": "^2.0.2", 39 | "reflect-metadata": "^0.1.8", 40 | "webpack": "^2.1.0-beta.25" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/acceptance/destroy.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const ng = require('../helpers/ng'); 4 | const tmp = require('../helpers/tmp'); 5 | const SilentError = require('silent-error'); 6 | const expect = require('chai').expect; 7 | 8 | describe('Acceptance: ung destroy', function () { 9 | beforeEach(function () { 10 | this.timeout(10000); 11 | return tmp.setup('./tmp').then(function () { 12 | process.chdir('./tmp'); 13 | }).then(function () { 14 | return ng(['new', 'foo', '--skip-npm', '--skip-bower']); 15 | }); 16 | }); 17 | 18 | afterEach(function () { 19 | // return tmp.teardown('./tmp'); 20 | }); 21 | 22 | it('without args should fail', function () { 23 | return ng(['destroy']).then(() => { 24 | throw new SilentError('ung destroy should fail.'); 25 | }, (err) => { 26 | expect(err.message).to.equal('The destroy command is not supported by Universal-CLI.'); 27 | }); 28 | }); 29 | 30 | it('with args should fail', function () { 31 | return ng(['destroy', 'something']).then(() => { 32 | throw new SilentError('ung destroy something should fail.'); 33 | }, (err) => { 34 | expect(err.message).to.equal('The destroy command is not supported by Universal-CLI.'); 35 | }); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/e2e/tests/test/e2e.ts: -------------------------------------------------------------------------------- 1 | import { ng, killAllProcesses } from '../../utils/process'; 2 | import { expectToFail, isUniversalTest } from '../../utils/utils'; 3 | import { ngServe, ngUniversalServe } from '../../utils/project'; 4 | 5 | 6 | function _runServeAndE2e(...args: string[]) { 7 | return ngServe(...args) 8 | .then(() => ng('e2e')) 9 | .then(() => killAllProcesses(), (err: any) => { 10 | killAllProcesses(); 11 | throw err; 12 | }); 13 | } 14 | 15 | function _runUniversalServeAndE2e(...args: string[]) { 16 | return ngUniversalServe(...args) 17 | .then(() => ng('e2e')) 18 | .then(() => killAllProcesses(), (err: any) => { 19 | killAllProcesses(); 20 | throw err; 21 | }); 22 | } 23 | 24 | export default function () { 25 | /** AOT test disabled for universal */ 26 | if (isUniversalTest()) { 27 | return expectToFail(() => ng('e2e')) 28 | .then(() => _runUniversalServeAndE2e('--prod')); 29 | } 30 | // This is supposed to fail without serving first... 31 | return expectToFail(() => ng('e2e')) 32 | // These should work. 33 | .then(() => _runServeAndE2e()) 34 | .then(() => _runServeAndE2e('--prod')) 35 | .then(() => _runServeAndE2e('--aot')) 36 | .then(() => _runServeAndE2e('--aot', '--prod')); 37 | } 38 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/universal/files/__path__/app/app.browser.module.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file and `main.node.ts` are identical, at the moment(!) 3 | * By splitting these, you're able to create logic, imports, etc that are "Platform" specific. 4 | * If you want your code to be completely Universal and don't need that 5 | * You can also just have 1 file, that is imported into both 6 | * client.ts and server.ts 7 | */ 8 | 9 | import { NgModule } from '@angular/core'; 10 | import { UniversalModule } from 'angular2-universal'; 11 | import { FormsModule } from '@angular/forms'; 12 | import { AppModule } from './app.module'; 13 | import { AppComponent } from './index'; 14 | // import { RouterModule } from '@angular/router'; 15 | // import { appRoutes } from './app/app.routing'; 16 | 17 | /** 18 | * Top-level NgModule "container" 19 | */ 20 | @NgModule({ 21 | /** Root App Component */ 22 | bootstrap: [ AppComponent ], 23 | imports: [ 24 | /** 25 | * NOTE: Needs to be your first import (!) 26 | * BrowserModule, HttpModule, and JsonpModule are included 27 | */ 28 | UniversalModule, 29 | AppModule 30 | /** 31 | * using routes 32 | */ 33 | // RouterModule.forRoot(appRoutes) 34 | ] 35 | }) 36 | export class BrowserAppModule { 37 | 38 | } 39 | -------------------------------------------------------------------------------- /packages/universal-cli/models/webpack-build-mobile.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | const OfflinePlugin = require('offline-plugin'); 3 | import { GlobCopyWebpackPlugin } from '../plugins/glob-copy-webpack-plugin'; 4 | import { PrerenderWebpackPlugin } from '../utilities/prerender-webpack-plugin'; 5 | 6 | export const getWebpackMobileConfigPartial = function (projectRoot: string, appConfig: any) { 7 | // Hardcoded files and paths here should be part of appConfig when 8 | // reworking the mobile app functionality 9 | return { 10 | plugins: [ 11 | new GlobCopyWebpackPlugin({ 12 | patterns: [ 'icons', 'manifest.webapp'], 13 | globOptions: {cwd: appConfig.root, dot: true, ignore: '**/.gitkeep'} 14 | }), 15 | new PrerenderWebpackPlugin({ 16 | templatePath: 'index.html', 17 | configPath: path.resolve(projectRoot, appConfig.root, 'main-app-shell.ts'), 18 | appPath: path.resolve(projectRoot, appConfig.root) 19 | }) 20 | ] 21 | }; 22 | }; 23 | 24 | export const getWebpackMobileProdConfigPartial = function (projectRoot: string, appConfig: any) { 25 | return { 26 | entry: { 27 | 'sw-install': path.resolve(__dirname, '../utilities/sw-install.js') 28 | }, 29 | plugins: [ 30 | new OfflinePlugin() 31 | ] 32 | }; 33 | }; 34 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/ts-paths.ts: -------------------------------------------------------------------------------- 1 | import {updateTsConfig} from '../../utils/project'; 2 | import {writeMultipleFiles, appendToFile, createDir} from '../../utils/fs'; 3 | import {ng} from '../../utils/process'; 4 | import {stripIndents} from 'common-tags'; 5 | 6 | 7 | export default function() { 8 | return updateTsConfig(json => { 9 | json['compilerOptions']['baseUrl'] = '.'; 10 | json['compilerOptions']['paths'] = { 11 | '@shared': [ 12 | 'app/shared' 13 | ], 14 | '@shared/*': [ 15 | 'app/shared/*' 16 | ] 17 | }; 18 | }) 19 | .then(() => createDir('src/app/shared')) 20 | .then(() => writeMultipleFiles({ 21 | 'src/app/shared/meaning.ts': 'export var meaning = 42;', 22 | 'src/app/shared/index.ts': `export * from './meaning'` 23 | })) 24 | .then(() => appendToFile('src/app/app.component.ts', stripIndents` 25 | import { meaning } from 'app/shared/meaning'; 26 | import { meaning as meaning2 } from '@shared'; 27 | import { meaning as meaning3 } from '@shared/meaning'; 28 | 29 | // need to use imports otherwise they are ignored and 30 | // no error is outputted, even if baseUrl/paths don't work 31 | console.log(meaning) 32 | console.log(meaning2) 33 | console.log(meaning3) 34 | `)) 35 | .then(() => ng('build')); 36 | } 37 | -------------------------------------------------------------------------------- /tests/helpers/mock-ui.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var UI = require('universal-cli/ember-cli/lib/ui'); 4 | var through = require('through'); 5 | var Promise = require('universal-cli/ember-cli/lib/ext/promise'); 6 | 7 | module.exports = MockUI; 8 | function MockUI() { 9 | this.output = ''; 10 | 11 | UI.call(this, { 12 | inputStream: through(), 13 | outputStream: through(function (data) { 14 | this.output += data; 15 | }.bind(this)), 16 | errorStream: through(function (data) { 17 | this.errors += data; 18 | }.bind(this)) 19 | }); 20 | } 21 | 22 | MockUI.prototype = Object.create(UI.prototype); 23 | MockUI.prototype.constructor = MockUI; 24 | MockUI.prototype.clear = function () { 25 | this.output = ''; 26 | }; 27 | 28 | MockUI.prototype.waitForPrompt = function () { 29 | if (!this._waitingForPrompt) { 30 | var promise, resolver; 31 | promise = new Promise(function (resolve) { 32 | resolver = resolve; 33 | }); 34 | this._waitingForPrompt = promise; 35 | this._promptResolver = resolver; 36 | } 37 | return this._waitingForPrompt; 38 | }; 39 | 40 | MockUI.prototype.prompt = function (opts, cb) { 41 | if (this._waitingForPrompt) { 42 | this._waitingForPrompt = null; 43 | this._promptResolver(); 44 | } 45 | return UI.prototype.prompt.call(this, opts, cb); 46 | }; 47 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/README.md: -------------------------------------------------------------------------------- 1 | # <%= jsComponentName %> 2 | 3 | This project was generated with [universal-cli](https://github.com/devCrossNet/universal-cli) version <%= version %>. 4 | 5 | ## Development server 6 | Run `ung serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 7 | 8 | ## Code scaffolding 9 | 10 | Run `ung generate component component-name` to generate a new component. You can also use `ung generate directive/pipe/service/class`. 11 | 12 | ## Build 13 | 14 | Run `ung build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 15 | 16 | ## Running unit tests 17 | 18 | Run `ung test` to execute the unit tests via [Karma](https://karma-runner.github.io). 19 | 20 | ## Running end-to-end tests 21 | 22 | Run `ung e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 23 | Before running the tests make sure you are serving the app via `ung serve`. 24 | 25 | ## Deploying to Github Pages 26 | 27 | Run `ung github-pages:deploy` to deploy to Github Pages. 28 | 29 | ## Further help 30 | 31 | To get more help on the `universal-cli` use `ung --help` or go check out the [Universal-CLI README](https://github.com/devCrossNet/universal-cli/blob/master/README.md). 32 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/0.13/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', 'universal-cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-remap-istanbul'), 12 | require('universal-cli/plugins/karma') 13 | ], 14 | files: [ 15 | { pattern: './<%= sourceDir %>/test.ts', watched: false } 16 | ], 17 | preprocessors: { 18 | './<%= sourceDir %>/test.ts': ['universal-cli'] 19 | }, 20 | mime: { 21 | 'text/x-typescript': ['ts','tsx'] 22 | }, 23 | remapIstanbulReporter: { 24 | reports: { 25 | html: 'coverage', 26 | lcovonly: './coverage/coverage.lcov' 27 | } 28 | }, 29 | angularCli: { 30 | config: './angular-cli.json', 31 | environment: 'dev' 32 | }, 33 | reporters: config.angularCli && config.angularCli.codeCoverage 34 | ? ['progress', 'karma-remap-istanbul'] 35 | : ['progress'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false 42 | }); 43 | }; 44 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/icons/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /lib/packages.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fs = require('fs'); 4 | const glob = require('glob'); 5 | const path = require('path'); 6 | 7 | const packageRoot = path.join(__dirname, '../packages'); 8 | 9 | // All the supported packages. Go through the packages directory and create a map of 10 | // name => fullPath. 11 | const packages = 12 | glob.sync(path.join(packageRoot, '**/package.json')) 13 | .filter(p => !p.match(/blueprints/)) 14 | .map(pkgPath => path.relative(packageRoot, path.dirname(pkgPath))) 15 | .map(pkgName => { 16 | return { name: pkgName, root: path.join(packageRoot, pkgName) }; 17 | }) 18 | .reduce((packages, pkg) => { 19 | let pkgJson = JSON.parse(fs.readFileSync(path.join(pkg.root, 'package.json'), 'utf8')); 20 | let name = pkgJson['name']; 21 | 22 | packages[name] = { 23 | dist: path.join(__dirname, '../dist', pkg.name), 24 | packageJson: path.join(pkg.root, 'package.json'), 25 | root: pkg.root, 26 | relative: path.relative(path.dirname(__dirname), pkg.root), 27 | main: path.resolve(pkg.root, 'src/index.ts') 28 | }; 29 | return packages; 30 | }, {}); 31 | 32 | 33 | module.exports = packages; 34 | 35 | 36 | // If we run this from the command line, just output the list of modules neatly formatted. 37 | if (require.main === module) { 38 | // eslint-disable-next-line no-console 39 | console.log(JSON.stringify(packages, null, 2)); 40 | } 41 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async } from '@angular/core/testing';<% if (routing) { %> 4 | import { RouterTestingModule } from '@angular/router/testing';<% } %> 5 | import { AppComponent } from './app.component'; 6 | 7 | describe('AppComponent', () => { 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({<% if (routing) { %> 10 | imports: [ 11 | RouterTestingModule 12 | ],<% } %> 13 | declarations: [ 14 | AppComponent 15 | ], 16 | }); 17 | TestBed.compileComponents(); 18 | }); 19 | 20 | it('should create the app', async(() => { 21 | let fixture = TestBed.createComponent(AppComponent); 22 | let app = fixture.debugElement.componentInstance; 23 | expect(app).toBeTruthy(); 24 | })); 25 | 26 | it(`should have as title '<%= prefix %> works!'`, async(() => { 27 | let fixture = TestBed.createComponent(AppComponent); 28 | let app = fixture.debugElement.componentInstance; 29 | expect(app.title).toEqual('<%= prefix %> works!'); 30 | })); 31 | 32 | it('should render title in a h1 tag', async(() => { 33 | let fixture = TestBed.createComponent(AppComponent); 34 | fixture.detectChanges(); 35 | let compiled = fixture.debugElement.nativeElement; 36 | expect(compiled.querySelector('h1').textContent).toContain('<%= prefix %> works!'); 37 | })); 38 | }); 39 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/interface/index.js: -------------------------------------------------------------------------------- 1 | const stringUtils = require('ember-cli-string-utils'); 2 | var dynamicPathParser = require('../../utilities/dynamic-path-parser'); 3 | 4 | module.exports = { 5 | description: '', 6 | 7 | anonymousOptions: [ 8 | '' 9 | ], 10 | 11 | normalizeEntityName: function (entityName) { 12 | var parsedPath = dynamicPathParser(this.project, entityName); 13 | 14 | this.dynamicPath = parsedPath; 15 | return parsedPath.name; 16 | }, 17 | 18 | locals: function (options) { 19 | var interfaceType = options.args [2] 20 | this.fileName = stringUtils.dasherize(options.entity.name); 21 | if (interfaceType) { 22 | this.fileName += '.' + interfaceType; 23 | } 24 | var prefix = ''; 25 | if (this.project.ngConfig && 26 | this.project.ngConfig.defaults && 27 | this.project.ngConfig.defaults.prefixInterfaces) { 28 | prefix = 'I'; 29 | } 30 | return { 31 | dynamicPath: this.dynamicPath.dir, 32 | flat: options.flat, 33 | fileName: this.fileName, 34 | prefix: prefix 35 | }; 36 | }, 37 | 38 | fileMapTokens: function () { 39 | // Return custom template variables here. 40 | return { 41 | __path__: () => { 42 | this.generatePath = this.dynamicPath.dir; 43 | return this.generatePath; 44 | }, 45 | __name__: () => { 46 | return this.fileName; 47 | } 48 | }; 49 | } 50 | }; 51 | -------------------------------------------------------------------------------- /scripts/publish/changelog.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | 4 | /** 5 | * Just a small command-line wrapper around the conventional-changelog npm module 6 | * (https://www.npmjs.com/package/conventional-changelog), which also prepends 7 | * changes to CHANGELOG.md. 8 | * 9 | * Appends CHANGELOG.md with the changes between tag and HEAD. 10 | * NOTE: only `fix`, `feat`, `perf` and `revert` commits are used 11 | * see: https://github.com/conventional-changelog/conventional-changelog/blob/v0.2.1/presets/angular.js#L24 12 | */ 13 | 14 | var fs = require('fs'); 15 | var cl = require('conventional-changelog'); 16 | const exec = require('child_process').exec; 17 | 18 | var changelogStream = fs.createWriteStream('CHANGELOG-delta.md'); 19 | 20 | if (process.argv.length < 3) { 21 | // eslint-disable-next-line no-console 22 | console.log('Usage: ./scripts/publish/changelog.js '); 23 | process.exit(-1); 24 | } 25 | 26 | var config = { 27 | preset: 'angular', 28 | releaseCount: 1 29 | }; 30 | 31 | var prependDelta = function() { 32 | exec('cat CHANGELOG-delta.md CHANGELOG.md > CHANGELOG-new.md;' + 33 | 'mv CHANGELOG-new.md CHANGELOG.md;' + 34 | 'rm CHANGELOG-delta.md'); 35 | } 36 | 37 | cl(config, null, { from: process.argv[2] }) 38 | .on('error', function(err) { 39 | // eslint-disable-next-line no-console 40 | console.error('Failed to generate changelog: ' + err); 41 | }) 42 | .pipe(changelogStream) 43 | .on('close', prependDelta); 44 | -------------------------------------------------------------------------------- /tests/e2e/tests/generate/component/component-path-case.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {ng} from '../../../utils/process'; 3 | import {expectFileToExist, createDir} from '../../../utils/fs'; 4 | 5 | 6 | export default function() { 7 | const rootDir = join('src', 'app', 'Upper-Dir'); 8 | createDir(rootDir); 9 | const componentDir = join(rootDir, 'test-component'); 10 | const componentTwoDir = join(rootDir, 'test-component-two'); 11 | 12 | return ng('generate', 'component', 'Upper-Dir/test-component') 13 | .then(() => expectFileToExist(componentDir)) 14 | .then(() => expectFileToExist(join(componentDir, 'test-component.component.ts'))) 15 | .then(() => expectFileToExist(join(componentDir, 'test-component.component.spec.ts'))) 16 | .then(() => expectFileToExist(join(componentDir, 'test-component.component.html'))) 17 | .then(() => expectFileToExist(join(componentDir, 'test-component.component.css'))) 18 | .then(() => ng('generate', 'component', 'Upper-Dir/Test-Component-Two')) 19 | .then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.ts'))) 20 | .then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.spec.ts'))) 21 | .then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.html'))) 22 | .then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.css'))) 23 | 24 | // Try to run the unit tests. 25 | .then(() => ng('test', '--watch=false')); 26 | } 27 | -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/utilities/windows-admin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Promise = require('../ext/promise'); 4 | var chalk = require('chalk'); 5 | var exec = require('child_process').exec; 6 | 7 | module.exports = { 8 | /** 9 | * Uses the eon-old command NET SESSION to determine whether or not the 10 | * current user has elevated rights (think sudo, but Windows). 11 | * 12 | * @method checkWindowsElevation 13 | * @param {Object} ui - ui object used to call writeLine(); 14 | * @return {Object} Object describing whether we're on windows and if admin rights exist 15 | */ 16 | checkWindowsElevation: function (ui) { 17 | return new Promise(function (resolve) { 18 | if (/^win/.test(process.platform)) { 19 | exec('NET SESSION', function (error, stdout, stderr) { 20 | var elevated = (!stderr || stderr.length === 0); 21 | 22 | if (!elevated && ui && ui.writeLine) { 23 | ui.writeLine(chalk.yellow('\nRunning without elevated rights. ' + 24 | 'Running Ember CLI "as Administrator" increases performance significantly.')); 25 | ui.writeLine('See ember-cli.com/user-guide/#windows for details.\n'); 26 | } 27 | 28 | resolve({ 29 | windows: true, 30 | elevated: elevated 31 | }); 32 | }); 33 | } else { 34 | resolve({ 35 | windows: false, 36 | elevated: null 37 | }); 38 | } 39 | }); 40 | } 41 | }; 42 | -------------------------------------------------------------------------------- /tests/e2e/assets/ssl/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIID5jCCAs6gAwIBAgIJAJOebwfGCm61MA0GCSqGSIb3DQEBBQUAMFUxCzAJBgNV 3 | BAYTAlVTMRAwDgYDVQQIEwdHZW9yZ2lhMRAwDgYDVQQHEwdBdGxhbnRhMRAwDgYD 4 | VQQKEwdBbmd1bGFyMRAwDgYDVQQLEwdBbmd1bGFyMB4XDTE2MTAwNDAxMDAyMVoX 5 | DTI2MTAwMjAxMDAyMVowVTELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB0dlb3JnaWEx 6 | EDAOBgNVBAcTB0F0bGFudGExEDAOBgNVBAoTB0FuZ3VsYXIxEDAOBgNVBAsTB0Fu 7 | Z3VsYXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDT6Q4d1+mw81SC 8 | 4K1qLbsMn4O459XDiDDU/cGBiE0byqi6RpaB0MujCPn35xdeCf1mdDw929leEIRB 9 | w/fCN3VwE+4ZDM7sF6SgoSDN8YT/OOush4tDu0djH110I+i1Bfg4m7gVkUnJLUCv 10 | vMMOlD19LDqqaxdY3ojXx8gZJW9sNtUH2vCICwsZ7aNZp2NcCNKpU7LppP4IomCd 11 | GfG501kY/UtELVgNGX+zuJwIiH/2AQZ+fsaDBBD0Azanck2M/aq5yVKMG8y/S5WP 12 | 7LMvZs8ZHPSG73QINogRTYW0EKx7nT87vmrHRtCc9u4coPdqOzQN9BigCYVkYrTv 13 | xkOX9VDHAgMBAAGjgbgwgbUwHQYDVR0OBBYEFG4VV6/aNLx/qFIS9MhAWuyeV5OX 14 | MIGFBgNVHSMEfjB8gBRuFVev2jS8f6hSEvTIQFrsnleTl6FZpFcwVTELMAkGA1UE 15 | BhMCVVMxEDAOBgNVBAgTB0dlb3JnaWExEDAOBgNVBAcTB0F0bGFudGExEDAOBgNV 16 | BAoTB0FuZ3VsYXIxEDAOBgNVBAsTB0FuZ3VsYXKCCQCTnm8HxgputTAMBgNVHRME 17 | BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQDO4jZT/oKVxaiWr+jV5TD+qwThl9zT 18 | Uw/ZpFDkdbZdY/baCFaLCiJwkK9+puMOabLvm1VzcnHHWCoiUNbWpw8AOumLEnTv 19 | ze/5OZXJ6XlA9kd9f3hDlN5zNB3S+Z2nKIrkPGfxQZ603QCbWaptip5dxgek6oDZ 20 | YXVtnbOnPznRsG5jh07U49RO8CNebqZLzdRToLgObbqYlfRMcbUxCOHXjnB5wUlp 21 | 377Iivm4ldnCTvFOjEiDh+FByWL5xic7PjyJPZFMidiYTmsGilP9XTFC83CRZwz7 22 | vW+RCSlU6x8Uejz98BPmASoqCuCTUeOo+2pFelFhX9NwR/Sb6b7ybdPv 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /packages/@angular-cli/base-href-webpack/src/base-href-webpack-plugin.ts: -------------------------------------------------------------------------------- 1 | export interface BaseHrefWebpackPluginOptions { 2 | baseHref: string; 3 | } 4 | 5 | export class BaseHrefWebpackPlugin { 6 | constructor(private options: BaseHrefWebpackPluginOptions) { } 7 | 8 | apply(compiler: any): void { 9 | // Ignore if baseHref is not passed 10 | if (!this.options.baseHref) { 11 | return; 12 | } 13 | 14 | compiler.plugin('compilation', (compilation: any) => { 15 | compilation.plugin( 16 | 'html-webpack-plugin-before-html-processing', 17 | (htmlPluginData: any, callback: Function) => { 18 | // Check if base tag already exists 19 | const baseTagRegex = //i; 20 | const baseTagMatches = htmlPluginData.html.match(baseTagRegex); 21 | if (!baseTagMatches) { 22 | // Insert it in top of the head if not exist 23 | htmlPluginData.html = htmlPluginData.html.replace( 24 | //i, '$&' + `` 25 | ); 26 | } else { 27 | // Replace only href attribute if exists 28 | const modifiedBaseTag = baseTagMatches[0].replace( 29 | /href="\S+"/i, `href="${this.options.baseHref}"` 30 | ); 31 | htmlPluginData.html = htmlPluginData.html.replace(baseTagRegex, modifiedBaseTag); 32 | } 33 | 34 | callback(null, htmlPluginData); 35 | } 36 | ); 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/e2e/setup/100-npm-link.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {npm, exec} from '../utils/process'; 3 | import {updateJsonFile} from '../utils/project'; 4 | import {getGlobalVariable} from '../utils/env'; 5 | 6 | const packages = require('../../../lib/packages'); 7 | 8 | 9 | export default function () { 10 | return Promise.resolve() 11 | .then(() => { 12 | const argv = getGlobalVariable('argv'); 13 | if (argv.nolink) { 14 | return; 15 | } 16 | 17 | const distAngularCli = join(__dirname, '../../../dist/universal-cli'); 18 | const oldCwd = process.cwd(); 19 | process.chdir(distAngularCli); 20 | 21 | // Update the package.json of each packages. 22 | return Promise.all(Object.keys(packages).map(pkgName => { 23 | const p = packages[pkgName]; 24 | 25 | return updateJsonFile(join(p.dist, 'package.json'), json => { 26 | for (const pkgName of Object.keys(packages)) { 27 | if (json['dependencies'] && json['dependencies'][pkgName]) { 28 | json['dependencies'][pkgName] = packages[pkgName].dist; 29 | } 30 | if (json['devDependencies'] && json['devDependencies'][pkgName]) { 31 | json['devDependencies'][pkgName] = packages[pkgName].dist; 32 | } 33 | } 34 | }); 35 | })) 36 | .then(() => npm('link')) 37 | .then(() => process.chdir(oldCwd)); 38 | }) 39 | .then(() => exec(process.platform.startsWith('win') ? 'where' : 'which', 'ung')); 40 | } 41 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "max-line-length": [true, 100], 4 | "no-inferrable-types": true, 5 | "class-name": true, 6 | "comment-format": [ 7 | true, 8 | "check-space" 9 | ], 10 | "indent": [ 11 | true, 12 | "spaces" 13 | ], 14 | "eofline": true, 15 | "no-duplicate-variable": true, 16 | "no-eval": true, 17 | "no-arg": true, 18 | "no-internal-module": true, 19 | "no-trailing-whitespace": true, 20 | "no-bitwise": true, 21 | "no-unused-expression": true, 22 | "no-var-keyword": true, 23 | "one-line": [ 24 | true, 25 | "check-catch", 26 | "check-else", 27 | "check-open-brace", 28 | "check-whitespace" 29 | ], 30 | "quotemark": [ 31 | true, 32 | "single", 33 | "avoid-escape" 34 | ], 35 | "semicolon": [true, "always"], 36 | "typedef-whitespace": [ 37 | true, 38 | { 39 | "call-signature": "nospace", 40 | "index-signature": "nospace", 41 | "parameter": "nospace", 42 | "property-declaration": "nospace", 43 | "variable-declaration": "nospace" 44 | } 45 | ], 46 | "curly": true, 47 | "variable-name": [ 48 | true, 49 | "ban-keywords", 50 | "check-format", 51 | "allow-leading-underscore", 52 | "allow-pascal-case" 53 | ], 54 | "whitespace": [ 55 | true, 56 | "check-branch", 57 | "check-decl", 58 | "check-operator", 59 | "check-separator", 60 | "check-type" 61 | ] 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tests/models/spec-schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "id": "CliConfig", 4 | "type": "object", 5 | "properties": { 6 | "requiredKey": { 7 | "type": "number" 8 | }, 9 | "stringKeyDefault": { 10 | "type": "string", 11 | "default": "defaultValue" 12 | }, 13 | "stringKey": { 14 | "type": "string" 15 | }, 16 | "booleanKey": { 17 | "type": "boolean" 18 | }, 19 | "numberKey": { 20 | "type": "number" 21 | }, 22 | "objectKey1": { 23 | "type": "object", 24 | "properties": { 25 | "stringKey": { 26 | "type": "string" 27 | }, 28 | "objectKey": { 29 | "type": "object", 30 | "properties": { 31 | "stringKey": { 32 | "type": "string" 33 | } 34 | } 35 | } 36 | } 37 | }, 38 | "objectKey2": { 39 | "type": "object", 40 | "properties": { 41 | "stringKey": { 42 | "type": "string" 43 | } 44 | }, 45 | "additionalProperties": true 46 | }, 47 | "arrayKey1": { 48 | "type": "array", 49 | "items": { 50 | "stringKey": { 51 | "type": "string" 52 | } 53 | } 54 | }, 55 | "arrayKey2": { 56 | "type": "array", 57 | "items": { 58 | "type": "object", 59 | "properties": { 60 | "stringKey": { 61 | "type": "string" 62 | } 63 | } 64 | } 65 | } 66 | }, 67 | "required": ["requiredKey"] 68 | } -------------------------------------------------------------------------------- /packages/universal-cli/ember-cli/lib/tasks/create-and-step-into-directory.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Creates a directory with the name directoryName in cwd and then sets cwd to 4 | // this directory. 5 | 6 | var Promise = require('../ext/promise'); 7 | var fs = require('fs'); 8 | var existsSync = require('exists-sync'); 9 | var mkdir = Promise.denodeify(fs.mkdir); 10 | var Task = require('../models/task'); 11 | var SilentError = require('silent-error'); 12 | 13 | module.exports = Task.extend({ 14 | // Options: String directoryName, Boolean: dryRun 15 | 16 | warnDirectoryAlreadyExists: function warnDirectoryAlreadyExists() { 17 | var message = 'Directory \'' + this.directoryName + '\' already exists.'; 18 | return new SilentError(message); 19 | }, 20 | 21 | run: function(options) { 22 | var directoryName = this.directoryName = options.directoryName; 23 | if (options.dryRun) { 24 | return new Promise(function(resolve, reject) { 25 | if (existsSync(directoryName)) { 26 | return reject(this.warnDirectoryAlreadyExists()); 27 | } 28 | resolve(); 29 | }.bind(this)); 30 | } 31 | 32 | return mkdir(directoryName) 33 | .catch(function(err) { 34 | if (err.code === 'EEXIST') { 35 | throw this.warnDirectoryAlreadyExists(); 36 | } else { 37 | throw err; 38 | } 39 | }.bind(this)) 40 | .then(function() { 41 | var cwd = process.cwd(); 42 | process.chdir(directoryName); 43 | return { initialDirectory: cwd }; 44 | }); 45 | } 46 | }); 47 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/styles/loaders.ts: -------------------------------------------------------------------------------- 1 | import { 2 | writeMultipleFiles, 3 | deleteFile, 4 | expectFileToMatch, 5 | replaceInFile 6 | } from '../../../utils/fs'; 7 | import { ng } from '../../../utils/process'; 8 | import { stripIndents } from 'common-tags'; 9 | import { updateJsonFile } from '../../../utils/project'; 10 | import { expectToFail } from '../../../utils/utils'; 11 | import { getClientDist, getAppMain } from '../../../utils/utils'; 12 | 13 | export default function () { 14 | return writeMultipleFiles({ 15 | 'src/styles.scss': stripIndents` 16 | @import './imported-styles.scss'; 17 | body { background-color: blue; } 18 | `, 19 | 'src/imported-styles.scss': stripIndents` 20 | p { background-color: red; } 21 | `, 22 | 'src/app/app.component.scss': stripIndents` 23 | .outer { 24 | .inner { 25 | background: #fff; 26 | } 27 | } 28 | `}) 29 | .then(() => deleteFile('src/app/app.component.css')) 30 | .then(() => updateJsonFile('angular-cli.json', configJson => { 31 | const app = configJson['apps'][0]; 32 | app['styles'] = ['styles.scss']; 33 | })) 34 | .then(() => replaceInFile('src/app/app.component.ts', 35 | './app.component.css', './app.component.scss')) 36 | .then(() => ng('build')) 37 | .then(() => expectToFail(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 38 | /exports/))) 39 | .then(() => expectToFail(() => expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, 40 | /".*module\.exports.*\.outer.*background:/))); 41 | } 42 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/mobile/files/__path__/main-app-shell.ts: -------------------------------------------------------------------------------- 1 | import 'angular2-universal-polyfills'; 2 | import { provide } from '@angular/core'; 3 | import { APP_BASE_HREF } from '@angular/common'; 4 | import { APP_SHELL_BUILD_PROVIDERS } from '@angular/app-shell'; 5 | import { 6 | REQUEST_URL, 7 | ORIGIN_URL, 8 | Bootloader, 9 | BootloaderConfig, 10 | AppConfig 11 | } from 'angular2-universal'; 12 | import { AppComponent } from './app/'; 13 | 14 | const bootloaderConfig: BootloaderConfig = { 15 | platformProviders: [ 16 | APP_SHELL_BUILD_PROVIDERS, 17 | provide(ORIGIN_URL, { 18 | useValue: 'http://localhost:4200' // full urls are needed for node xhr 19 | }), 20 | provide(APP_BASE_HREF, { useValue: '/' }), 21 | ], 22 | async: true, 23 | preboot: false 24 | } 25 | 26 | const appConfig: AppConfig = { 27 | directives: [ 28 | // The component that will become the main App Shell 29 | AppComponent 30 | ], 31 | providers: [ 32 | // What URL should Angular be treating the app as if navigating 33 | provide(REQUEST_URL, { useValue: '/' }) 34 | ] 35 | } 36 | 37 | // The build system will call this function to get a bootloader 38 | export function getBootloader() : Bootloader { 39 | return new Bootloader(bootloaderConfig); 40 | } 41 | 42 | // The build system will call this function with the bootloader from 43 | // getBootloader and the contents of the index page 44 | export function serialize(bootloader: Bootloader, template: string) : string { 45 | appConfig.template = template; 46 | return bootloader.serializeApplication(appConfig); 47 | } -------------------------------------------------------------------------------- /packages/universal-cli/tasks/test.ts: -------------------------------------------------------------------------------- 1 | const Task = require('../ember-cli/lib/models/task'); 2 | import { TestOptions } from '../commands/test'; 3 | import * as path from 'path'; 4 | 5 | // require dependencies within the target project 6 | function requireDependency(root: string, moduleName: string) { 7 | const packageJson = require(path.join(root, 'node_modules', moduleName, 'package.json')); 8 | const main = path.normalize(packageJson.main); 9 | return require(path.join(root, 'node_modules', moduleName, main)); 10 | } 11 | 12 | export default Task.extend({ 13 | run: function (options: TestOptions) { 14 | const projectRoot = this.project.root; 15 | return new Promise((resolve) => { 16 | const karma = requireDependency(projectRoot, 'karma'); 17 | const karmaConfig = path.join(projectRoot, this.project.ngConfig.config.test.karma.config); 18 | 19 | let karmaOptions: any = Object.assign({}, options); 20 | 21 | // Convert browsers from a string to an array 22 | if (options.browsers) { 23 | karmaOptions.browsers = options.browsers.split(','); 24 | } 25 | 26 | karmaOptions.angularCli = { 27 | codeCoverage: options.codeCoverage, 28 | lint: options.lint, 29 | sourcemap: options.sourcemap, 30 | progress: options.progress 31 | }; 32 | 33 | // Assign additional karmaConfig options to the local ngapp config 34 | karmaOptions.configFile = karmaConfig; 35 | 36 | // :shipit: 37 | const karmaServer = new karma.Server(karmaOptions, resolve); 38 | karmaServer.start(); 39 | }); 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /packages/universal-cli/models/webpack-build-typescript.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import {AotPlugin} from '@ngtools/webpack'; 3 | 4 | 5 | const g: any = global; 6 | const webpackLoader: string = g['angularCliIsLocal'] 7 | ? g.angularCliPackages['@ngtools/webpack'].main 8 | : '@ngtools/webpack'; 9 | 10 | 11 | export const getWebpackNonAotConfigPartial = function(projectRoot: string, appConfig: any) { 12 | return { 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.ts$/, 17 | loader: webpackLoader, 18 | exclude: [/\.(spec|e2e)\.ts$/] 19 | } 20 | ] 21 | }, 22 | plugins: [ 23 | new AotPlugin({ 24 | tsConfigPath: path.resolve(projectRoot, appConfig.root, appConfig.tsconfig), 25 | mainPath: path.join(projectRoot, appConfig.root, appConfig.main), 26 | skipCodeGeneration: true 27 | }), 28 | ] 29 | }; 30 | }; 31 | 32 | export const getWebpackAotConfigPartial = function(projectRoot: string, appConfig: any, 33 | i18nFile: string, i18nFormat: string, locale: string) { 34 | return { 35 | module: { 36 | rules: [ 37 | { 38 | test: /\.ts$/, 39 | loader: webpackLoader, 40 | exclude: [/\.(spec|e2e)\.ts$/] 41 | } 42 | ] 43 | }, 44 | plugins: [ 45 | new AotPlugin({ 46 | tsConfigPath: path.resolve(projectRoot, appConfig.root, appConfig.tsconfig), 47 | mainPath: path.join(projectRoot, appConfig.root, appConfig.main), 48 | i18nFile: i18nFile, 49 | i18nFormat: i18nFormat, 50 | locale: locale 51 | }), 52 | ] 53 | }; 54 | }; 55 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/styles/stylus.ts: -------------------------------------------------------------------------------- 1 | import { 2 | writeMultipleFiles, 3 | deleteFile, 4 | expectFileToMatch, 5 | replaceInFile 6 | } from '../../../utils/fs'; 7 | import { ng } from '../../../utils/process'; 8 | import { stripIndents } from 'common-tags'; 9 | import { updateJsonFile } from '../../../utils/project'; 10 | import { getClientDist, getAppMain } from '../../../utils/utils'; 11 | 12 | export default function () { 13 | return writeMultipleFiles({ 14 | 'src/styles.styl': stripIndents` 15 | @import './imported-styles.styl'; 16 | body { background-color: blue; } 17 | `, 18 | 'src/imported-styles.styl': stripIndents` 19 | p { background-color: red; } 20 | `, 21 | 'src/app/app.component.styl': stripIndents` 22 | .outer { 23 | .inner { 24 | background: #fff; 25 | } 26 | } 27 | `}) 28 | .then(() => deleteFile('src/app/app.component.css')) 29 | .then(() => updateJsonFile('angular-cli.json', configJson => { 30 | const app = configJson['apps'][0]; 31 | app['styles'] = ['styles.styl']; 32 | })) 33 | .then(() => replaceInFile('src/app/app.component.ts', 34 | './app.component.css', './app.component.styl')) 35 | .then(() => ng('build')) 36 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 37 | /body\s*{\s*background-color: #00f;\s*}/)) 38 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 39 | /p\s*{\s*background-color: #f00;\s*}/)) 40 | .then(() => expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, 41 | /.outer.*.inner.*background:\s*#[fF]+/)); 42 | } 43 | -------------------------------------------------------------------------------- /tests/e2e/tests/third-party/bootstrap.ts: -------------------------------------------------------------------------------- 1 | import { npm, ng } from '../../utils/process'; 2 | import { updateJsonFile } from '../../utils/project'; 3 | import { expectFileToMatch } from '../../utils/fs'; 4 | import { oneLineTrim } from 'common-tags'; 5 | import { getAppMain, getClientDist } from '../../utils/utils'; 6 | 7 | 8 | export default function () { 9 | return Promise.resolve() 10 | .then(() => npm('install', 'bootstrap@next')) 11 | .then(() => updateJsonFile('angular-cli.json', configJson => { 12 | const app = configJson['apps'][0]; 13 | app['styles'].push('../node_modules/bootstrap/dist/css/bootstrap.css'); 14 | app['scripts'].push( 15 | '../node_modules/jquery/dist/jquery.js', 16 | '../node_modules/tether/dist/js/tether.js', 17 | '../node_modules/bootstrap/dist/js/bootstrap.js' 18 | ); 19 | })) 20 | .then(() => ng('build')) 21 | .then(() => expectFileToMatch(`${getClientDist()}scripts.bundle.js`, '* jQuery JavaScript')) 22 | .then(() => expectFileToMatch(`${getClientDist()}scripts.bundle.js`, '/*! tether ')) 23 | .then(() => expectFileToMatch(`${getClientDist()}scripts.bundle.js`, '* Bootstrap')) 24 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, '* Bootstrap')) 25 | .then(() => expectFileToMatch(`${getClientDist()}index.html`, oneLineTrim` 26 | 27 | 28 | 29 | 30 | `)); 31 | } 32 | -------------------------------------------------------------------------------- /tests/acceptance/generate-class.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const ng = require('../helpers/ng'); 4 | const tmp = require('../helpers/tmp'); 5 | 6 | const existsSync = require('exists-sync'); 7 | const expect = require('chai').expect; 8 | const path = require('path'); 9 | const root = process.cwd(); 10 | 11 | const testPath = path.join(root, 'tmp', 'foo', 'src', 'app'); 12 | 13 | describe('Acceptance: ung generate class', function () { 14 | beforeEach(function () { 15 | this.timeout(10000); 16 | return tmp.setup('./tmp').then(function () { 17 | process.chdir('./tmp'); 18 | }).then(function () { 19 | return ng(['new', 'foo', '--skip-npm', '--skip-bower']); 20 | }); 21 | }); 22 | 23 | afterEach(function () { 24 | return tmp.teardown('./tmp'); 25 | }); 26 | 27 | it('ung generate class my-class', function () { 28 | return ng(['generate', 'class', 'my-class']).then(() => { 29 | expect(existsSync(path.join(testPath, 'my-class.ts'))).to.equal(true); 30 | expect(existsSync(path.join(testPath, 'my-class.spec.ts'))).to.equal(false); 31 | }); 32 | }); 33 | 34 | it('ung generate class my-class --no-spec', function () { 35 | return ng(['generate', 'class', 'my-class', '--no-spec']).then(() => { 36 | expect(existsSync(path.join(testPath, 'my-class.ts'))).to.equal(true); 37 | expect(existsSync(path.join(testPath, 'my-class.spec.ts'))).to.equal(false); 38 | }); 39 | }); 40 | 41 | it('ung generate class my-class.model', function () { 42 | return ng(['generate', 'class', 'my-class.model']).then(() => { 43 | expect(existsSync(path.join(testPath, 'my-class.model.ts'))).to.equal(true); 44 | }); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /packages/universal-cli/addon/index.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | const config = require('../models/config'); 5 | const path = require('path'); 6 | 7 | module.exports = { 8 | name: 'ung', 9 | 10 | config: function () { 11 | this.project.ngConfigObj = this.project.ngConfigObj || config.CliConfig.fromProject(); 12 | this.project.ngConfig = this.project.ngConfig || this.project.ngConfigObj.config; 13 | }, 14 | 15 | blueprintsPath: function () { 16 | return path.join(__dirname, '../blueprints'); 17 | }, 18 | 19 | includedCommands: function () { 20 | return { 21 | 'build': require('../commands/build').default, 22 | 'serve': require('../commands/serve').default, 23 | 'new': require('../commands/new').default, 24 | 'generate': require('../commands/generate').default, 25 | 'destroy': require('../commands/destroy').default, 26 | 'init': require('../commands/init').default, 27 | 'test': require('../commands/test').default, 28 | 'e2e': require('../commands/e2e').default, 29 | 'help': require('../commands/help').default, 30 | 'lint': require('../commands/lint').default, 31 | 'version': require('../commands/version').default, 32 | 'completion': require('../commands/completion').default, 33 | 'doc': require('../commands/doc').default, 34 | 'github-pages-deploy': require('../commands/github-pages-deploy').default, 35 | 36 | // Easter eggs. 37 | 'make-this-awesome': require('../commands/easter-egg').default, 38 | 39 | // Configuration. 40 | 'set': require('../commands/set').default, 41 | 'get': require('../commands/get').default 42 | }; 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/aot-i18n.ts: -------------------------------------------------------------------------------- 1 | import {ng} from '../../utils/process'; 2 | import {expectFileToMatch, writeFile, createDir, appendToFile} from '../../utils/fs'; 3 | import {expectToFail, getAppMain, getClientDist} from '../../utils/utils'; 4 | 5 | export default function() { 6 | return Promise.resolve() 7 | .then(() => createDir('src/locale')) 8 | .then(() => writeFile('src/locale/messages.fr.xlf', ` 9 | 10 | 11 | 12 | 13 | 14 | Hello i18n! 15 | Bonjour i18n! 16 | An introduction header for this sample 17 | 18 | 19 | 20 | `)) 21 | .then(() => appendToFile('src/app/app.component.html', 22 | '

Hello i18n!

')) 23 | .then(() => ng('build', '--aot', '--i18n-file', 'src/locale/messages.fr.xlf', '--i18n-format', 24 | 'xlf', '--locale', 'fr')) 25 | .then(() => expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, /Bonjour i18n!/)) 26 | .then(() => ng('build', '--aot')) 27 | .then(() => expectToFail(() => { 28 | return expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, /Bonjour i18n!/); 29 | })) 30 | .then(() => expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, /Hello i18n!/)); 31 | } 32 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/set.ts: -------------------------------------------------------------------------------- 1 | const SilentError = require('silent-error'); 2 | const Command = require('../ember-cli/lib/models/command'); 3 | import {CliConfig} from '../models/config'; 4 | 5 | 6 | const SetCommand = Command.extend({ 7 | name: 'set', 8 | description: 'Set a value in the configuration.', 9 | works: 'everywhere', 10 | 11 | availableOptions: [ 12 | { name: 'global', type: Boolean, default: false, aliases: ['g'] }, 13 | ], 14 | 15 | asBoolean: function (raw: string): boolean { 16 | if (raw == 'true' || raw == '1') { 17 | return true; 18 | } else if (raw == 'false' || raw == '' || raw == '0') { 19 | return false; 20 | } else { 21 | throw new SilentError(`Invalid boolean value: "${raw}"`); 22 | } 23 | }, 24 | asNumber: function (raw: string): number { 25 | if (Number.isNaN(+raw)) { 26 | throw new SilentError(`Invalid number value: "${raw}"`); 27 | } 28 | return +raw; 29 | }, 30 | 31 | run: function (commandOptions: any, rawArgs: string[]): Promise { 32 | return new Promise(resolve => { 33 | const [jsonPath, rawValue] = rawArgs; 34 | const config = CliConfig.fromProject(); 35 | const type = config.typeOf(jsonPath); 36 | let value: any = rawValue; 37 | 38 | switch (type) { 39 | case 'boolean': value = this.asBoolean(rawValue); break; 40 | case 'number': value = this.asNumber(rawValue); break; 41 | case 'string': value = rawValue; break; 42 | 43 | default: value = JSON.parse(rawValue); 44 | } 45 | 46 | config.set(jsonPath, value); 47 | config.save(); 48 | resolve(); 49 | }); 50 | } 51 | }); 52 | 53 | export default SetCommand; 54 | -------------------------------------------------------------------------------- /packages/universal-cli/blueprints/ng2/files/__path__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= jsComponentName %> 6 | 7 | 8 | 9 | <% if (isMobile) { %> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | <% } %> 25 | <% if (universal) { %><% } %> 26 | 27 | 28 | <<%= prefix %>-root>Loading...-root> 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/styles/scss.ts: -------------------------------------------------------------------------------- 1 | import { 2 | writeMultipleFiles, 3 | deleteFile, 4 | expectFileToMatch, 5 | replaceInFile 6 | } from '../../../utils/fs'; 7 | import { ng } from '../../../utils/process'; 8 | import { stripIndents } from 'common-tags'; 9 | import { isMobileTest, getAppMain, getClientDist } from '../../../utils/utils'; 10 | import { updateJsonFile } from '../../../utils/project'; 11 | 12 | export default function () { 13 | if (isMobileTest()) { 14 | return; 15 | } 16 | 17 | return writeMultipleFiles({ 18 | 'src/styles.scss': stripIndents` 19 | @import './imported-styles.scss'; 20 | body { background-color: blue; } 21 | `, 22 | 'src/imported-styles.scss': stripIndents` 23 | p { background-color: red; } 24 | `, 25 | 'src/app/app.component.scss': stripIndents` 26 | .outer { 27 | .inner { 28 | background: #fff; 29 | } 30 | } 31 | `}) 32 | .then(() => deleteFile('src/app/app.component.css')) 33 | .then(() => updateJsonFile('angular-cli.json', configJson => { 34 | const app = configJson['apps'][0]; 35 | app['styles'] = ['styles.scss']; 36 | })) 37 | .then(() => replaceInFile('src/app/app.component.ts', 38 | './app.component.css', './app.component.scss')) 39 | .then(() => ng('build')) 40 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 41 | /body\s*{\s*background-color: blue;\s*}/)) 42 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 43 | /p\s*{\s*background-color: red;\s*}/)) 44 | .then(() => expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, 45 | /.outer.*.inner.*background:\s*#[fF]+/)); 46 | } 47 | -------------------------------------------------------------------------------- /tests/e2e/tests/build/styles/less.ts: -------------------------------------------------------------------------------- 1 | import { 2 | writeMultipleFiles, 3 | deleteFile, 4 | expectFileToMatch, 5 | replaceInFile 6 | } from '../../../utils/fs'; 7 | import { ng } from '../../../utils/process'; 8 | import { stripIndents } from 'common-tags'; 9 | import { isMobileTest, getAppMain, getClientDist } from '../../../utils/utils'; 10 | import { updateJsonFile } from '../../../utils/project'; 11 | 12 | export default function () { 13 | if (isMobileTest()) { 14 | return; 15 | } 16 | 17 | return writeMultipleFiles({ 18 | 'src/styles.less': stripIndents` 19 | @import './imported-styles.less'; 20 | body { background-color: blue; } 21 | `, 22 | 'src/imported-styles.less': stripIndents` 23 | p { background-color: red; } 24 | `, 25 | 'src/app/app.component.less': stripIndents` 26 | .outer { 27 | .inner { 28 | background: #fff; 29 | } 30 | } 31 | ` 32 | }) 33 | .then(() => deleteFile('src/app/app.component.css')) 34 | .then(() => updateJsonFile('angular-cli.json', configJson => { 35 | const app = configJson['apps'][0]; 36 | app['styles'] = ['styles.less']; 37 | })) 38 | .then(() => replaceInFile('src/app/app.component.ts', 39 | './app.component.css', './app.component.less')) 40 | .then(() => ng('build')) 41 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 42 | /body\s*{\s*background-color: blue;\s*}/)) 43 | .then(() => expectFileToMatch(`${getClientDist()}styles.bundle.css`, 44 | /p\s*{\s*background-color: red;\s*}/)) 45 | .then(() => expectFileToMatch(`${getClientDist()}${getAppMain()}.bundle.js`, 46 | /.outer.*.inner.*background:\s*#[fF]+/)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/acceptance/find-lazy-module.spec.ts: -------------------------------------------------------------------------------- 1 | import * as mockFs from 'mock-fs'; 2 | import {stripIndents} from 'common-tags'; 3 | import {expect} from 'chai'; 4 | import {join} from 'path'; 5 | 6 | import {findLazyModules} from 'universal-cli/models/find-lazy-modules'; 7 | 8 | 9 | describe('find-lazy-module', () => { 10 | beforeEach(() => { 11 | mockFs({ 12 | 'project-root': { 13 | 'fileA.ts': stripIndents` 14 | const r1 = { 15 | "loadChildren": "moduleA" 16 | }; 17 | const r2 = { 18 | loadChildren: "moduleB" 19 | }; 20 | const r3 = { 21 | 'loadChildren': 'moduleC' 22 | }; 23 | const r4 = { 24 | "loadChildren": 'app/+workspace/+settings/settings.module#SettingsModule' 25 | }; 26 | const r5 = { 27 | loadChildren: 'unexistentModule' 28 | }; 29 | `, 30 | // Create those files too as they have to exist. 31 | 'moduleA.ts': '', 32 | 'moduleB.ts': '', 33 | 'moduleC.ts': '', 34 | 'moduleD.ts': '', 35 | 'app': { '+workspace': { '+settings': { 'settings.module.ts': '' } } } 36 | } 37 | }); 38 | }); 39 | afterEach(() => mockFs.restore()); 40 | 41 | it('works', () => { 42 | expect(findLazyModules('project-root')).to.eql({ 43 | 'moduleA': join(process.cwd(), 'project-root', 'moduleA.ts'), 44 | 'moduleB': join(process.cwd(), 'project-root', 'moduleB.ts'), 45 | 'moduleC': join(process.cwd(), 'project-root', 'moduleC.ts'), 46 | 'app/+workspace/+settings/settings.module': 47 | join(process.cwd(), 'project-root', 'app/+workspace/+settings/settings.module.ts'), 48 | }); 49 | }); 50 | }); 51 | -------------------------------------------------------------------------------- /packages/universal-cli/commands/version.ts: -------------------------------------------------------------------------------- 1 | const Command = require('../ember-cli/lib/models/command'); 2 | import * as path from 'path'; 3 | import * as child_process from 'child_process'; 4 | 5 | const VersionCommand = Command.extend({ 6 | name: 'version', 7 | description: 'outputs universal-cli version', 8 | aliases: ['v', '--version', '-v'], 9 | works: 'everywhere', 10 | 11 | availableOptions: [{ 12 | name: 'verbose', 13 | type: Boolean, 'default': false 14 | }], 15 | 16 | run: function (options: any) { 17 | const versions: any = process.versions; 18 | const pkg = require(path.resolve(__dirname, '..', 'package.json')); 19 | 20 | versions['os'] = process.platform + ' ' + process.arch; 21 | 22 | const alwaysPrint = ['node', 'os']; 23 | 24 | let ngCliVersion = pkg.version; 25 | if (!__dirname.match(/node_modules/)) { 26 | let gitBranch = '??'; 27 | try { 28 | const gitRefName = '' + child_process.execSync('git symbolic-ref HEAD', {cwd: __dirname}); 29 | gitBranch = path.basename(gitRefName.replace('\n', '')); 30 | } catch (e) { 31 | } 32 | 33 | ngCliVersion = `local (v${pkg.version}, branch: ${gitBranch})`; 34 | } 35 | 36 | this.printVersion('universal-cli', ngCliVersion); 37 | this.printVersion('angular-cli', pkg.cliVersion); 38 | 39 | for (const module of Object.keys(versions)) { 40 | if (options.verbose || alwaysPrint.indexOf(module) > -1) { 41 | this.printVersion(module, versions[module]); 42 | } 43 | } 44 | }, 45 | 46 | printVersion: function (module: string, version: string) { 47 | this.ui.writeLine(module + ': ' + version); 48 | } 49 | }); 50 | 51 | 52 | VersionCommand.overrideCore = true; 53 | export default VersionCommand; 54 | -------------------------------------------------------------------------------- /tests/e2e/tests/packages/webpack/weird.ts: -------------------------------------------------------------------------------- 1 | import {createProjectFromAsset} from '../../../utils/assets'; 2 | import {exec} from '../../../utils/process'; 3 | import {updateJsonFile} from '../../../utils/project'; 4 | import {expectFileSizeToBeUnder, expectFileToExist} from '../../../utils/fs'; 5 | import {expectToFail} from '../../../utils/utils'; 6 | 7 | 8 | export default function(skipCleaning: () => void) { 9 | if (process.platform.startsWith('win')) { 10 | // Disable the test on Windows. 11 | return Promise.resolve(); 12 | } 13 | 14 | return Promise.resolve() 15 | .then(() => createProjectFromAsset('webpack/test-app-weird')) 16 | .then(() => exec('node_modules/.bin/webpack', '-p')) 17 | .then(() => expectFileToExist('dist/app.main.js')) 18 | .then(() => expectFileToExist('dist/0.app.main.js')) 19 | .then(() => expectFileToExist('dist/1.app.main.js')) 20 | .then(() => expectFileToExist('dist/2.app.main.js')) 21 | .then(() => expectFileSizeToBeUnder('dist/app.main.js', 400000)) 22 | .then(() => expectFileSizeToBeUnder('dist/0.app.main.js', 40000)) 23 | 24 | // Skip code generation and rebuild. 25 | .then(() => updateJsonFile('aotplugin.config.json', json => { 26 | json['skipCodeGeneration'] = true; 27 | })) 28 | .then(() => exec('node_modules/.bin/webpack', '-p')) 29 | .then(() => expectFileToExist('dist/app.main.js')) 30 | .then(() => expectFileToExist('dist/0.app.main.js')) 31 | .then(() => expectFileToExist('dist/1.app.main.js')) 32 | .then(() => expectFileToExist('dist/2.app.main.js')) 33 | .then(() => expectToFail(() => expectFileSizeToBeUnder('dist/app.main.js', 400000))) 34 | .then(() => expectFileSizeToBeUnder('dist/0.app.main.js', 40000)) 35 | .then(() => skipCleaning()); 36 | } 37 | -------------------------------------------------------------------------------- /tests/e2e/assets/ssl/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEA0+kOHdfpsPNUguCtai27DJ+DuOfVw4gw1P3BgYhNG8qoukaW 3 | gdDLowj59+cXXgn9ZnQ8PdvZXhCEQcP3wjd1cBPuGQzO7BekoKEgzfGE/zjrrIeL 4 | Q7tHYx9ddCPotQX4OJu4FZFJyS1Ar7zDDpQ9fSw6qmsXWN6I18fIGSVvbDbVB9rw 5 | iAsLGe2jWadjXAjSqVOy6aT+CKJgnRnxudNZGP1LRC1YDRl/s7icCIh/9gEGfn7G 6 | gwQQ9AM2p3JNjP2quclSjBvMv0uVj+yzL2bPGRz0hu90CDaIEU2FtBCse50/O75q 7 | x0bQnPbuHKD3ajs0DfQYoAmFZGK078ZDl/VQxwIDAQABAoIBAEl17kXcNo/4GqDw 8 | QE2hoslCdwhfnhQVn1AG09ESriBnRcylccF4308aaoVM4CXicqzUuJl9IEJimWav 9 | B7GVRinfTtfyP71KiPCCSvv5sPBFDDYYGugVAS9UjTIYzLAMbLs7CDq5zglmnZkO 10 | Z9QjAZnl/kRbsZFGO8wJ3s0Q1Cp/ygZcvFU331K2jHXW7B4YXiFOH/lBQrjdz0Gy 11 | WBjX4zIdNWnwarvxu46IS/0z1P1YOHM8+B1Uv54MG94A6szBdd/Vp0cQRs78t/Cu 12 | BQ1Rnuk16Pi+ieC5K04yUgeuNusYW0PWLtPX1nKNp9z46bmD1NHKAxaoDFXr7qP3 13 | pZCaDMkCgYEA8mmTYrhXJTRIrOxoUwM1e3OZ0uOxVXJJ8HF6X8t+UO6dFxXB/JC9 14 | ZBc+94cZQapaKFOeMmd/j3L2CQIjChk5yKV/G3Io+raxIoAAKPCkMF4NQQVvvNkS 15 | CAGl61Qa78DoF5Habumz0AC1R9P877kNTC0aPSt4lhPWgfotbZNNMlMCgYEA38nM 16 | s4a0pZseXPkuOtPYX/3Ms3E+d70XKSFuIMCHCg79YGsQ8h/9apYcPyeYkpQ0a4gs 17 | I3IUqMaXC2OyqWA5LU1BZv51mXb6zcb2pokZfpiSWk+7sy5XjkE9EmQxp3xHfV3c 18 | EO/DxHfWNvtMjESMbhu0yVzM2O/Aa53Tl9lqAT0CgYEA1dXBuHyqCtyTG08zO78B 19 | 55Ny5rAJ1zkI9jvz2hr0o0nJcvqzcyruliNXXRxkcCNoglg4nXfk81JSrGGhLSBR 20 | c6hhdoF+mqKboLZO7c5Q14WvpWK5TVoiaMOja/J2DHYbhecYS2yGPH7TargaUBDq 21 | JP9IPRtitOhs+Z0Jg7ZDi5cCgYAMb7B6gY/kbBxh2k8hYchyfS41AqQQD2gMFxmB 22 | pHFcs7yM8SY97l0s4S6sq8ykyKupFiYtyhcv0elu7pltJDXJOLPbv2RVpPEHInlu 23 | g8vw5xWrAydRK9Adza5RKVRBFHz8kIy8PDbK4kX7RDfay6xqKgv/7LJNk/VDhb/O 24 | fnyPmQKBgQDg/o8Ubf/gxA9Husnuld4DBu3wwFhkMlWqyO9QH3cKgojQ2JGSrfDz 25 | xHhetmhionEyzg0JCaMSpzgIHY+8o/NAwc++OjNHEoYp3XWM9GTp81ROMz6b83jV 26 | biVR9N0MhONdwF6vtzDCcJxNIUe2p4lTvLf/Xd9jaQDNXe35Gxsdyg== 27 | -----END RSA PRIVATE KEY----- 28 | --------------------------------------------------------------------------------