Skip to content

Commit

Permalink
feat(@angular/cli): support TypeScript 2.4
Browse files Browse the repository at this point in the history
This PR doesn't change new projects to use 2.4 since I have seen some reports of possible problems in `@angular/*`.

Instead, it:
- removes the dependency restrictions on <2.3
- bumps related dependencies to the minimum that supports 2.4 (`rxjs@^5.4.2`, `ts-node@~3.2.0`)
- builds the CLI itself using 2.4

So if you want to install ts 2.4 in your new project, the CLI itself won't stop you.

Fix #6827
  • Loading branch information
filipesilva authored and Brocco committed Jul 21, 2017
1 parent 61b4e22 commit 7b9fc28
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 42 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"raw-loader": "^0.5.1",
"resolve": "^1.1.7",
"rsvp": "^3.0.17",
"rxjs": "^5.0.1",
"rxjs": "^5.4.2",
"sass-loader": "^6.0.3",
"script-loader": "^0.7.0",
"semver": "^5.3.0",
Expand All @@ -96,7 +96,7 @@
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"temp": "0.8.3",
"typescript": "~2.3.1",
"typescript": "~2.4.2",
"url-loader": "^0.5.7",
"walk-sync": "^0.3.1",
"webpack": "~3.3.0",
Expand All @@ -111,15 +111,15 @@
"@angular/core": "^4.0.0",
"@types/chalk": "^0.4.28",
"@types/common-tags": "^1.2.4",
"@types/denodeify": "^1.2.29",
"@types/denodeify": "^1.2.30",
"@types/express": "^4.0.32",
"@types/fs-extra": "~3.0.2",
"@types/glob": "^5.0.29",
"@types/jasmine": "2.5.45",
"@types/lodash": "4.14.50",
"@types/minimist": "^1.2.0",
"@types/mock-fs": "^3.6.30",
"@types/node": "^6.0.36",
"@types/node": "^6.0.84",
"@types/request": "0.0.39",
"@types/semver": "^5.3.30",
"@types/source-map": "^0.5.0",
Expand All @@ -141,7 +141,7 @@
"tar": "^3.1.5",
"through": "^2.3.6",
"tree-kill": "^1.0.0",
"ts-node": "^3.0.6",
"ts-node": "^3.2.0",
"tslint": "^5.1.0"
},
"optionalDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/@angular/cli/blueprints/ng/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"core-js": "^2.4.1",
"rxjs": "^5.4.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
Expand All @@ -45,7 +45,7 @@
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.0.4",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",<% } %>
"typescript": "~2.3.3"
}
Expand Down
7 changes: 5 additions & 2 deletions packages/@angular/cli/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { oneLine } from 'common-tags';
const Command = require('../ember-cli/lib/models/command');
const Project = require('../ember-cli/lib/models/project');
const SilentError = require('silent-error');
const mkdir = denodeify(fs.mkdir);

// There's some problem with the generic typings for fs.makedir.
// Couldn't find matching types for the callbacks so leaving it as any for now.
const mkdir = denodeify<string, void>(fs.mkdir as any);

