Skip to content

Commit 7dd3000

Browse files
committed
chore(app): tsd -> typings
(fix webdriver-update for diff npm versions) closes #1803
1 parent f8e1ead commit 7dd3000

File tree

6 files changed

+50
-89
lines changed

6 files changed

+50
-89
lines changed

Diff for: templates/app/_package.json

+10-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"gulp-autoprefixer": "^3.1.0",
5151
"gulp-babel": "^6.1.2",<% if(filters.ts) { %>
5252
"gulp-typescript": "~2.13.0",
53-
"gulp-tsd": "~0.1.0",
53+
"gulp-typings": "^1.3.6",
5454
"gulp-tslint": "^5.0.0",<% } %>
5555
"gulp-cache": "^0.4.2",
5656
"gulp-concat": "^2.6.0",
@@ -113,7 +113,7 @@
113113
"grunt-contrib-less": "^1.2.0",<% } %>
114114
"grunt-babel": "~6.0.0",<% if(filters.ts) { %>
115115
"grunt-ts": "^5.3.2",
116-
"grunt-tsd": "~0.1.0",
116+
"grunt-typings": "~0.1.4",
117117
"grunt-tslint": "~3.1.0",<% } %>
118118
"grunt-google-cdn": "~0.4.0",
119119
"grunt-jscs": "^2.1.0",
@@ -168,7 +168,8 @@
168168
"phantomjs-prebuilt": "^2.1.4",
169169
"proxyquire": "^1.0.1",
170170
"supertest": "^1.1.0"<% if(filters.ts) { %>,
171-
"tslint": "^3.5.0"<% } %>
171+
"tslint": "^3.5.0",
172+
"typings": "^0.8.1"<% } %>
172173
},
173174
"engines": {
174175
"node": "^4.4.0",
@@ -178,7 +179,12 @@
178179
"start": "node server",<% if(filters.gulp) { %>
179180
"test": "gulp test",<% } else { %>
180181
"test": "grunt test",<% } %>
181-
"update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update"
182+
<%_ if(filters.ts) { _%>
183+
"postinstall": "./node_modules/.bin/typings install",<% } _%>
184+
<%_ if(semver.satisfies(npmVersion, '>= 3')) { _%>
185+
"update-webdriver": "node node_modules/protractor/bin/webdriver-manager update"
186+
<%_ } else { _%>
187+
"update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update"<% } _%>
182188
},
183189
"private": true
184190
}

Diff for: templates/app/gulpfile.babel(gulp).js

