Permalink
Browse files

refactor(all): Repackaging (#2056)

Moving Angular-CLI into `packages/` and building the angular-cli.

The published packages will now have JavaScript only (with their d.ts), instead of being a mix of TypeScript and JavaScript, and it won't have the hacks of having a custom require extension to load the TypeScript.

Our development flow will be more streamlined, tools are going to be better (no more undefined symbols that are actually defined), and the npm packages will boot up way faster (since there's no more compilation during runtime).

Locally nothing changes, use `npm link` and run your local `ng`. Using the `npm` releases though it should be all javascript from the release.

The E2E tests also now uses the `dist` folder output to install in the new E2E app, making sure the process works for an app published to npm.

Note: Even though we're following the lerna structure, we won't be using their tool anytime soon.
  • Loading branch information...
1 parent 126c82b commit 1572270b1c6df0fa2c55981ecdadbc10564abc30 @hansl hansl committed on GitHub Sep 12, 2016
Showing with 503 additions and 242 deletions.
  1. +1 −1 .eslintignore
  2. +1 −1 .travis.yml
  3. +0 −37 addon/ng2/index.js
  4. +0 −9 addon/ng2/package.json
  5. +1 −44 bin/ng
  6. +0 −6 index.js
  7. +8 −0 lib/bootstrap-local.js
  8. +4 −1 lib/packages.js
  9. +10 −8 package.json
  10. +42 −0 packages/angular-cli/addon/index.js
  11. +49 −0 packages/angular-cli/bin/ng
  12. 0 {addon/ng2 → packages/angular-cli}/blueprints/class/files/__path__/__name__.spec.ts
  13. 0 {addon/ng2 → packages/angular-cli}/blueprints/class/files/__path__/__name__.ts
  14. 0 {addon/ng2 → packages/angular-cli}/blueprints/class/index.js
  15. 0 {addon/ng2 → packages/angular-cli}/blueprints/component-test/index.js
  16. 0 ...n/ng2 → packages/angular-cli}/blueprints/component/files/__path__/__name__.component.__styleext__
  17. 0 {addon/ng2 → packages/angular-cli}/blueprints/component/files/__path__/__name__.component.html
  18. 0 {addon/ng2 → packages/angular-cli}/blueprints/component/files/__path__/__name__.component.spec.ts
  19. 0 {addon/ng2 → packages/angular-cli}/blueprints/component/files/__path__/__name__.component.ts
  20. 0 {addon/ng2 → packages/angular-cli}/blueprints/component/index.js
  21. 0 {addon/ng2 → packages/angular-cli}/blueprints/directive/files/__path__/__name__.directive.spec.ts
  22. 0 {addon/ng2 → packages/angular-cli}/blueprints/directive/files/__path__/__name__.directive.ts
  23. 0 {addon/ng2 → packages/angular-cli}/blueprints/directive/index.js
  24. 0 {addon/ng2 → packages/angular-cli}/blueprints/enum/files/__path__/__name__.enum.ts
  25. 0 {addon/ng2 → packages/angular-cli}/blueprints/enum/index.js
  26. 0 {addon/ng2 → packages/angular-cli}/blueprints/interface/files/__path__/__name__.ts
  27. 0 {addon/ng2 → packages/angular-cli}/blueprints/interface/index.js
  28. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/android-chrome-144x144.png
  29. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/android-chrome-192x192.png
  30. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/android-chrome-36x36.png
  31. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/android-chrome-48x48.png
  32. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/android-chrome-72x72.png
  33. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/android-chrome-96x96.png
  34. BIN ...n/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-114x114.png
  35. BIN ...n/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-120x120.png
  36. BIN ...n/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-144x144.png
  37. BIN ...n/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-152x152.png
  38. BIN ...n/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-180x180.png
  39. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-57x57.png
  40. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-60x60.png
  41. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-72x72.png
  42. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-76x76.png
  43. BIN ...2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon-precomposed.png
  44. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/apple-touch-icon.png
  45. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/favicon-16x16.png
  46. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/favicon-32x32.png
  47. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/favicon-96x96.png
  48. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/icon.png
  49. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/mstile-144x144.png
  50. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/mstile-150x150.png
  51. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/mstile-310x150.png
  52. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/mstile-310x310.png
  53. BIN {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/mstile-70x70.png
  54. 0 {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/icons/safari-pinned-tab.svg
  55. 0 {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/main-app-shell.ts
  56. 0 {addon/ng2 → packages/angular-cli}/blueprints/mobile/files/__path__/manifest.webapp
  57. 0 {addon/ng2 → packages/angular-cli}/blueprints/mobile/index.js
  58. 0 {addon/ng2 → packages/angular-cli}/blueprints/module/files/__path__/__name__.module.spec.ts
  59. 0 {addon/ng2 → packages/angular-cli}/blueprints/module/files/__path__/__name__.module.ts
  60. 0 {addon/ng2 → packages/angular-cli}/blueprints/module/files/__path__/__name__.routing.ts
  61. 0 {addon/ng2 → packages/angular-cli}/blueprints/module/index.js
  62. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/.editorconfig
  63. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/README.md
  64. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/app/app.component.__styleext__
  65. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/app/app.component.html
  66. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/app/app.component.spec.ts
  67. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/app/app.component.ts
  68. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/app/app.module.ts
  69. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/app/index.ts
  70. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/app/shared/index.ts
  71. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/assets/.gitignore
  72. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/assets/.gitkeep
  73. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/environments/environment.dev.ts
  74. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/environments/environment.prod.ts
  75. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/environments/environment.ts
  76. BIN {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/favicon.ico
  77. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/index.html
  78. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/main.ts
  79. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/polyfills.ts
  80. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/styles.__styleext__
  81. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/test.ts
  82. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/tsconfig.json
  83. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/__path__/typings.d.ts
  84. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/angular-cli.json
  85. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/e2e/app.e2e-spec.ts
  86. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/e2e/app.po.ts
  87. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/e2e/tsconfig.json
  88. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/gitignore
  89. +1 −1 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/karma.conf.js
  90. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/package.json
  91. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/protractor.conf.js
  92. 0 {addon/ng2 → packages/angular-cli}/blueprints/ng2/files/tslint.json
  93. +1 −1 {addon/ng2 → packages/angular-cli}/blueprints/ng2/index.js
  94. 0 {addon/ng2 → packages/angular-cli}/blueprints/pipe/files/__path__/__name__.pipe.spec.ts
  95. 0 {addon/ng2 → packages/angular-cli}/blueprints/pipe/files/__path__/__name__.pipe.ts
  96. 0 {addon/ng2 → packages/angular-cli}/blueprints/pipe/index.js
  97. 0 {addon/ng2 → packages/angular-cli}/blueprints/route-test/index.js
  98. 0 {addon/ng2 → packages/angular-cli}/blueprints/route/index.js
  99. 0 {addon/ng2 → packages/angular-cli}/blueprints/service-test/index.js
  100. 0 {addon/ng2 → packages/angular-cli}/blueprints/service/files/__path__/__name__.service.spec.ts
  101. 0 {addon/ng2 → packages/angular-cli}/blueprints/service/files/__path__/__name__.service.ts
  102. 0 {addon/ng2 → packages/angular-cli}/blueprints/service/index.js
  103. 0 {addon/ng2 → packages/angular-cli}/commands/build.ts
  104. 0 {addon/ng2 → packages/angular-cli}/commands/completion.js
  105. 0 {addon/ng2 → packages/angular-cli}/commands/doc.ts
  106. 0 {addon/ng2 → packages/angular-cli}/commands/e2e.ts
  107. 0 {addon/ng2 → packages/angular-cli}/commands/easter-egg.ts
  108. 0 {addon/ng2 → packages/angular-cli}/commands/generate.ts
  109. 0 {addon/ng2 → packages/angular-cli}/commands/get.ts
  110. 0 {addon/ng2 → packages/angular-cli}/commands/github-pages-deploy.ts
  111. 0 {addon/ng2 → packages/angular-cli}/commands/help.ts
  112. +1 −5 {addon/ng2 → packages/angular-cli}/commands/init.ts
  113. 0 {addon/ng2 → packages/angular-cli}/commands/lint.ts
  114. 0 {addon/ng2 → packages/angular-cli}/commands/new.ts
  115. +1 −1 {addon/ng2 → packages/angular-cli}/commands/serve.ts
  116. 0 {addon/ng2 → packages/angular-cli}/commands/set.ts
  117. 0 {addon/ng2 → packages/angular-cli}/commands/test.ts
  118. +1 −1 {addon/ng2 → packages/angular-cli}/commands/version.ts
  119. 0 {addon/ng2 → packages/angular-cli}/custom-typings.d.ts
  120. +1 −0 { → packages/angular-cli}/lib/cli/index.js
  121. 0 { → packages/angular-cli}/lib/config/schema.d.ts
  122. 0 { → packages/angular-cli}/lib/config/schema.json
  123. +1 −1 {addon/ng2 → packages/angular-cli}/models/config.ts
  124. +1 −1 {addon/ng2 → packages/angular-cli}/models/config/config.ts
  125. 0 {addon/ng2 → packages/angular-cli}/models/error.ts
  126. +1 −1 {addon/ng2 → packages/angular-cli}/models/find-lazy-modules.ts
  127. 0 {addon/ng2 → packages/angular-cli}/models/index.ts
  128. 0 {addon/ng2 → packages/angular-cli}/models/json-schema/schema-class-factory.ts
  129. 0 {addon/ng2 → packages/angular-cli}/models/json-schema/schema-tree.ts
  130. 0 {addon/ng2 → packages/angular-cli}/models/json-schema/serializer.ts
  131. 0 {addon/ng2 → packages/angular-cli}/models/webpack-build-common.ts
  132. 0 {addon/ng2 → packages/angular-cli}/models/webpack-build-development.ts
  133. +1 −1 {addon/ng2 → packages/angular-cli}/models/webpack-build-mobile.ts
  134. 0 {addon/ng2 → packages/angular-cli}/models/webpack-build-production.ts
  135. 0 {addon/ng2 → packages/angular-cli}/models/webpack-build-test.js
  136. 0 {addon/ng2 → packages/angular-cli}/models/webpack-build-utils.ts
  137. 0 {addon/ng2 → packages/angular-cli}/models/webpack-config.ts
  138. +101 −0 packages/angular-cli/package.json
  139. +43 −0 packages/angular-cli/plugins/karma.js
  140. 0 {addon/ng2 → packages/angular-cli}/tasks/build-webpack-watch.ts
  141. 0 {addon/ng2 → packages/angular-cli}/tasks/build-webpack.ts
  142. 0 {addon/ng2 → packages/angular-cli}/tasks/create-github-repo.ts
  143. 0 {addon/ng2 → packages/angular-cli}/tasks/doc.ts
  144. 0 {addon/ng2 → packages/angular-cli}/tasks/e2e.ts
  145. 0 {addon/ng2 → packages/angular-cli}/tasks/git-init.js
  146. 0 {addon/ng2 → packages/angular-cli}/tasks/link-cli.ts
  147. 0 {addon/ng2 → packages/angular-cli}/tasks/lint.ts
  148. 0 {addon/ng2 → packages/angular-cli}/tasks/npm-install.js
  149. 0 {addon/ng2 → packages/angular-cli}/tasks/npm-task.js
  150. 0 {addon/ng2 → packages/angular-cli}/tasks/serve-webpack.ts
  151. 0 {addon/ng2 → packages/angular-cli}/tasks/test.ts
  152. +1 −4 {addon/ng2 → packages/angular-cli}/tsconfig.json
  153. 0 {addon/ng2 → packages/angular-cli}/utilities/INITIAL_COMMIT_MESSAGE.txt
  154. 0 {addon/ng2 → packages/angular-cli}/utilities/ast-utils.ts
  155. 0 {addon/ng2 → packages/angular-cli}/utilities/change.ts
  156. 0 {addon/ng2 → packages/angular-cli}/utilities/completion.sh
  157. 0 {addon/ng2 → packages/angular-cli}/utilities/dynamic-path-parser.js
  158. 0 {addon/ng2 → packages/angular-cli}/utilities/find-parent-module.ts
  159. 0 {addon/ng2 → packages/angular-cli}/utilities/get-dependent-files.ts
  160. 0 {addon/ng2 → packages/angular-cli}/utilities/module-resolver.ts
  161. 0 {addon/ng2 → packages/angular-cli}/utilities/npm.js
  162. 0 {addon/ng2 → packages/angular-cli}/utilities/prerender-webpack-plugin.ts
  163. 0 {addon/ng2 → packages/angular-cli}/utilities/route-utils.ts
  164. 0 {addon/ng2 → packages/angular-cli}/utilities/sw-install.js
  165. +1 −1 packages/ast-tools/src/route-utils.ts
  166. +4 −1 packages/ast-tools/tsconfig.json
  167. +4 −1 packages/base-href-webpack/tsconfig.json
  168. +4 −43 plugins/karma.js
  169. +111 −0 scripts/publish/build.js
  170. +7 −1 scripts/run-packages-spec.js
  171. +1 −1 tests/acceptance/dynamic-path-parser.spec.js
  172. +1 −1 tests/acceptance/find-lazy-module.spec.ts
  173. +1 −1 tests/acceptance/get-dependent-files.spec.ts
  174. +4 −4 tests/acceptance/init.spec.js
  175. +2 −2 tests/acceptance/module-resolver.spec.ts
  176. +1 −1 tests/acceptance/new.spec.js
  177. +7 −0 tests/e2e/setup/000-pwd.ts
  178. +6 −0 tests/e2e/setup/010-build.ts
  179. +0 −50 tests/e2e/setup/020-create-project.ts
  180. +0 −5 tests/e2e/setup/{000-npm-link.ts → 100-npm-link.ts}
  181. 0 tests/e2e/setup/{010-create-tmp-dir.ts → 200-create-tmp-dir.ts}
  182. +62 −0 tests/e2e/setup/500-create-project.ts
  183. +8 −0 tests/e2e/utils/process.ts
  184. +3 −2 tests/e2e/utils/project.ts
  185. +1 −1 tests/helpers/ng.js
  186. +1 −1 tests/models/config.spec.ts
  187. +3 −2 tsconfig.json
View
@@ -5,4 +5,4 @@ tmp/
typings/
# Ignore all blueprint files. We e2e tests those later on.
-addon/ng2/blueprints/*/files/
+packages/angular-cli/blueprints/*/files/
View
@@ -12,7 +12,7 @@ env:
- DBUS_SESSION_BUS_ADDRESS=/dev/null
matrix:
- SCRIPT=lint
-# - SCRIPT=build
+ - SCRIPT=build
- SCRIPT=e2e
- SCRIPT=e2e:nightly
- SCRIPT=test
View
@@ -1,37 +0,0 @@
-/* jshint node: true */
-'use strict';
-
-const config = require('./models/config');
-
-module.exports = {
- name: 'ng2',
-
- config: function () {
- this.project.ngConfig = this.project.ngConfig || config.CliConfig.fromProject().config;
- },
-
- includedCommands: function () {
- return {
- 'build': require('./commands/build').default,
- 'serve': require('./commands/serve').default,
- 'new': require('./commands/new').default,
- 'generate': require('./commands/generate').default,
- 'help': require('./commands/help').default,
- 'init': require('./commands/init').default,
- 'test': require('./commands/test').default,
- 'e2e': require('./commands/e2e').default,
- 'lint': require('./commands/lint').default,
- 'version': require('./commands/version').default,
- 'completion': require('./commands/completion').default,
- 'doc': require('./commands/doc').default,
- 'github-pages-deploy': require('./commands/github-pages-deploy').default,
-
- // Easter eggs.
- 'make-this-awesome': require('./commands/easter-egg').default,
-
- // Configuration.
- 'set': require('./commands/set').default,
- 'get': require('./commands/get').default
- };
- }
-};
@@ -1,9 +0,0 @@
-{
- "name": "ng2",
- "version": "0.0.0",
- "description": "An addon to generate an ng2 project",
- "license": "MIT",
- "keywords": [
- "ember-addon"
- ]
-}
View
@@ -4,48 +4,5 @@
// Provide a title to the process in `ps`
process.title = 'angular-cli';
-const resolve = require('resolve');
-const exit = require('exit');
-const packageJson = require('../package.json');
-const Leek = require('leek');
-
require('../lib/bootstrap-local');
-
-
-resolve('angular-cli', { basedir: process.cwd() },
- function (error, projectLocalCli) {
- var cli;
- if (error) {
- // If there is an error, resolve could not find the ng-cli
- // library from a package.json. Instead, include it from a relative
- // path to this script file (which is likely a globally installed
- // npm package). Most common cause for hitting this is `ng new`
- cli = require('../lib/cli');
- } else {
- // No error implies a projectLocalCli, which will load whatever
- // version of ng-cli you have installed in a local package.json
- cli = require(projectLocalCli);
- }
-
- if ('default' in cli) {
- cli = cli['default'];
- }
-
- cli({
- cliArgs: process.argv.slice(2),
- inputStream: process.stdin,
- outputStream: process.stdout,
- Leek: CustomLeek
- }).then(function (result) {
- var exitCode = typeof result === 'object' ? result.exitCode : result;
- exit(exitCode);
- });
-
- function CustomLeek(options) {
- options.trackingCode = packageJson.trackingCode;
- options.globalName = packageJson.name;
- options.name = packageJson.name;
- options.version = packageJson.version;
- return new Leek(options);
- }
- });
+require('../packages/angular-cli/bin/ng');
View
@@ -1,6 +0,0 @@
-/* jshint node: true */
-'use strict';
-
-module.exports = {
- name: 'ng'
-};
@@ -6,6 +6,8 @@ const path = require('path');
const ts = require('typescript');
+global.angularCliIsLocal = true;
+
const compilerOptions = JSON.parse(fs.readFileSync(path.join(__dirname, '../tsconfig.json')));
const oldRequireTs = require.extensions['.ts'];
@@ -51,6 +53,12 @@ if (!__dirname.match(new RegExp(`\\${path.sep}node_modules\\${path.sep}`))) {
Module._load = function (request, parent) {
if (request in packages) {
return oldLoad.call(this, packages[request].main, parent);
+ } else if (request.startsWith('angular-cli/')) {
+ // We allow deep imports (for now).
+ // TODO: move tests to inside angular-cli package so they don't have to deep import.
+ const dir = path.dirname(parent.filename);
+ const newRequest = path.relative(dir, path.join(__dirname, '../packages', request));
+ return oldLoad.call(this, newRequest, parent);
} else {
return oldLoad.apply(this, arguments);
}
View
@@ -1,3 +1,5 @@
+'use strict';
+
const fs = require('fs');
const path = require('path');
@@ -9,7 +11,8 @@ const packages = fs.readdirSync(packageRoot)
.map(pkgName => ({ name: pkgName, root: path.join(packageRoot, pkgName) }))
.filter(pkg => fs.statSync(pkg.root).isDirectory())
.reduce((packages, pkg) => {
- packages[`@angular-cli/${pkg.name}`] = {
+ let name = pkg == 'angular-cli' ? 'angular-cli' : `@angular-cli/${pkg.name}`;
+ packages[name] = {
root: pkg.root,
main: path.resolve(pkg.root, 'src/index.ts')
};
View
@@ -1,17 +1,17 @@
{
"name": "angular-cli",
- "version": "1.0.0-beta.11-webpack.8",
+ "version": "0.0.0",
"description": "CLI tool for Angular",
- "main": "lib/cli/index.js",
+ "main": "packages/angular-cli/lib/cli/index.js",
"trackingCode": "UA-8594346-19",
"bin": {
"ng": "./bin/ng"
},
"keywords": [],
"scripts": {
- "build": "npm-run-all -c build:main build:packages",
- "build:main": "tsc -p addon/ng2",
- "build:packages": "for PKG in packages/*; do echo Building $PKG...; tsc -P $PKG; done",
+ "build": "node ./scripts/publish/build.js",
+ "build:patch": "node ./scripts/patch.js",
+ "build:packages": "for PKG in packages/*; do echo Building $PKG...; tsc -p $PKG; done",
"test": "npm run test:packages && npm run test:cli",
"e2e": "npm run test:e2e",
"e2e:nightly": "node tests/e2e_runner.js --nightly",
@@ -47,7 +47,7 @@
"@angular/compiler": "^2.0.0-rc.6",
"@angular/compiler-cli": "^0.6.0",
"@angular/core": "^2.0.0-rc.6",
- "@angular/tsc-wrapped": "^0.2.2",
+ "@angular/tsc-wrapped": "^0.3.0",
"angular2-template-loader": "^0.5.0",
"awesome-typescript-loader": "^2.2.3",
"chalk": "^1.1.3",
@@ -113,13 +113,13 @@
},
"ember-addon": {
"paths": [
- "./addon/ng2/"
+ "./packages/angular-cli/lib/addon"
]
},
"devDependencies": {
"@types/chai": "^3.4.32",
"@types/chalk": "^0.4.28",
- "@types/common-tags": "^1.2.3",
+ "@types/common-tags": "^1.2.4",
"@types/denodeify": "^1.2.29",
"@types/express": "^4.0.32",
"@types/fs-extra": "^0.0.31",
@@ -143,8 +143,10 @@
"minimist": "^1.2.0",
"mocha": "^2.4.5",
"mock-fs": "3.10.0",
+ "npm-run": "^4.1.0",
"object-assign": "^4.0.1",
"request": "^2.74.0",
+ "resolve-bin": "^0.4.0",
"rewire": "^2.5.1",
"sinon": "^1.17.3",
"through": "^2.3.8",
@@ -0,0 +1,42 @@
+/* jshint node: true */
+'use strict';
+
+const config = require('../models/config');
+const path = require('path');
+
+module.exports = {
+ name: 'ng2',
+
+ config: function () {
+ this.project.ngConfig = this.project.ngConfig || config.CliConfig.fromProject().config;
+ },
+
+ blueprintsPath: function () {
+ return path.join(__dirname, '../blueprints');
+ },
+
+ includedCommands: function () {
+ return {
+ 'build': require('../commands/build').default,
+ 'serve': require('../commands/serve').default,
+ 'new': require('../commands/new').default,
+ 'generate': require('../commands/generate').default,
+ 'init': require('../commands/init').default,
+ 'test': require('../commands/test').default,
+ 'e2e': require('../commands/e2e').default,
+ 'help': require('../commands/help').default,
+ 'lint': require('../commands/lint').default,
+ 'version': require('../commands/version').default,
+ 'completion': require('../commands/completion').default,
+ 'doc': require('../commands/doc').default,
+ 'github-pages-deploy': require('../commands/github-pages-deploy').default,
+
+ // Easter eggs.
+ 'make-this-awesome': require('../commands/easter-egg').default,
+
+ // Configuration.
+ 'set': require('../commands/set').default,
+ 'get': require('../commands/get').default
+ };
+ }
+};
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+'use strict';
+
+// Provide a title to the process in `ps`
+process.title = 'angular-cli';
+
+const resolve = require('resolve');
+const exit = require('exit');
+const packageJson = require('../package.json');
+const Leek = require('leek');
+
+
+resolve('angular-cli', { basedir: process.cwd() },
+ function (error, projectLocalCli) {
+ var cli;
+ if (error) {
+ // If there is an error, resolve could not find the ng-cli
+ // library from a package.json. Instead, include it from a relative
+ // path to this script file (which is likely a globally installed
+ // npm package). Most common cause for hitting this is `ng new`
+ cli = require('../lib/cli');
+ } else {
+ // No error implies a projectLocalCli, which will load whatever
+ // version of ng-cli you have installed in a local package.json
+ cli = require(projectLocalCli);
+ }
+
+ if ('default' in cli) {
+ cli = cli['default'];
+ }
+
+ cli({
+ cliArgs: process.argv.slice(2),
+ inputStream: process.stdin,
+ outputStream: process.stdout,
+ Leek: CustomLeek
+ }).then(function (result) {
+ var exitCode = typeof result === 'object' ? result.exitCode : result;
+ exit(exitCode);
+ });
+
+ function CustomLeek(options) {
+ options.trackingCode = packageJson.trackingCode;
+ options.globalName = packageJson.name;
+ options.name = packageJson.name;
+ options.version = packageJson.version;
+ return new Leek(options);
+ }
+ });
@@ -3,7 +3,7 @@
module.exports = function (config) {
config.set({
- basePath: './',
+ basePath: '',
frameworks: ['jasmine', 'angular-cli'],
plugins: [
require('karma-jasmine'),
@@ -21,7 +21,7 @@ module.exports = {
locals: function(options) {
this.styleExt = options.style;
- this.version = require(path.resolve(__dirname, '../../../../package.json')).version;
+ this.version = require(path.resolve(__dirname, '../../package.json')).version;
// Join with / not path.sep as reference to typings require forward slashes.
const relativeRootPath = options.sourceDir.split(path.sep).map(() => '..').join('/');
@@ -32,11 +32,7 @@ const InitCommand: any = Command.extend({
anonymousOptions: ['<glob-pattern>'],
_defaultBlueprint: function () {
- if (this.project.isEmberCLIAddon()) {
- return 'addon';
- } else {
- return 'ng2';
- }
+ return 'ng2';
},
run: function (commandOptions: any, rawArgs: string[]) {
@@ -3,7 +3,7 @@ import * as denodeify from 'denodeify';
const Command = require('ember-cli/lib/models/command');
const SilentError = require('silent-error');
const PortFinder = require('portfinder');
-import ServeWebpackTask from '../tasks/serve-webpack.ts';
+import ServeWebpackTask from '../tasks/serve-webpack';
PortFinder.basePort = 49152;
@@ -15,7 +15,7 @@ const VersionCommand = Command.extend({
run: function (options: any) {
const versions: any = process.versions;
- const pkg = require(path.resolve(__dirname, '..', '..', '..', 'package.json'));
+ const pkg = require(path.resolve(__dirname, '..', 'package.json'));
versions['os'] = process.platform + ' ' + process.arch;
@@ -4,6 +4,7 @@
const cli = require('ember-cli/lib/cli');
const path = require('path');
+Error.stackTraceLimit = Infinity;
module.exports = function(options) {
const oldStdoutWrite = process.stdout.write;
@@ -1,5 +1,5 @@
import {CliConfig as CliConfigBase} from './config/config';
-import {CliConfig as ConfigInterface} from '../../../lib/config/schema';
+import {CliConfig as ConfigInterface} from '../lib/config/schema';
import { oneLine } from 'common-tags';
import * as chalk from 'chalk';
import * as fs from 'fs';
@@ -4,7 +4,7 @@ import * as path from 'path';
import {SchemaClass, SchemaClassFactory} from '../json-schema/schema-class-factory';
-const DEFAULT_CONFIG_SCHEMA_PATH = path.join(__dirname, '../../../../lib/config/schema.json');
+const DEFAULT_CONFIG_SCHEMA_PATH = path.join(__dirname, '../../lib/config/schema.json');
export class InvalidConfigError extends Error {
@@ -50,7 +50,7 @@ export function findLoadChildren(tsFilePath: string): string[] {
}
-export function findLazyModules(projectRoot: any): string[] {
+export function findLazyModules(projectRoot: any): {[key: string]: string} {
const result: {[key: string]: string} = {};
glob.sync(path.join(projectRoot, '/**/*.ts'))
.forEach(tsPath => {
Oops, something went wrong.

0 comments on commit 1572270

Please sign in to comment.