Skip to content

Commit c94f78f

Browse files
committed
chore(app): tsd -> typings
(fix webdriver-update for diff npm versions) closes #1803 [2a46b5d] b
1 parent 55c9a18 commit c94f78f

7 files changed

+61
-116
lines changed

Diff for: templates/app/Gruntfile(grunt).js

+7-19
Original file line numberDiff line numberDiff line change
@@ -664,19 +664,8 @@ module.exports = function(grunt) {
664664
}
665665
},
666666

667-
tsd: {
668-
install: {
669-
options: {
670-
command: 'reinstall',
671-
config: './tsd.json'
672-
}
673-
},
674-
install_test: {
675-
options: {
676-
command: 'reinstall',
677-
config: './tsd_test.json'
678-
}
679-
}
667+
typings: {
668+
install: {}
680669
},<% } %><% if(filters.stylus) { %>
681670

682671
// Compiles Stylus to CSS
@@ -856,7 +845,7 @@ module.exports = function(grunt) {
856845
'clean:server',
857846
'env:all',
858847
'concurrent:pre',<% if(filters.ts) { %>
859-
'tsd',<% } %>
848+
'typings',<% } %>
860849
'concurrent:server',
861850
'injector',
862851
'wiredep:client',
@@ -869,7 +858,7 @@ module.exports = function(grunt) {
869858
'clean:server',
870859
'env:all',
871860
'concurrent:pre',<% if(filters.ts) { %>
872-
'tsd',<% } %>
861+
'typings',<% } %>
873862
'concurrent:server',
874863
'injector',
875864
'wiredep:client',
@@ -901,7 +890,7 @@ module.exports = function(grunt) {
901890
'concurrent:pre',<% if(filters.ts) { %>
902891
'ts:client',
903892
'ts:client_test',
904-
'tsd',<% } %>
893+
'typings',<% } %>
905894
'concurrent:test',
906895
'injector',
907896
'postcss',
@@ -923,8 +912,7 @@ module.exports = function(grunt) {
923912
'env:all',
924913
'env:test',
925914
'concurrent:pre',<% if(filters.ts) { %>
926-
'tsd:install',
927-
'tsd:install_test',
915+
'typings',
928916
'ts:client',
929917
'ts:client_test',<% } %>
930918
'concurrent:test',
@@ -971,7 +959,7 @@ module.exports = function(grunt) {
971959
grunt.registerTask('build', [
972960
'clean:dist',
973961
'concurrent:pre',<% if(filters.ts) { %>
974-
'tsd',<% } %>
962+
'typings',<% } %>
975963
'concurrent:dist',
976964
'injector',
977965
'wiredep:client',

Diff for: templates/app/_package.json

+12-6
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,17 +168,23 @@
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",
175176
"npm": "^2.14.20"
176177
},
177-
"scripts": {
178-
"start": "node server",<% if(filters.gulp) { %>
178+
"scripts": {<% if(filters.gulp) { %>
179179
"test": "gulp test",<% } else { %>
180180
"test": "grunt test",<% } %>
181-
"update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update"
181+
<%_ if(filters.ts) { _%>
182+
"postinstall": "./node_modules/.bin/typings install",<% } %>
183+
<%_ if(semver.satisfies(npmVersion, '>= 3')) { _%>
184+
"update-webdriver": "node node_modules/protractor/bin/webdriver-manager update",
185+
<%_ } else { _%>
186+
"update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update",<% } %>
187+
"start": "node server"
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

+4-7
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
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",
9-
"client/typings/**/*.d.ts"
10+
"typings/main.d.ts"
1011
],
1112
"files": [
1213
"client/app/account/account.ts",
@@ -36,10 +37,6 @@
3637
"client/components/ui-router/ui-router.mock.ts",
3738
"client/components/util/util.module.ts",
3839
"client/components/util/util.service.ts",
39-
"client/typings/angularjs/angular.d.ts",
40-
"client/typings/jquery/jquery.d.ts",
41-
"client/typings/lodash/lodash.d.ts",
42-
"client/typings/socket.io-client/socket.io-client.d.ts",
43-
"client/typings/tsd.d.ts"
40+
"typings/main.d.ts"
4441
]
4542
}

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)