Skip to content

Commit 3d22394

Browse files
authored
feat: use @types instead of typings (#1449)
1 parent 8a2e0e5 commit 3d22394

13 files changed

+31
-319
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,13 @@ ng new sassy-project --style=sass
265265

266266
Simply install your library via `npm install lib-name` and import it in your code.
267267

268-
If the library does not include typings, you can search and install them using `npm run typings` npm script provided:
268+
If the library does not include typings, you can install them using npm:
269269

270270
```bash
271271
npm install moment
272-
npm run typings -- search moment
273-
npm run typings -- install dt~moment --global
272+
npm install @types/moment
274273
```
275274

276-
See https://github.com/typings/typings for more information about the `typings` tool.
277-
278275
### Updating angular-cli
279276

280277
To update `angular-cli` to a new version, you must update both the global package and your project's local package.

addon/ng2/blueprints/ng2/files/__path__/tsconfig.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
"moduleResolution": "node",
1010
"outDir": "<%= relativeRootPath %>/dist/out-tsc",
1111
"sourceMap": true,
12-
"target": "es5"
12+
"target": "es5",
13+
"typeRoots": [
14+
"../node_modules/@types"
15+
],
16+
"types": [
17+
"jasmine"
18+
]
1319
}
1420
}

addon/ng2/blueprints/ng2/files/__path__/typings.d.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
// https://github.com/typings/typings
33
// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
44

5-
/// <reference path="<%= relativeRootPath %>/typings/index.d.ts" />
6-
<% if(!isMobile) { %>
75
declare var System: any;
8-
<% if(!isMobile) { %>declare var module: { id: string };<% } %>
6+
declare var module: { id: string };
97
declare var require: any;
10-
<% } %>
118

addon/ng2/blueprints/ng2/files/config/karma.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/0.13/config/configuration-file.html
3+
14
module.exports = function (config) {
25
config.set({
36
basePath: '..',
@@ -22,7 +25,7 @@ module.exports = function (config) {
2225
'./src/test.ts': ['angular-cli']
2326
},
2427
angularCliConfig: './angular-cli.json',
25-
reporters: ['progress'],
28+
reporters: ['coverage', 'progress'],
2629
port: 9876,
2730
colors: true,
2831
logLevel: config.LOG_INFO,

addon/ng2/blueprints/ng2/files/e2e/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"moduleResolution": "node",
99
"outDir": "../dist/out-tsc-e2e",
1010
"sourceMap": true,
11-
"target": "es5"
11+
"target": "es5",
12+
"typeRoots": [
13+
"../node_modules/@types"
14+
]
1215
}
1316
}

addon/ng2/blueprints/ng2/files/e2e/typings.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

addon/ng2/blueprints/ng2/files/package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
"angular-cli": {},
66
"scripts": {
77
"start": "ng serve",
8-
"postinstall": "typings install",
98
"lint": "tslint \"<%= sourceDir %>/**/*.ts\"",
109
"test": "ng test",
1110
"pree2e": "webdriver-manager update",
12-
"e2e": "protractor",
13-
"typings": "typings"
11+
"e2e": "protractor"
1412
},
1513
"private": true,
1614
"dependencies": {
@@ -36,19 +34,19 @@
3634
"angular2-universal-polyfills": "0.4.1",
3735
"preboot": "2.1.2",
3836
"parse5": "1.5.1",<% } %>
37+
"@types/jasmine": "^2.2.30",
38+
"@types/protractor": "^1.5.16",
3939
"angular-cli": "^<%= version %>",
40-
"codelyzer": "0.0.20",
41-
"ember-cli-inject-live-reload": "1.4.0",
40+
"codelyzer": "0.0.26",
4241
"jasmine-core": "2.4.1",
4342
"jasmine-spec-reporter": "2.5.0",
4443
"karma": "0.13.22",
4544
"karma-chrome-launcher": "0.2.3",
4645
"karma-coverage": "^1.0.0",
4746
"karma-jasmine": "0.3.8",
4847
"protractor": "3.3.0",
49-
"ts-node": "0.9.1",
50-
"tslint": "3.11.0",
51-
"typescript": "^1.9.0-dev.20160627-1.0",
52-
"typings": "^1.3.1"
48+
"ts-node": "1.2.1",
49+
"tslint": "3.13.0",
50+
"typescript": "^2.0.0"
5351
}
5452
}

addon/ng2/blueprints/ng2/files/typings.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

addon/ng2/models/webpack-build-common.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,14 @@ import * as CopyWebpackPlugin from 'copy-webpack-plugin';
33
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
44
import * as webpack from 'webpack';
55
import { ForkCheckerPlugin } from 'awesome-typescript-loader';
6-
import { LoaderConfig, PathsPlugin } from '../utilities/ts-path-mappings-webpack-plugin';
76
import { CliConfig } from './config';
87

98
export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
10-
const awesomeTypescriptLoaderConfig: LoaderConfig | any = {
11-
useWebpackText: true,
12-
useForkChecker: true,
13-
tsconfig: path.resolve(projectRoot, `./${sourceDir}/tsconfig.json`)
14-
}
15-
169
return {
1710
devtool: 'inline-source-map',
1811
resolve: {
1912
extensions: ['', '.ts', '.js'],
20-
root: path.resolve(projectRoot, `./${sourceDir}`),
21-
moduleDirectories: ['node_modules'],
22-
plugins: [
23-
new PathsPlugin(awesomeTypescriptLoaderConfig);
24-
]
13+
root: path.resolve(projectRoot, `./${sourceDir}`)
2514
},
2615
context: path.resolve(__dirname, './'),
2716
entry: {
@@ -49,7 +38,10 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
4938
loaders: [
5039
{
5140
loader: 'awesome-typescript-loader',
52-
query: awesomeTypescriptLoaderConfig
41+
query: {
42+
useForkChecker: true,
43+
tsconfig: path.resolve(projectRoot, `./${sourceDir}/tsconfig.json`)
44+
}
5345
},
5446
{
5547
loader: 'angular2-template-loader'

addon/ng2/models/webpack-build-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
4242
{
4343
loader: 'awesome-typescript-loader',
4444
query: {
45-
useWebpackText: true,
4645
tsconfig: path.resolve(projectRoot, `./${sourceDir}/tsconfig.json`),
4746
module: 'commonjs',
4847
target: 'es5',

0 commit comments

Comments
 (0)