+18-30
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,8 @@ function injectTsConfig(filesGlob, tsconfigPath){
245245
gulp.task('inject:tsconfig', () => {
246246
return injectTsConfig([
247247
`${clientPath}/**/!(*.spec|*.mock).ts`,
248-
`!${clientPath}/bower_components/**/*`,
249-
`${clientPath}/typings/**/*.d.ts`,
250-
`!${clientPath}/test_typings/**/*.d.ts`
248+
`!${clientPath}/bower_components/**/*`,
249+
`typings/main.d.ts`
251250
],
252251
'./tsconfig.client.json');
253252
});
@@ -256,8 +255,7 @@ gulp.task('inject:tsconfigTest', () => {
256255
return injectTsConfig([
257256
`${clientPath}/**/+(*.spec|*.mock).ts`,
258257
`!${clientPath}/bower_components/**/*`,
259-
`!${clientPath}/typings/**/*.d.ts`,
260-
`${clientPath}/test_typings/**/*.d.ts`
258+
`typings/main.d.ts`
261259
],
262260
'./tsconfig.client.test.json');
263261
});<% } %>
@@ -298,25 +296,17 @@ gulp.task('inject:<%= styleExt %>', () => {
298296
});<% } %><% if(filters.ts) { %>
299297

300298
// Install DefinitelyTyped TypeScript definition files
301-
gulp.task('tsd', cb => {
302-
plugins.tsd({
303-
command: 'reinstall',
304-
config: './tsd.json'
305-
}, cb);
306-
});
307-
308-
gulp.task('tsd:test', cb => {
309-
plugins.tsd({
310-
command: 'reinstall',
311-
config: './tsd_test.json'
312-
}, cb);
299+
gulp.task('typings', () => {
300+
return gulp.src("./typings.json")
301+
.pipe(plugins.typings());
313302
});<% } %>
314303

315304
gulp.task('styles', () => {
316305
<%_ if(!filters.css) { _%>
317306
return gulp.src(paths.client.mainStyle)
318307
<%_ } else { _%>
319-
return gulp.src(paths.client.styles)<% } %>
308+
return gulp.src(paths.client.styles)
309+
<%_ } _%>
320310
.pipe(styles())
321311
.pipe(gulp.dest('.tmp/app'));
322312
});<% if(filters.ts) { %>
@@ -326,20 +316,18 @@ gulp.task('copy:constant', ['constant'], () => {
326316
.pipe(gulp.dest('.tmp/app'));
327317
})
328318

329-
gulp.task('transpile:client', ['tsd', 'copy:constant'], () => {
330-
let tsProject = plugins.typescript.createProject('./tsconfig.client.json');
331-
return tsProject.src()
319+
gulp.task('transpile:client', ['typings', 'copy:constant'], () => {
320+
return gulp.src(['client/{app,components}/**/!(*.spec|*.mock).ts', 'typings/main.d.ts'])
332321
.pipe(plugins.sourcemaps.init())
333-
.pipe(plugins.typescript(tsProject)).js
322+
.pipe(plugins.typescript()).js
334323
.pipe(plugins.sourcemaps.write('.'))
335324
.pipe(gulp.dest('.tmp'));
336325
});
337326

338-
gulp.task('transpile:client:test', ['tsd:test'], () => {
339-
let tsTestProject = plugins.typescript.createProject('./tsconfig.client.test.json');
340-
return tsTestProject.src()
327+
gulp.task('transpile:client:test', ['typings'], () => {
328+
return gulp.src(['client/{app,components}/**/+(*.spec|*.mock).ts', 'typings/main.d.ts'])
341329
.pipe(plugins.sourcemaps.init())
342-
.pipe(plugins.typescript(tsTestProject)).js
330+
.pipe(plugins.typescript()).js
343331
.pipe(plugins.sourcemaps.write('.'))
344332
.pipe(gulp.dest('.tmp/test'));
345333
});<% } %><% if(filters.babel) { %>
@@ -448,7 +436,7 @@ gulp.task('watch', () => {
448436
.pipe(gulp.dest('.tmp'))
449437
.pipe(plugins.livereload());<% } %><% if(filters.ts) { %>
450438

451-
gulp.watch(paths.client.scripts, ['inject:tsconfig', 'lint:scripts:client', 'transpile:client']);<% } %>
439+
gulp.watch(paths.client.scripts, ['lint:scripts:client', 'transpile:client']);<% } %>
452440

453441
plugins.watch(_.union(paths.server.scripts, testFiles))
454442
.pipe(plugins.plumber())
@@ -459,7 +447,7 @@ gulp.task('watch', () => {
459447
});
460448

461449
gulp.task('serve', cb => {
462-
runSequence(['clean:tmp', 'constant', 'env:all'<% if(filters.ts) { %>, 'tsd'<% } %>],
450+
runSequence(['clean:tmp', 'constant', 'env:all'<% if(filters.ts) { %>, 'typings'<% } %>],
463451
['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>],
464452
['wiredep:client'],
465453
['transpile:client', 'styles'],
@@ -478,7 +466,7 @@ gulp.task('serve:dist', cb => {
478466
});
479467

480468
gulp.task('serve:debug', cb => {
481-
runSequence(['clean:tmp', 'constant'<% if(filters.ts) { %>, 'tsd'<% } %>],
469+
runSequence(['clean:tmp', 'constant'<% if(filters.ts) { %>, 'typings'<% } %>],
482470
['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>],
483471
['wiredep:client'],
484472
['transpile:client', 'styles'],
@@ -568,7 +556,7 @@ gulp.task('build', cb => {
568556
'jade',<% } %>
569557
'inject',
570558
'wiredep:client',<% if(filters.ts) { %>
571-
'tsd',<% } %>
559+
'typings',<% } %>
572560
[
573561
'build:images',
574562
'copy:extras',

Diff for: templates/app/tsconfig.client(ts).json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"compilerOptions": {
33
"sourceMap": true,
44
"rootDir": "./client",
5-
"outDir": ".tmp"
5+
"outDir": ".tmp",
6+
"target": "ES5"
67
},
78
"filesGlob": [
89
"client/{app,components}/**/!(*.spec).ts",

Diff for: templates/app/tsd(ts).json

-21
This file was deleted.

Diff for: templates/app/tsd_test(ts).json

-33
This file was deleted.

Diff for: templates/app/typings.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"ambientDependencies": {
3+
"angular": "registry:dt/angular#1.5.0+20160412133217",
4+
"jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe",
5+
"lodash": "github:DefinitelyTyped/DefinitelyTyped/lodash/lodash.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe",
6+
"socket.io-client": "github:DefinitelyTyped/DefinitelyTyped/socket.io-client/socket.io-client.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"
7+
},
8+
"ambientDevDependencies": {
9+
"angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe",
10+
"selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe",
11+
<%_ if(filters.mocha) { _%>
12+
"mocha": "github:DefinitelyTyped/DefinitelyTyped/mocha/mocha.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe",
13+
"chai": "github:DefinitelyTyped/DefinitelyTyped/chai/chai.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe",
14+
"assertion-error": "github:DefinitelyTyped/DefinitelyTyped/assertion-error/assertion-error.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe",
15+
"sinon": "github:DefinitelyTyped/DefinitelyTyped/sinon/sinon.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe",
16+
"sinon-chai": "github:DefinitelyTyped/DefinitelyTyped/sinon-chai/sinon-chai.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"<% } %>
17+
<%_ if(filters.jasmine) { _%>
18+
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"<% } %>
19+
}
20+
}

0 commit comments

Comments
 (0)