diff --git a/.travis.yml b/.travis.yml index 67b8c31edcd3..bd8749ccf75c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,9 @@ matrix: - node_js: "6" os: linux env: NODE_SCRIPT="tests/run_e2e.js --nightly" + - node_js: "6" + os: linux + env: NODE_SCRIPT="tests/run_e2e.js --ng4" - node_js: "7" os: linux env: NODE_SCRIPT=tests/run_e2e.js diff --git a/packages/@angular/cli/blueprints/ng2/files/package.json b/packages/@angular/cli/blueprints/ng2/files/package.json index 14be24dbc1c0..5f74a573e1dd 100644 --- a/packages/@angular/cli/blueprints/ng2/files/package.json +++ b/packages/@angular/cli/blueprints/ng2/files/package.json @@ -12,14 +12,14 @@ }, "private": true, "dependencies": { - "@angular/common": "^2.3.1", - "@angular/compiler": "^2.3.1", - "@angular/core": "^2.3.1", - "@angular/forms": "^2.3.1", - "@angular/http": "^2.3.1", - "@angular/platform-browser": "^2.3.1", - "@angular/platform-browser-dynamic": "^2.3.1", - "@angular/router": "^3.3.1", + "@angular/common": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^2.4.0' %>", + "@angular/compiler": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^2.4.0' %>", + "@angular/core": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^2.4.0' %>", + "@angular/forms": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^2.4.0' %>", + "@angular/http": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^2.4.0' %>", + "@angular/platform-browser": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^2.4.0' %>", + "@angular/platform-browser-dynamic": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^2.4.0' %>", + "@angular/router": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^3.4.0' %>", "core-js": "^2.4.1", "rxjs": "^5.0.1", "ts-helpers": "^1.1.1", @@ -27,7 +27,7 @@ }, "devDependencies": { "@angular/cli": "<%= version %>", - "@angular/compiler-cli": "^2.3.1", + "@angular/compiler-cli": "<%= ng4 ? '>=4.0.0-beta <5.0.0' : '^2.4.0' %>", "@types/jasmine": "2.5.38", "@types/node": "^6.0.42", "codelyzer": "~2.0.0-beta.1", diff --git a/packages/@angular/cli/blueprints/ng2/index.ts b/packages/@angular/cli/blueprints/ng2/index.ts index b2bcccf94c97..e3b2b383a8be 100644 --- a/packages/@angular/cli/blueprints/ng2/index.ts +++ b/packages/@angular/cli/blueprints/ng2/index.ts @@ -48,6 +48,7 @@ export default Blueprint.extend({ routing: options.routing, inlineStyle: options.inlineStyle, inlineTemplate: options.inlineTemplate, + ng4: options.ng4, tests: this.tests }; }, diff --git a/packages/@angular/cli/commands/init.ts b/packages/@angular/cli/commands/init.ts index 5246fb7a374a..06b975ca73dc 100644 --- a/packages/@angular/cli/commands/init.ts +++ b/packages/@angular/cli/commands/init.ts @@ -10,6 +10,7 @@ const InitCommand: any = Command.extend({ { name: 'dry-run', type: Boolean, default: false, aliases: ['d'] }, { name: 'verbose', type: Boolean, default: false, aliases: ['v'] }, { name: 'link-cli', type: Boolean, default: false, aliases: ['lc'] }, + { name: 'ng4', type: Boolean, default: false }, { name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] }, { name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] }, { name: 'skip-tests', type: Boolean, default: false, aliases: ['st'] }, diff --git a/packages/@angular/cli/commands/new.ts b/packages/@angular/cli/commands/new.ts index 2f0f6d4cfa77..21b725bb6318 100644 --- a/packages/@angular/cli/commands/new.ts +++ b/packages/@angular/cli/commands/new.ts @@ -15,6 +15,7 @@ const NewCommand = Command.extend({ { name: 'dry-run', type: Boolean, default: false, aliases: ['d'] }, { name: 'verbose', type: Boolean, default: false, aliases: ['v'] }, { name: 'link-cli', type: Boolean, default: false, aliases: ['lc'] }, + { name: 'ng4', type: Boolean, default: false }, { name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] }, { name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] }, { name: 'skip-tests', type: Boolean, default: false, aliases: ['st'] }, diff --git a/packages/@angular/cli/commands/xi18n.ts b/packages/@angular/cli/commands/xi18n.ts index 066319bf9c2c..7a4e8b26a866 100644 --- a/packages/@angular/cli/commands/xi18n.ts +++ b/packages/@angular/cli/commands/xi18n.ts @@ -1,7 +1,5 @@ const Command = require('../ember-cli/lib/models/command'); -import {Extracti18nTask} from '../tasks/extract-i18n'; - export interface Xi18nOptions { outputPath?: string; verbose?: boolean; @@ -25,6 +23,7 @@ const Xi18nCommand = Command.extend({ ], run: function (commandOptions: any) { + const {Extracti18nTask} = require('../tasks/extract-i18n'); const xi18nTask = new Extracti18nTask({ ui: this.ui, diff --git a/packages/@angular/cli/tasks/init.ts b/packages/@angular/cli/tasks/init.ts index d8a8492715f5..8342d096f5bd 100644 --- a/packages/@angular/cli/tasks/init.ts +++ b/packages/@angular/cli/tasks/init.ts @@ -71,6 +71,7 @@ export default Task.extend({ inlineStyle: commandOptions.inlineStyle, inlineTemplate: commandOptions.inlineTemplate, ignoredUpdateFiles: ['favicon.ico'], + ng4: commandOptions.ng4, skipGit: commandOptions.skipGit, skipTests: commandOptions.skipTests }; diff --git a/packages/@ngtools/webpack/package.json b/packages/@ngtools/webpack/package.json index dcee77f4eced..ad5cce164d09 100644 --- a/packages/@ngtools/webpack/package.json +++ b/packages/@ngtools/webpack/package.json @@ -31,9 +31,9 @@ "source-map": "^0.5.6" }, "peerDependencies": { - "@angular/compiler": "^2.3.1", - "@angular/compiler-cli": "^2.3.1", - "@angular/core": "^2.3.1", + "@angular/compiler": "^2.3.1 || >=4.0.0-beta <5.0.0", + "@angular/compiler-cli": "^2.3.1 || >=4.0.0-beta <5.0.0", + "@angular/core": "^2.3.1 || >=4.0.0-beta <5.0.0", "@angular/tsc-wrapped": "^0.5.0", "typescript": "^2.0.2", "webpack": "2.2.0" diff --git a/tests/e2e/setup/500-create-project.ts b/tests/e2e/setup/500-create-project.ts index 4e5f0bbe008b..c88df6cc1d8a 100644 --- a/tests/e2e/setup/500-create-project.ts +++ b/tests/e2e/setup/500-create-project.ts @@ -24,7 +24,7 @@ export default function() { } else { // Otherwise create a project from scratch. createProject = Promise.resolve() - .then(() => ng('new', 'test-project', '--skip-npm')) + .then(() => ng('new', 'test-project', '--skip-npm', ...(argv['ng4'] ? ['--ng4'] : []))) .then(() => expectFileToExist(join(process.cwd(), 'test-project'))) .then(() => process.chdir('./test-project')); } @@ -37,7 +37,7 @@ export default function() { }); })) .then(() => { - if (argv.nightly || argv['ng-sha']) { + if (argv['nightly'] || argv['ng-sha']) { const label = argv['ng-sha'] ? `#2.0.0-${argv['ng-sha']}` : ''; return updateJsonFile('package.json', json => { // Install over the project with nightly builds. diff --git a/tests/e2e/tests/build/rebuild-css-change.ts b/tests/e2e/tests/build/rebuild-css-change.ts index ebdf0b9ebb4f..949368653f0d 100644 --- a/tests/e2e/tests/build/rebuild-css-change.ts +++ b/tests/e2e/tests/build/rebuild-css-change.ts @@ -7,7 +7,6 @@ import { import {appendToFile} from '../../utils/fs'; const webpackGoodRegEx = /webpack: bundle is now VALID|webpack: Compiled successfully./; -const webpackBadRegEx = /webpack: bundle is now INVALID|webpack: Compiling.../; export default function() { if (process.platform.startsWith('win')) { @@ -17,10 +16,8 @@ export default function() { return silentExecAndWaitForOutputToMatch('ng', ['serve'], webpackGoodRegEx) // Should trigger a rebuild. .then(() => exec('touch', 'src/main.ts')) - .then(() => waitForAnyProcessOutputToMatch(webpackBadRegEx, 10000)) .then(() => waitForAnyProcessOutputToMatch(webpackGoodRegEx, 10000)) .then(() => appendToFile('src/app/app.component.css', ':host { color: blue; }')) - .then(() => waitForAnyProcessOutputToMatch(webpackBadRegEx, 10000)) .then(() => waitForAnyProcessOutputToMatch(webpackGoodRegEx, 10000)) .then(() => killAllProcesses(), (err: any) => { killAllProcesses(); diff --git a/tests/e2e/tests/build/rebuild.ts b/tests/e2e/tests/build/rebuild.ts index eb2610f07d06..2dfb24bf6c43 100644 --- a/tests/e2e/tests/build/rebuild.ts +++ b/tests/e2e/tests/build/rebuild.ts @@ -60,8 +60,6 @@ export default function() { export class AppModule { } `)) // Should trigger a rebuild with a new bundle. - .then(() => waitForAnyProcessOutputToMatch( - /webpack: bundle is now INVALID|webpack: Compiling.../, 10000)) .then(() => waitForAnyProcessOutputToMatch( /webpack: bundle is now VALID|webpack: Compiled successfully./, 10000)) // Count the bundles.