From 2a057a5bd1eb110fb6792e41abd11e5324c649e5 Mon Sep 17 00:00:00 2001 From: Tero Parviainen Date: Fri, 5 Feb 2016 17:23:35 +0200 Subject: [PATCH] docs(upgrade) switch from TSD to Typings closes #873 Also switch Protractor back to JS for now. Conversion not worth it because of ambient type conflicts, until Protractor ships with its own typings. Also remove some unneeded type s from examples and guide. --- .../_examples/upgrade/ts/classes/.gitignore | 2 - .../upgrade/ts/classes/app/js/app.module.ts | 5 - .../upgrade/ts/classes/package.1.json | 4 +- .../test/e2e/{scenarios.ts => scenarios.js} | 3 - .../upgrade/ts/classes/test/test_helper.ts | 3 - .../upgrade/ts/classes/tsconfig.1.json | 4 +- .../_examples/upgrade/ts/classes/typings.json | 10 + .../upgrade/ts/ng2_components/.gitignore | 2 - .../ts/ng2_components/app/js/app.module.ts | 4 - .../upgrade/ts/ng2_components/package.1.json | 4 +- .../test/e2e/{scenarios.ts => scenarios.js} | 12 +- .../ts/ng2_components/test/test_helper.ts | 4 - .../upgrade/ts/ng2_components/tsconfig.1.json | 4 +- .../upgrade/ts/ng2_components/typings.json | 10 + .../_examples/upgrade/ts/ng2_final/.gitignore | 2 - .../upgrade/ts/ng2_final/package.1.json | 4 +- .../test/e2e/{scenarios.ts => scenarios.js} | 12 +- .../upgrade/ts/ng2_final/test/test_helper.ts | 2 - .../upgrade/ts/ng2_final/tsconfig.1.json | 4 +- .../upgrade/ts/ng2_final/typings.json | 5 + .../upgrade/ts/ng2_initial/.gitignore | 2 - .../ts/ng2_initial/app/js/app.module.ts | 4 - .../upgrade/ts/ng2_initial/package.1.json | 4 +- .../test/e2e/{scenarios.ts => scenarios.js} | 0 .../ts/ng2_initial/test/karma.conf.1.js | 2 +- .../ts/ng2_initial/test/test_helper.ts | 4 - .../upgrade/ts/ng2_initial/tsconfig.1.json | 4 +- .../upgrade/ts/ng2_initial/typings.json | 10 + .../ts/typescript-conversion/.gitignore | 2 - .../app/js/app.module.ts | 6 - .../ts/typescript-conversion/package.1.json | 15 +- .../test/e2e/{scenarios.ts => scenarios.js} | 3 - .../typescript-conversion/test/test_helper.ts | 3 - .../ts/typescript-conversion/tsconfig.1.json | 4 +- .../ts/typescript-conversion/typings.json | 10 + public/docs/ts/latest/guide/upgrade.jade | 180 +++++++----------- 36 files changed, 162 insertions(+), 191 deletions(-) rename public/docs/_examples/upgrade/ts/classes/test/e2e/{scenarios.ts => scenarios.js} (96%) delete mode 100644 public/docs/_examples/upgrade/ts/classes/test/test_helper.ts create mode 100644 public/docs/_examples/upgrade/ts/classes/typings.json rename public/docs/_examples/upgrade/ts/ng2_components/test/e2e/{scenarios.ts => scenarios.js} (92%) delete mode 100644 public/docs/_examples/upgrade/ts/ng2_components/test/test_helper.ts create mode 100644 public/docs/_examples/upgrade/ts/ng2_components/typings.json rename public/docs/_examples/upgrade/ts/ng2_final/test/e2e/{scenarios.ts => scenarios.js} (93%) delete mode 100644 public/docs/_examples/upgrade/ts/ng2_final/test/test_helper.ts create mode 100644 public/docs/_examples/upgrade/ts/ng2_final/typings.json rename public/docs/_examples/upgrade/ts/ng2_initial/test/e2e/{scenarios.ts => scenarios.js} (100%) delete mode 100644 public/docs/_examples/upgrade/ts/ng2_initial/test/test_helper.ts create mode 100644 public/docs/_examples/upgrade/ts/ng2_initial/typings.json rename public/docs/_examples/upgrade/ts/typescript-conversion/test/e2e/{scenarios.ts => scenarios.js} (96%) delete mode 100644 public/docs/_examples/upgrade/ts/typescript-conversion/test/test_helper.ts create mode 100644 public/docs/_examples/upgrade/ts/typescript-conversion/typings.json diff --git a/public/docs/_examples/upgrade/ts/classes/.gitignore b/public/docs/_examples/upgrade/ts/classes/.gitignore index 8cfe0da551..63d5d99a52 100644 --- a/public/docs/_examples/upgrade/ts/classes/.gitignore +++ b/public/docs/_examples/upgrade/ts/classes/.gitignore @@ -2,5 +2,3 @@ app/**/*.js app/**/*.js.map test/unit/**/*.js test/unit/**/*.js.map -test/e2e/**/*.js -test/e2e/**/*.js.map diff --git a/public/docs/_examples/upgrade/ts/classes/app/js/app.module.ts b/public/docs/_examples/upgrade/ts/classes/app/js/app.module.ts index 60b30ec24d..01e3328c1e 100644 --- a/public/docs/_examples/upgrade/ts/classes/app/js/app.module.ts +++ b/public/docs/_examples/upgrade/ts/classes/app/js/app.module.ts @@ -1,9 +1,4 @@ // #docregion pre-bootstrap -// #docregion typings -/// -/// -/// -// #enddocregion import core from './core/core.module'; import phoneList from './phone_list/phone_list.module'; diff --git a/public/docs/_examples/upgrade/ts/classes/package.1.json b/public/docs/_examples/upgrade/ts/classes/package.1.json index 229a515900..c940543174 100644 --- a/public/docs/_examples/upgrade/ts/classes/package.1.json +++ b/public/docs/_examples/upgrade/ts/classes/package.1.json @@ -18,7 +18,8 @@ "tmp": "0.0.23", "bower": "^1.3.1", "shelljs": "^0.2.6", - "typescript": "1.7.3" + "typescript": "1.7.3", + "typings": "^0.6.8" }, "scripts": { "postinstall": "bower install", @@ -36,6 +37,7 @@ "preprotractor": "npm run update-webdriver", "protractor": "protractor test/protractor-conf.js", + "typings": "typings", "tsc": "tsc -p . -w" } } diff --git a/public/docs/_examples/upgrade/ts/classes/test/e2e/scenarios.ts b/public/docs/_examples/upgrade/ts/classes/test/e2e/scenarios.js similarity index 96% rename from public/docs/_examples/upgrade/ts/classes/test/e2e/scenarios.ts rename to public/docs/_examples/upgrade/ts/classes/test/e2e/scenarios.js index 4cdbefc047..5a505b5dae 100644 --- a/public/docs/_examples/upgrade/ts/classes/test/e2e/scenarios.ts +++ b/public/docs/_examples/upgrade/ts/classes/test/e2e/scenarios.js @@ -1,9 +1,6 @@ 'use strict'; /* http://docs.angularjs.org/guide/dev_guide.e2e-testing */ -// #docregion declares -declare var browser:any, element:any, by:any; -// #enddocregion declares describe('PhoneCat App', function() { diff --git a/public/docs/_examples/upgrade/ts/classes/test/test_helper.ts b/public/docs/_examples/upgrade/ts/classes/test/test_helper.ts deleted file mode 100644 index 75f83fab7a..0000000000 --- a/public/docs/_examples/upgrade/ts/classes/test/test_helper.ts +++ /dev/null @@ -1,3 +0,0 @@ -// #docregion -/// -/// diff --git a/public/docs/_examples/upgrade/ts/classes/tsconfig.1.json b/public/docs/_examples/upgrade/ts/classes/tsconfig.1.json index a140e5b7b3..c3cf6bcddb 100644 --- a/public/docs/_examples/upgrade/ts/classes/tsconfig.1.json +++ b/public/docs/_examples/upgrade/ts/classes/tsconfig.1.json @@ -8,6 +8,8 @@ "removeComments": false }, "exclude": [ - "node_modules" + "node_modules", + "typings/main.d.ts", + "typings/main" ] } diff --git a/public/docs/_examples/upgrade/ts/classes/typings.json b/public/docs/_examples/upgrade/ts/classes/typings.json new file mode 100644 index 0000000000..3925b59066 --- /dev/null +++ b/public/docs/_examples/upgrade/ts/classes/typings.json @@ -0,0 +1,10 @@ +{ + "ambientDependencies": { + "angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#3bebbe1baee04846cc46ed7249e8117e4cd7c7ff", + "angular-mocks": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-mocks.d.ts#77dd2668f85730372aa8e62152e652048e8b6b87", + "angular-resource": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-resource.d.ts#c6609aff88f2c59e4df9adb93df5c7932adfd7b4", + "angular-route": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-route.d.ts#cf172aab99c3139a718aa8e65398a22c53dd7ead", + "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee", + "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#cf2a968f0edd7d30773f7d23fe3708fa029d5ab7" + } +} diff --git a/public/docs/_examples/upgrade/ts/ng2_components/.gitignore b/public/docs/_examples/upgrade/ts/ng2_components/.gitignore index 8cfe0da551..63d5d99a52 100644 --- a/public/docs/_examples/upgrade/ts/ng2_components/.gitignore +++ b/public/docs/_examples/upgrade/ts/ng2_components/.gitignore @@ -2,5 +2,3 @@ app/**/*.js app/**/*.js.map test/unit/**/*.js test/unit/**/*.js.map -test/e2e/**/*.js -test/e2e/**/*.js.map diff --git a/public/docs/_examples/upgrade/ts/ng2_components/app/js/app.module.ts b/public/docs/_examples/upgrade/ts/ng2_components/app/js/app.module.ts index c421e8123e..1f6f20c104 100644 --- a/public/docs/_examples/upgrade/ts/ng2_components/app/js/app.module.ts +++ b/public/docs/_examples/upgrade/ts/ng2_components/app/js/app.module.ts @@ -1,7 +1,3 @@ -/// -/// -/// - // #docregion adapter-import import {UpgradeAdapter} from 'angular2/upgrade'; // #enddocregion adapter-import diff --git a/public/docs/_examples/upgrade/ts/ng2_components/package.1.json b/public/docs/_examples/upgrade/ts/ng2_components/package.1.json index 50c4efdb35..fcd1dde766 100644 --- a/public/docs/_examples/upgrade/ts/ng2_components/package.1.json +++ b/public/docs/_examples/upgrade/ts/ng2_components/package.1.json @@ -24,7 +24,8 @@ "tmp": "0.0.23", "bower": "^1.3.1", "shelljs": "^0.2.6", - "typescript": "1.7.3" + "typescript": "1.7.3", + "typings": "^0.6.8" }, "scripts": { "postinstall": "bower install", @@ -42,6 +43,7 @@ "preprotractor": "npm run update-webdriver", "protractor": "protractor test/protractor-conf.js", + "typings": "typings", "tsc": "tsc -p . -w" } } diff --git a/public/docs/_examples/upgrade/ts/ng2_components/test/e2e/scenarios.ts b/public/docs/_examples/upgrade/ts/ng2_components/test/e2e/scenarios.js similarity index 92% rename from public/docs/_examples/upgrade/ts/ng2_components/test/e2e/scenarios.ts rename to public/docs/_examples/upgrade/ts/ng2_components/test/e2e/scenarios.js index 7f443cfd84..1da0896c0d 100644 --- a/public/docs/_examples/upgrade/ts/ng2_components/test/e2e/scenarios.ts +++ b/public/docs/_examples/upgrade/ts/ng2_components/test/e2e/scenarios.js @@ -29,8 +29,8 @@ describe('PhoneCat App', function() { query.clear(); // https://github.com/angular/protractor/issues/2019 - let str = 'motorola'; - for (let i:number = 0; i < str.length; i++) { + var str = 'motorola'; + for (var i = 0; i < str.length; i++) { query.sendKeys(str.charAt(i)); } @@ -50,8 +50,8 @@ describe('PhoneCat App', function() { //let's narrow the dataset to make the test assertions shorter // https://github.com/angular/protractor/issues/2019 - let str = 'tablet'; - for (let i:number = 0; i < str.length; i++) { + var str = 'tablet'; + for (var i = 0; i < str.length; i++) { query.sendKeys(str.charAt(i)); } @@ -72,8 +72,8 @@ describe('PhoneCat App', function() { it('should render phone specific links', function() { var query = element(by.css('input')); // https://github.com/angular/protractor/issues/2019 - let str = 'nexus'; - for (let i:number = 0; i < str.length; i++) { + var str = 'nexus'; + for (var i = 0; i < str.length; i++) { query.sendKeys(str.charAt(i)); } element.all(by.css('.phones li a')).first().click(); diff --git a/public/docs/_examples/upgrade/ts/ng2_components/test/test_helper.ts b/public/docs/_examples/upgrade/ts/ng2_components/test/test_helper.ts deleted file mode 100644 index 2a1dbc5756..0000000000 --- a/public/docs/_examples/upgrade/ts/ng2_components/test/test_helper.ts +++ /dev/null @@ -1,4 +0,0 @@ -// #docregion -/// -/// -/// diff --git a/public/docs/_examples/upgrade/ts/ng2_components/tsconfig.1.json b/public/docs/_examples/upgrade/ts/ng2_components/tsconfig.1.json index 6c2522d270..eef7e2be89 100644 --- a/public/docs/_examples/upgrade/ts/ng2_components/tsconfig.1.json +++ b/public/docs/_examples/upgrade/ts/ng2_components/tsconfig.1.json @@ -9,6 +9,8 @@ "removeComments": false }, "exclude": [ - "node_modules" + "node_modules", + "typings/main.d.ts", + "typings/main" ] } diff --git a/public/docs/_examples/upgrade/ts/ng2_components/typings.json b/public/docs/_examples/upgrade/ts/ng2_components/typings.json new file mode 100644 index 0000000000..3925b59066 --- /dev/null +++ b/public/docs/_examples/upgrade/ts/ng2_components/typings.json @@ -0,0 +1,10 @@ +{ + "ambientDependencies": { + "angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#3bebbe1baee04846cc46ed7249e8117e4cd7c7ff", + "angular-mocks": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-mocks.d.ts#77dd2668f85730372aa8e62152e652048e8b6b87", + "angular-resource": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-resource.d.ts#c6609aff88f2c59e4df9adb93df5c7932adfd7b4", + "angular-route": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-route.d.ts#cf172aab99c3139a718aa8e65398a22c53dd7ead", + "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee", + "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#cf2a968f0edd7d30773f7d23fe3708fa029d5ab7" + } +} diff --git a/public/docs/_examples/upgrade/ts/ng2_final/.gitignore b/public/docs/_examples/upgrade/ts/ng2_final/.gitignore index 8cfe0da551..63d5d99a52 100644 --- a/public/docs/_examples/upgrade/ts/ng2_final/.gitignore +++ b/public/docs/_examples/upgrade/ts/ng2_final/.gitignore @@ -2,5 +2,3 @@ app/**/*.js app/**/*.js.map test/unit/**/*.js test/unit/**/*.js.map -test/e2e/**/*.js -test/e2e/**/*.js.map diff --git a/public/docs/_examples/upgrade/ts/ng2_final/package.1.json b/public/docs/_examples/upgrade/ts/ng2_final/package.1.json index 50c4efdb35..fcd1dde766 100644 --- a/public/docs/_examples/upgrade/ts/ng2_final/package.1.json +++ b/public/docs/_examples/upgrade/ts/ng2_final/package.1.json @@ -24,7 +24,8 @@ "tmp": "0.0.23", "bower": "^1.3.1", "shelljs": "^0.2.6", - "typescript": "1.7.3" + "typescript": "1.7.3", + "typings": "^0.6.8" }, "scripts": { "postinstall": "bower install", @@ -42,6 +43,7 @@ "preprotractor": "npm run update-webdriver", "protractor": "protractor test/protractor-conf.js", + "typings": "typings", "tsc": "tsc -p . -w" } } diff --git a/public/docs/_examples/upgrade/ts/ng2_final/test/e2e/scenarios.ts b/public/docs/_examples/upgrade/ts/ng2_final/test/e2e/scenarios.js similarity index 93% rename from public/docs/_examples/upgrade/ts/ng2_final/test/e2e/scenarios.ts rename to public/docs/_examples/upgrade/ts/ng2_final/test/e2e/scenarios.js index a8280cfed7..2e4b884563 100644 --- a/public/docs/_examples/upgrade/ts/ng2_final/test/e2e/scenarios.ts +++ b/public/docs/_examples/upgrade/ts/ng2_final/test/e2e/scenarios.js @@ -31,8 +31,8 @@ describe('PhoneCat App', function() { query.clear(); // https://github.com/angular/protractor/issues/2019 - let str = 'motorola'; - for (let i:number = 0; i < str.length; i++) { + var str = 'motorola'; + for (var i = 0; i < str.length; i++) { query.sendKeys(str.charAt(i)); } @@ -52,8 +52,8 @@ describe('PhoneCat App', function() { //let's narrow the dataset to make the test assertions shorter // https://github.com/angular/protractor/issues/2019 - let str = 'tablet'; - for (let i:number = 0; i < str.length; i++) { + var str = 'tablet'; + for (var i = 0; i < str.length; i++) { query.sendKeys(str.charAt(i)); } @@ -74,8 +74,8 @@ describe('PhoneCat App', function() { it('should render phone specific links', function() { var query = element(by.css('input')); // https://github.com/angular/protractor/issues/2019 - let str = 'nexus'; - for (let i:number = 0; i < str.length; i++) { + var str = 'nexus'; + for (var i = 0; i < str.length; i++) { query.sendKeys(str.charAt(i)); } element.all(by.css('.phones li a')).first().click(); diff --git a/public/docs/_examples/upgrade/ts/ng2_final/test/test_helper.ts b/public/docs/_examples/upgrade/ts/ng2_final/test/test_helper.ts deleted file mode 100644 index a3d2693be8..0000000000 --- a/public/docs/_examples/upgrade/ts/ng2_final/test/test_helper.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/public/docs/_examples/upgrade/ts/ng2_final/tsconfig.1.json b/public/docs/_examples/upgrade/ts/ng2_final/tsconfig.1.json index 6c2522d270..eef7e2be89 100644 --- a/public/docs/_examples/upgrade/ts/ng2_final/tsconfig.1.json +++ b/public/docs/_examples/upgrade/ts/ng2_final/tsconfig.1.json @@ -9,6 +9,8 @@ "removeComments": false }, "exclude": [ - "node_modules" + "node_modules", + "typings/main.d.ts", + "typings/main" ] } diff --git a/public/docs/_examples/upgrade/ts/ng2_final/typings.json b/public/docs/_examples/upgrade/ts/ng2_final/typings.json new file mode 100644 index 0000000000..ea251e37cd --- /dev/null +++ b/public/docs/_examples/upgrade/ts/ng2_final/typings.json @@ -0,0 +1,5 @@ +{ + "ambientDependencies": { + "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee" + } +} diff --git a/public/docs/_examples/upgrade/ts/ng2_initial/.gitignore b/public/docs/_examples/upgrade/ts/ng2_initial/.gitignore index 8cfe0da551..63d5d99a52 100644 --- a/public/docs/_examples/upgrade/ts/ng2_initial/.gitignore +++ b/public/docs/_examples/upgrade/ts/ng2_initial/.gitignore @@ -2,5 +2,3 @@ app/**/*.js app/**/*.js.map test/unit/**/*.js test/unit/**/*.js.map -test/e2e/**/*.js -test/e2e/**/*.js.map diff --git a/public/docs/_examples/upgrade/ts/ng2_initial/app/js/app.module.ts b/public/docs/_examples/upgrade/ts/ng2_initial/app/js/app.module.ts index b8ea6945ee..3172decdf3 100644 --- a/public/docs/_examples/upgrade/ts/ng2_initial/app/js/app.module.ts +++ b/public/docs/_examples/upgrade/ts/ng2_initial/app/js/app.module.ts @@ -1,7 +1,3 @@ -/// -/// -/// - // #docregion adapter-import import {UpgradeAdapter} from 'angular2/upgrade'; // #enddocregion adapter-import diff --git a/public/docs/_examples/upgrade/ts/ng2_initial/package.1.json b/public/docs/_examples/upgrade/ts/ng2_initial/package.1.json index 50c4efdb35..fcd1dde766 100644 --- a/public/docs/_examples/upgrade/ts/ng2_initial/package.1.json +++ b/public/docs/_examples/upgrade/ts/ng2_initial/package.1.json @@ -24,7 +24,8 @@ "tmp": "0.0.23", "bower": "^1.3.1", "shelljs": "^0.2.6", - "typescript": "1.7.3" + "typescript": "1.7.3", + "typings": "^0.6.8" }, "scripts": { "postinstall": "bower install", @@ -42,6 +43,7 @@ "preprotractor": "npm run update-webdriver", "protractor": "protractor test/protractor-conf.js", + "typings": "typings", "tsc": "tsc -p . -w" } } diff --git a/public/docs/_examples/upgrade/ts/ng2_initial/test/e2e/scenarios.ts b/public/docs/_examples/upgrade/ts/ng2_initial/test/e2e/scenarios.js similarity index 100% rename from public/docs/_examples/upgrade/ts/ng2_initial/test/e2e/scenarios.ts rename to public/docs/_examples/upgrade/ts/ng2_initial/test/e2e/scenarios.js diff --git a/public/docs/_examples/upgrade/ts/ng2_initial/test/karma.conf.1.js b/public/docs/_examples/upgrade/ts/ng2_initial/test/karma.conf.1.js index 125a247f69..8ef2a4a0d0 100644 --- a/public/docs/_examples/upgrade/ts/ng2_initial/test/karma.conf.1.js +++ b/public/docs/_examples/upgrade/ts/ng2_initial/test/karma.conf.1.js @@ -23,10 +23,10 @@ module.exports = function(config){ 'node_modules/rxjs/bundles/Rx.js', 'node_modules/angular2/bundles/http.dev.js', // #enddocregion ng2-http - 'test/karma_test_shim.js', // #docregion ng2-testing 'node_modules/angular2/bundles/testing.dev.js', // #enddocregion ng2-testing + 'test/karma_test_shim.js', {pattern: 'app/js/**/*.js', included: false, watched: true}, {pattern: 'test/unit/**/*.js', included: false, watched: true} // #docregion ng2 diff --git a/public/docs/_examples/upgrade/ts/ng2_initial/test/test_helper.ts b/public/docs/_examples/upgrade/ts/ng2_initial/test/test_helper.ts deleted file mode 100644 index 2a1dbc5756..0000000000 --- a/public/docs/_examples/upgrade/ts/ng2_initial/test/test_helper.ts +++ /dev/null @@ -1,4 +0,0 @@ -// #docregion -/// -/// -/// diff --git a/public/docs/_examples/upgrade/ts/ng2_initial/tsconfig.1.json b/public/docs/_examples/upgrade/ts/ng2_initial/tsconfig.1.json index 6c2522d270..eef7e2be89 100644 --- a/public/docs/_examples/upgrade/ts/ng2_initial/tsconfig.1.json +++ b/public/docs/_examples/upgrade/ts/ng2_initial/tsconfig.1.json @@ -9,6 +9,8 @@ "removeComments": false }, "exclude": [ - "node_modules" + "node_modules", + "typings/main.d.ts", + "typings/main" ] } diff --git a/public/docs/_examples/upgrade/ts/ng2_initial/typings.json b/public/docs/_examples/upgrade/ts/ng2_initial/typings.json new file mode 100644 index 0000000000..3925b59066 --- /dev/null +++ b/public/docs/_examples/upgrade/ts/ng2_initial/typings.json @@ -0,0 +1,10 @@ +{ + "ambientDependencies": { + "angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#3bebbe1baee04846cc46ed7249e8117e4cd7c7ff", + "angular-mocks": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-mocks.d.ts#77dd2668f85730372aa8e62152e652048e8b6b87", + "angular-resource": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-resource.d.ts#c6609aff88f2c59e4df9adb93df5c7932adfd7b4", + "angular-route": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-route.d.ts#cf172aab99c3139a718aa8e65398a22c53dd7ead", + "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee", + "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#cf2a968f0edd7d30773f7d23fe3708fa029d5ab7" + } +} diff --git a/public/docs/_examples/upgrade/ts/typescript-conversion/.gitignore b/public/docs/_examples/upgrade/ts/typescript-conversion/.gitignore index 8cfe0da551..63d5d99a52 100644 --- a/public/docs/_examples/upgrade/ts/typescript-conversion/.gitignore +++ b/public/docs/_examples/upgrade/ts/typescript-conversion/.gitignore @@ -2,5 +2,3 @@ app/**/*.js app/**/*.js.map test/unit/**/*.js test/unit/**/*.js.map -test/e2e/**/*.js -test/e2e/**/*.js.map diff --git a/public/docs/_examples/upgrade/ts/typescript-conversion/app/js/app.module.ts b/public/docs/_examples/upgrade/ts/typescript-conversion/app/js/app.module.ts index 1ad958caec..835518a9c0 100644 --- a/public/docs/_examples/upgrade/ts/typescript-conversion/app/js/app.module.ts +++ b/public/docs/_examples/upgrade/ts/typescript-conversion/app/js/app.module.ts @@ -1,10 +1,4 @@ // #docregion pre-bootstrap -// #docregion typings -/// -/// -/// -// #enddocregion - import core from './core/core.module'; import phoneList from './phone_list/phone_list.module'; import phoneDetail from './phone_detail/phone_detail.module'; diff --git a/public/docs/_examples/upgrade/ts/typescript-conversion/package.1.json b/public/docs/_examples/upgrade/ts/typescript-conversion/package.1.json index 229a515900..3afe0209be 100644 --- a/public/docs/_examples/upgrade/ts/typescript-conversion/package.1.json +++ b/public/docs/_examples/upgrade/ts/typescript-conversion/package.1.json @@ -9,33 +9,30 @@ "systemjs": "0.19.6" }, "devDependencies": { + "bower": "^1.3.1", + "http-server": "^0.6.1", "karma": "^0.12.16", "karma-chrome-launcher": "^0.1.4", "karma-firefox-launcher": "^0.1.3", "karma-jasmine": "~0.2.0", "protractor": "^3.0.0", - "http-server": "^0.6.1", - "tmp": "0.0.23", - "bower": "^1.3.1", "shelljs": "^0.2.6", - "typescript": "1.7.3" + "tmp": "0.0.23", + "typescript": "^1.7.5", + "typings": "^0.6.8" }, "scripts": { "postinstall": "bower install", - "prestart": "npm install", "start": "http-server -a 0.0.0.0 -p 8000", - "pretest": "npm install", "test": "node node_modules/karma/bin/karma start test/karma.conf.js", "test-single-run": "node node_modules/karma/bin/karma start test/karma.conf.js --single-run", - "preupdate-webdriver": "npm install", "update-webdriver": "webdriver-manager update", - "preprotractor": "npm run update-webdriver", "protractor": "protractor test/protractor-conf.js", - + "typings": "typings", "tsc": "tsc -p . -w" } } diff --git a/public/docs/_examples/upgrade/ts/typescript-conversion/test/e2e/scenarios.ts b/public/docs/_examples/upgrade/ts/typescript-conversion/test/e2e/scenarios.js similarity index 96% rename from public/docs/_examples/upgrade/ts/typescript-conversion/test/e2e/scenarios.ts rename to public/docs/_examples/upgrade/ts/typescript-conversion/test/e2e/scenarios.js index 4cdbefc047..5a505b5dae 100644 --- a/public/docs/_examples/upgrade/ts/typescript-conversion/test/e2e/scenarios.ts +++ b/public/docs/_examples/upgrade/ts/typescript-conversion/test/e2e/scenarios.js @@ -1,9 +1,6 @@ 'use strict'; /* http://docs.angularjs.org/guide/dev_guide.e2e-testing */ -// #docregion declares -declare var browser:any, element:any, by:any; -// #enddocregion declares describe('PhoneCat App', function() { diff --git a/public/docs/_examples/upgrade/ts/typescript-conversion/test/test_helper.ts b/public/docs/_examples/upgrade/ts/typescript-conversion/test/test_helper.ts deleted file mode 100644 index 75f83fab7a..0000000000 --- a/public/docs/_examples/upgrade/ts/typescript-conversion/test/test_helper.ts +++ /dev/null @@ -1,3 +0,0 @@ -// #docregion -/// -/// diff --git a/public/docs/_examples/upgrade/ts/typescript-conversion/tsconfig.1.json b/public/docs/_examples/upgrade/ts/typescript-conversion/tsconfig.1.json index a140e5b7b3..c3cf6bcddb 100644 --- a/public/docs/_examples/upgrade/ts/typescript-conversion/tsconfig.1.json +++ b/public/docs/_examples/upgrade/ts/typescript-conversion/tsconfig.1.json @@ -8,6 +8,8 @@ "removeComments": false }, "exclude": [ - "node_modules" + "node_modules", + "typings/main.d.ts", + "typings/main" ] } diff --git a/public/docs/_examples/upgrade/ts/typescript-conversion/typings.json b/public/docs/_examples/upgrade/ts/typescript-conversion/typings.json new file mode 100644 index 0000000000..55b63ee44f --- /dev/null +++ b/public/docs/_examples/upgrade/ts/typescript-conversion/typings.json @@ -0,0 +1,10 @@ +{ + "ambientDependencies": { + "angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#3bebbe1baee04846cc46ed7249e8117e4cd7c7ff", + "angular-mocks": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-mocks.d.ts#77dd2668f85730372aa8e62152e652048e8b6b87", + "angular-resource": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-resource.d.ts#c6609aff88f2c59e4df9adb93df5c7932adfd7b4", + "angular-route": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-route.d.ts#cf172aab99c3139a718aa8e65398a22c53dd7ead", + "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee", + "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#470954c4f427e0805a2d633636a7c6aa7170def8" + } +} diff --git a/public/docs/ts/latest/guide/upgrade.jade b/public/docs/ts/latest/guide/upgrade.jade index d3db70d795..89f092aca7 100644 --- a/public/docs/ts/latest/guide/upgrade.jade +++ b/public/docs/ts/latest/guide/upgrade.jade @@ -840,28 +840,38 @@ figure of NPM. We'll install all new dependencies using NPM, and will eventually be able to remove Bower from the project. - Let's begin by installing the SystemJS and TypeScript packages to the project: - ``` + Let's begin by installing the SystemJS and TypeScript packages to the project. + While we're at it, let's also install the + [Typings type definition manager](https://github.com/typings/typings). + It will allow us to install type definitions for libraries that don't come with + prepackaged types. + +code-example(format=""). npm i systemjs --save - npm i typescript --save-dev - ``` - - The Angular 1 framework doesn't come with built-in TypeScript type definitions. - This means that if we want to have type checks for the calls we make to Angular 1 - APIs, we should install its type definitions separately. - For that we'll use the [tsd TypeScript definition manager](http://definitelytyped.org/tsd/). - Let's make sure we have it globally installed: - ``` - npm i -g tsd - ``` - - We can then use tsd to install the type definitions for Angular 1 and the Jasmine + npm i typescript typings --save-dev + +:marked + Let's also add run scripts for the `tsc` TypeScript compiler and the `typings` + tool to `package.json`: + ++makeJson('upgrade/ts/typescript-conversion/package.1.json', {paths: 'scripts'}, 'package.json', {otl: /(\"tsc.*|\"typings.*)/g}) + + +:marked + We can now use Typings to install the type definitions for Angular 1 and the Jasmine unit test framework. This will add a `typings` directory to the project and install - a number of `.d.ts` files under it: - ``` - tsd install angular angular-route angular-resource angular-mocks jasmine - ``` + a number of `.d.ts` files under it. It will also create a `typings.json` file to the + project, which contains metadata about the type definitions we've installed: +code-example(format=""). + npm run typings install jquery -- --save --ambient + npm run typings install angular -- --save --ambient + npm run typings install angular-route -- --save --ambient + npm run typings install angular-resource -- --save --ambient + npm run typings install angular-mocks -- --save --ambient + npm run typings install jasmine -- --save --ambient + +:marked In `index.html`, let's now enable SystemJS. Add a `