Skip to content

Commit

Permalink
Delete tsd.js occurrence
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehdy Dara committed Sep 7, 2015
1 parent 58e2b58 commit ea2d151
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 83 deletions.
1 change: 0 additions & 1 deletion app/src/preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ module.exports = function(GulpAngularGenerator) {
}

if(this.props.jsPreprocessor.key !== 'typescript') {
rejectWithRegexp.call(this, /tsd\.js/);
rejectWithRegexp.call(this, /tsd\.json/);
rejectWithRegexp.call(this, /tsconfig\.json/);
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ module.exports = function(GulpAngularGenerator) {
* Launch npm and bower installs unless they are skipped
*/
GulpAngularGenerator.prototype.install = function install() {

this.installDependencies({
skipInstall: this.options['skip-install'],
skipMessage: this.options['skip-message']
});

if (this.props.jsPreprocessor.key === 'typescript') {
this.spawnCommand('tsd', ['install', '-so']);
this.spawnCommandSync('tsd', ['install', '-so']);
}
};

Expand Down
49 changes: 20 additions & 29 deletions app/templates/_tsd.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,6 @@
"path": "<%- props.paths.tmp %>/typings",
"bundle": "<%- props.paths.tmp %>/typings/tsd.d.ts",
"installed": {
"angularjs/angular.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"angularjs/angular-mocks.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"jasmine/jasmine.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"karma-jasmine/karma-jasmine.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"moment/moment.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"moment/moment-node.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},

<% if (angularModulesObject.animate) { -%>
"angularjs/angular-animate.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
Expand All @@ -36,16 +17,14 @@
"angularjs/angular-sanitize.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},

<% } if (props.jQuery.key === 'jquery2') { -%>
<% } if (props.jQuery.key === 'jquery2' || props.jQuery.key === 'jquery1') { -%>
"jquery/jquery.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
<% } if (props.jQuery.key === 'zepto') { -%>
"zepto/zepto.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},

<% } if (props.resource.key === 'angular-resource') { -%>
"angularjs/angular-resource.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
Expand All @@ -54,7 +33,6 @@
"restangular/restangular.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},

<% } if (props.router.key === 'ui-router') { -%>
"angular-ui-router/angular-ui-router.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
Expand All @@ -63,11 +41,6 @@
"angularjs/angular-route.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
<% } if (props.router.key === 'new-router') { -%>
"angular2/router.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},

<% } if(props.ui.key === 'bootstrap' && props.bootstrapComponents === 'official') { -%>
"bootstrap/bootstrap.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
Expand All @@ -83,7 +56,25 @@
<% } if(props.bootstrapComponents.key === 'ui-bootstrap') { -%>
"angular-ui-bootstrap/angular-ui-bootstrap.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
}
},
<% } -%>
"angularjs/angular.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"angularjs/angular-mocks.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"jasmine/jasmine.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"karma-jasmine/karma-jasmine.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"moment/moment.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
},
"moment/moment-node.d.ts": {
"commit": "bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
}
}
}
4 changes: 0 additions & 4 deletions app/templates/gulp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ Gulp tasks which start a server for development or e2e tests.

Compile your styles with your CSS preprocessor. Use injection in the index.*

## tsd.js

Typescript specific tasks to generate Typescript descriptors.

## unit-tests.js

Task for launching the unit tests with Karma from Gulp.
Expand Down
6 changes: 3 additions & 3 deletions app/templates/gulp/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ gulp.task('other', function () {
.pipe(gulp.dest(path.join(conf.paths.dist, '/')));
});