const configFile = '.angular-cli.json';
const changeLater = (path: string) => `You can later change the value in "${configFile}" (${path})`;
Expand Down Expand Up @@ -177,7 +180,7 @@ const NewCommand = Command.extend({
});
} else {
createDirectory = mkdir(directoryName)
.catch(err => {
.catch((err) => {
if (err.code === 'EEXIST') {
if (this.isProject(directoryName)) {
throw new SilentError(oneLine`
Expand Down
2 changes: 1 addition & 1 deletion packages/@angular/cli/models/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class CliConfig<JsonType> {
get config(): JsonType { return <any>this._config; }

save(path: string = this._configPath) {
return fs.writeFileSync(path, this.serialize(), 'utf-8');
return fs.writeFileSync(path, this.serialize(), {encoding: 'utf-8'});
}
serialize(mimetype = 'application/json'): string {
return this._config.$$serialize(mimetype);
Expand Down
4 changes: 2 additions & 2 deletions packages/@angular/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"raw-loader": "^0.5.1",
"resolve": "^1.1.7",
"rsvp": "^3.0.17",
"rxjs": "^5.0.1",
"rxjs": "^5.4.2",
"sass-loader": "^6.0.3",
"script-loader": "^0.7.0",
"semver": "^5.1.0",
Expand All @@ -81,7 +81,7 @@
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"temp": "0.8.3",
"typescript": ">=2.0.0 <2.4.0",
"typescript": ">=2.0.0 <2.5.0",
"url-loader": "^0.5.7",
"walk-sync": "^0.3.1",
"webpack": "~3.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@ngtools/logger/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class Logger extends Observable<LogEntry> {
return `<Logger(${this.name})>`;
}

lift(operator: Operator<LogEntry, LogEntry>): Observable<LogEntry> {
lift<R>(operator: Operator<LogEntry, R>): Observable<R> {
return this._observable.lift(operator);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/assets/webpack/test-app-weird/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@angular/router": ">=4.0.0-beta <5.0.0",
"@ngtools/webpack": "0.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
Expand All @@ -22,7 +22,7 @@
"preprocess-loader": "^0.2.2",
"raw-loader": "^0.5.1",
"sass-loader": "^3.2.0",
"typescript": "~2.1.0",
"typescript": "~2.4.2",
"webpack": "2.2.0"
}
}
4 changes: 2 additions & 2 deletions tests/e2e/assets/webpack/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"@angular/router": "^3.3.1",
"@ngtools/webpack": "0.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"node-sass": "^3.7.0",
"performance-now": "^0.2.0",
"raw-loader": "^0.5.1",
"sass-loader": "^3.2.0",
"typescript": "~2.0.3",
"typescript": "~2.4.2",
"webpack": "2.2.0"
}
}
4 changes: 2 additions & 2 deletions tests/e2e/assets/webpack/test-server-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"@angular/router": "^4.0.0",
"@ngtools/webpack": "0.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.3.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"node-sass": "^4.5.0",
"performance-now": "^0.2.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.3",
"typescript": "^2.3.2",
"typescript": "~2.4.2",
"webpack": "2.2.1"
}
}
4 changes: 2 additions & 2 deletions tests/e2e/tests/test/test-fail-watch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
killAllProcesses,
waitForAnyProcessOutputToMatch,
execAndWaitForOutputToMatch
execAndWaitForOutputToMatch,
} from '../../utils/process';
import { expectToFail } from '../../utils/utils';
import { readFile, writeFile } from '../../utils/fs';
Expand All @@ -20,7 +20,7 @@ export default function () {
.then(() => expectToFail(() => waitForAnyProcessOutputToMatch(karmaGoodRegEx, 10000)))
// Restore working spec.
.then(() => writeFile('src/app/app.component.spec.ts', originalSpec))
.then(() => waitForAnyProcessOutputToMatch(karmaGoodRegEx, 10000))
.then(() => waitForAnyProcessOutputToMatch(karmaGoodRegEx, 20000))
.then(() => killAllProcesses(), (err: any) => {
killAllProcesses();
throw err;
Expand Down
2 changes: 1 addition & 1 deletion tools/publish/src/build-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function build(args: string[], _opts: any, logger: Logger): void {

const output = require('./build-schema').buildSchema(inFile, logger);
if (outFile) {
fs.writeFileSync(outFile, output, 'utf-8');
fs.writeFileSync(outFile, output, { encoding: 'utf-8' });
} else {
logger.info(output);
}
Expand Down
2 changes: 1 addition & 1 deletion tools/publish/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function build(packagesToBuild: string[], _opts: any,
.then(() => {
const input = path.join(root, 'packages/@angular/cli/lib/config/schema.json');
const output = path.join(root, 'packages/@angular/cli/lib/config/schema.d.ts');
fs.writeFileSync(output, buildSchema(input, logger), 'utf-8');
fs.writeFileSync(output, buildSchema(input, logger), { encoding: 'utf-8' });
})
.then(() => logger.info('Compiling packages...'))
.then(() => {
Expand Down
62 changes: 43 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
version "1.2.5"
resolved "https://registry.yarnpkg.com/@types/common-tags/-/common-tags-1.2.5.tgz#14f29893992eb325594b83d739af02f2b6520f46"

"@types/denodeify@^1.2.29":
"@types/denodeify@^1.2.30":
version "1.2.30"
resolved "https://registry.yarnpkg.com/@types/denodeify/-/denodeify-1.2.30.tgz#9e356062b44524e7a399fb446d836fcfe352b9dc"

Expand Down Expand Up @@ -107,9 +107,9 @@
dependencies:
"@types/node" "*"

"@types/node@*", "@types/node@^6.0.36":
version "6.0.78"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.78.tgz#5d4a3f579c1524e01ee21bf474e6fba09198f470"
"@types/node@*", "@types/node@^6.0.84":
version "6.0.84"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.84.tgz#193ffe5a9f42864d425ffd9739d95b753c6a1eab"

"@types/request@0.0.39":
version "0.0.39"
Expand Down Expand Up @@ -253,6 +253,12 @@ ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"

ansi-styles@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.1.0.tgz#09c202d5c917ec23188caa5c9cb9179cd9547750"
dependencies:
color-convert "^1.0.0"

anymatch@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507"
Expand Down Expand Up @@ -723,6 +729,14 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"

chalk@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d"
dependencies:
ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"

chokidar@^1.6.0, chokidar@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
Expand Down Expand Up @@ -827,7 +841,7 @@ code-point-at@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"

color-convert@^1.3.0:
color-convert@^1.0.0, color-convert@^1.3.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a"
dependencies:
Expand Down Expand Up @@ -2294,6 +2308,10 @@ has-flag@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"

has-flag@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"

has-unicode@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9"
Expand Down Expand Up @@ -4536,9 +4554,9 @@ rx-lite@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"

rxjs@^5.0.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.1.tgz#b62f757f279445d265a18a58fb0a70dc90e91626"
rxjs@^5.4.2:
version "5.4.2"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.2.tgz#2a3236fcbf03df57bae06fd6972fd99e5c08fcf7"
dependencies:
symbol-observable "^1.0.1"

Expand Down Expand Up @@ -5021,6 +5039,12 @@ supports-color@^3.1.0, supports-color@^3.1.1, supports-color@^3.2.3:
dependencies:
has-flag "^1.0.0"

supports-color@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.0.tgz#ad986dc7eb2315d009b4d77c8169c2231a684037"
dependencies:
has-flag "^2.0.0"

svgo@^0.7.0:
version "0.7.2"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5"
Expand Down Expand Up @@ -5166,19 +5190,19 @@ tryit@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb"

ts-node@^3.0.6:
version "3.1.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.1.0.tgz#a75ec5aeb48f3058b1b945dba765f1150ba88f8c"
ts-node@^3.2.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.2.1.tgz#9595dd840d03e62bc79214ce5a7b51e55e3c4ffc"
dependencies:
arrify "^1.0.0"
chalk "^1.1.1"
chalk "^2.0.0"
diff "^3.1.0"
make-error "^1.1.1"
minimist "^1.2.0"
mkdirp "^0.5.1"
source-map-support "^0.4.0"
tsconfig "^6.0.0"
v8flags "^2.0.11"
v8flags "^3.0.0"
yn "^2.0.0"

tsconfig@^6.0.0:
Expand Down Expand Up @@ -5251,9 +5275,9 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

typescript@^2.3.3, typescript@~2.3.1:
version "2.3.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.4.tgz#3d38321828231e434f287514959c37a82b629f42"
typescript@^2.3.3, typescript@~2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844"

uglify-js@3.0.x:
version "3.0.19"
Expand Down Expand Up @@ -5389,9 +5413,9 @@ uuid@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"

v8flags@^2.0.11:
version "2.1.1"
resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4"
v8flags@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.0.tgz#4be9604488e0c4123645def705b1848d16b8e01f"
dependencies:
user-home "^1.1.1"

Expand Down

0 comments on commit 7b9fc28

Please sign in to comment.