gulp.task('clean', function (done) {
<% if (props.jsPreprocessor.key === 'typescript') { -%>
gulp.task('clean', ['tsd:purge'], function (done) {
$.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/partials'), path.join(conf.paths.tmp, '/serve')], done);
<% } else { -%>
gulp.task('clean', function (done) {
<% } -%>
$.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')], done);
<% } -%>
});

<% if (imageMin) { -%>
Expand Down
8 changes: 0 additions & 8 deletions app/templates/gulp/_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,15 @@ function webpackWrapper(watch, test, callback) {
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app')));
}

<% if (props.jsPreprocessor.key === 'typescript') { -%>
gulp.task('scripts', ['tsd:install'], function () {
<% } else { -%>
gulp.task('scripts', function () {
<% } -%>
return webpackWrapper(false, false);
});

gulp.task('scripts:watch', ['scripts'], function (callback) {
return webpackWrapper(true, false, callback);
});

<% if (props.jsPreprocessor.key === 'typescript') { -%>
gulp.task('scripts:test', ['tsd:install'], function () {
<% } else { -%>
gulp.task('scripts:test', function () {
<% } -%>
return webpackWrapper(false, true);
});

Expand Down
6 changes: 3 additions & 3 deletions app/templates/src/app/_newrouter/__newrouter.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/** @ngInject */
export function routerConfig($componentLoaderProvider) {
$componentLoaderProvider.setTemplateMapping(function(name) {
export function routerConfig($componentLoaderProvider: any) {
$componentLoaderProvider.setTemplateMapping(function(name: String) {
return 'app/' + name + '/' + name + '.html';
});
}

/** @ngInject */
export class RouterController {
constructor($router) {
constructor($router: any) {
$router.config([
{ path: '/', component: 'main' }
]);
Expand Down
15 changes: 7 additions & 8 deletions test/node/test-preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('gulp-angular generator preprocessors script', function () {
{ src: 'gulp/styles.js' },
{ src: 'gulp/scripts.js' },
{ src: 'gulp/markups.js' },
{ src: 'gulp/tsd.js' },
{ src: 'index.constants.js' },
{ src: 'tsd.json' }
];
Expand Down Expand Up @@ -88,7 +87,7 @@ describe('gulp-angular generator preprocessors script', function () {
htmlPreprocessor: { key: 'not none' }
};
generator.rejectFiles();
generator.files.length.should.be.equal(5);
generator.files.length.should.be.equal(4);
});
});

Expand All @@ -98,38 +97,38 @@ describe('gulp-angular generator preprocessors script', function () {
jsPreprocessor: { key: 'coffee' }
};
generator.lintCopies();
generator.files[6].src.should.match(/coffeelint/);
generator.files[5].src.should.match(/coffeelint/);
});

it('should add tslint for typescript preprocessor', function() {
generator.props = {
jsPreprocessor: { key: 'typescript' }
};
generator.lintCopies();
generator.files[6].src.should.match(/tslint/);
generator.files[5].src.should.match(/tslint/);
});
});

describe('add travis files', function() {
it('should not add file if there is no travis env', function() {
process.env.TRAVIS = 'false';
generator.travisCopies();
generator.files.length.should.be.equal(6);
generator.files.length.should.be.equal(5);
});

it('should not add file if travis but no typescript', function() {
process.env.TRAVIS = 'true';
generator.props = { jsPreprocessor: { key: 'not typescript' } };
generator.travisCopies();
generator.files.length.should.be.equal(6);
generator.files.length.should.be.equal(5);
});

it('should add file if travis and typescript', function() {
process.env.TRAVIS = 'true';
generator.props = { jsPreprocessor: { key: 'typescript' } };
generator.travisCopies();
generator.files.length.should.be.equal(7);
generator.files[6].src.should.match(/tsdrc/);
generator.files.length.should.be.equal(6);
generator.files[5].src.should.match(/tsdrc/);
});
});

Expand Down
4 changes: 2 additions & 2 deletions test/node/test-writes.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ describe('gulp-angular generator writes script', function () {
key: 'typescript'
}
};
generator.spawnCommand = sinon.stub();
generator.spawnCommandSync = sinon.stub();
generator.install();
generator.spawnCommand.should.have.been.calledWith('tsd', ['install', '-so']);
generator.spawnCommandSync.should.have.been.calledWith('tsd', ['install', '-so']);
});
});

Expand Down
12 changes: 4 additions & 8 deletions test/template/test-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,10 @@ describe('gulp-angular build template', function () {
result.should.match(/\$\.imagemin/);
});

it('should add tsd:purge in clean dependencies for typescript', function() {
model.props.jsPreprocessor.key = 'noJsPrepro';
var result = build(model);
result.should.not.match(/tsd:purge/);

it('should specify directory paths in clean task for typescript', function() {
model.props.jsPreprocessor.key = 'typescript';
result = build(model);
result.should.match(/'clean', \['tsd:purge'\],/);
var result = build(model);
result.should.match(/conf.paths.tmp, '\/partials'/);
result.should.match(/conf.paths.tmp, '\/serve'/);
});

});
10 changes: 0 additions & 10 deletions test/template/test-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ describe('gulp-angular scripts template', function () {
model = mockModel();
});

it('should add tsd:install as dependencies for typescript', function() {
model.props.jsPreprocessor.key = 'not typescript';
var result = scripts(model);
result.should.match(/gulp\.task\('scripts', function/);

model.props.jsPreprocessor.key = 'typescript';
result = scripts(model);
result.should.match(/gulp\.task\('scripts', \['tsd:install'\]/);
});

it('should add the right js preprocessor process', function() {
model.props.jsPreprocessor.key = 'noJsPrepro';
var result = scripts(model);
Expand Down
6 changes: 0 additions & 6 deletions test/template/test-tsd.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ describe('gulp-angular tsd template', function () {
result.should.match(/angularjs\/angular-route.d.ts/);
});

it('should insert new router Angular definition', function() {
model.props.router.key = 'new-router';
var result = tsd(model);
result.should.match(/angular2\/router.d.ts/);
});

it('should insert Bootstrap definition', function() {
model.props.ui.key = 'bootstrap';
model.props.bootstrapComponents = 'official';
Expand Down

0 comments on commit ea2d151

Please sign in to comment.