Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ This task will launch the CoffeeLint analyze and the Coffee compilation and put

### With TypeScript

The `scripts` task has a dependency which is the installation of typings with the `tsd:install` gulp task. Once the typings ready, TSLint, TypeScript compilation and finally a concatenation of all JavaScript files produced in the right order are done.
The `scripts` task has a dependency which is the installation of typings with the `typings:install` gulp task. Once the typings ready, TSLint, TypeScript compilation and finally a concatenation of all JavaScript files produced in the right order are done.

`tsd:install` is located in the `gulp/tsd.js` which is created only when choosing TypeScript. It will automatically download typings files for the dependency found in Bower with a popular library [TSD](http://definitelytyped.org/tsd/)
`typings:install` is located in the `gulp/typings.js` which is created only when choosing TypeScript. It will automatically download typings files for the
dependency found in Bower with a popular library [Typings](https://github.com/typings/typings)

### With ES6

Expand Down
2 changes: 1 addition & 1 deletion generators/app/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

"package.json",
"bower.json",
"tsd.json",
"typings.json",

"karma.conf.js",

Expand Down
6 changes: 3 additions & 3 deletions generators/app/src/preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = function (GulpAngularGenerator) {
}

if (this.props.jsPreprocessor.key !== 'typescript') {
rejectWithRegexp.call(this, /tsd\.json/);
rejectWithRegexp.call(this, /typings\.json/);
rejectWithRegexp.call(this, /tsconfig\.json/);
}

Expand Down Expand Up @@ -108,8 +108,8 @@ module.exports = function (GulpAngularGenerator) {
if (this.props.jsPreprocessor.key === 'typescript') {

this.files.push({
src: '.tsdrc',
dest: '.tsdrc',
src: '.typingsrc',
dest: '.typingsrc',
template: false
});
}
Expand Down
2 changes: 1 addition & 1 deletion generators/app/src/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function (GulpAngularGenerator) {
});

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

Expand Down
4 changes: 2 additions & 2 deletions generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
"traceur-loader": "~0.6.3",
<% } if (props.jsPreprocessor.key === 'typescript') { -%>
"typescript": "~1.6.2",
"awesome-typescript-loader": "~0.14.0",
"ts-loader": "~0.8.0",
"tslint-loader": "~1.0.2",
"tsd": "~0.6.5",
"typings": "~0.6.6",
<% } else if (props.jsPreprocessor.srcExtension !== 'es6') { -%>
"gulp-angular-filesort": "~1.1.1",
<% } if (props.htmlPreprocessor.key !== 'noHtmlPrepro') { -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "<%- props.paths.tmp %>/typings",
"bundle": "<%- props.paths.tmp %>/typings/tsd.d.ts",
"bundle": "<%- props.paths.tmp %>/typings/main.d.ts",
"installed": {
<% if (angularModulesObject.animate) { -%>
"angularjs/angular-animate.d.ts": {
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/gulp/_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function webpackWrapper(watch, test, callback) {
<% } if (props.jsPreprocessor.key === 'traceur') { -%>
loaders: [{ test: /\.js$/, exclude: /node_modules/, loaders: ['ng-annotate', 'traceur-loader']}]
<% } if (props.jsPreprocessor.key === 'typescript') { -%>
loaders: [{ test: /\.ts$/, exclude: /node_modules/, loaders: ['ng-annotate', 'awesome-typescript-loader']}]
loaders: [{ test: /\.ts$/, exclude: /node_modules/, loaders: ['ng-annotate', 'ts-loader']}]
<% } -%>
},
output: { filename: 'index.module.js' }
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/src/app/_index.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path="../../<%- props.paths.tmp %>/typings/tsd.d.ts" />
/// <reference path="../../<%- props.paths.tmp %>/typings/main.d.ts" />

import { config } from './index.config';
<% if (props.router.key === 'new-router') { -%>
Expand Down
4 changes: 2 additions & 2 deletions test/node/test-preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('gulp-angular generator preprocessors script', function () {
{ src: 'gulp/scripts.js' },
{ src: 'gulp/markups.js' },
{ src: 'index.constants.js' },
{ src: 'tsd.json' }
{ src: 'typings.json' }
];
});

Expand Down Expand Up @@ -128,7 +128,7 @@ describe('gulp-angular generator preprocessors script', function () {
generator.props = { jsPreprocessor: { key: 'typescript' } };
generator.travisCopies();
generator.files.length.should.be.equal(6);
generator.files[5].src.should.match(/tsdrc/);
generator.files[5].src.should.match(/typingsrc/);
});
});

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 @@ -114,7 +114,7 @@ describe('gulp-angular generator writes script', function () {
});
});

it('should call TSD install with Typescript preprocessor', function () {
it('should call Typings install with Typescript preprocessor', function () {
generator.options = {
'skip-install': false,
'skip-message': false
Expand All @@ -126,7 +126,7 @@ describe('gulp-angular generator writes script', function () {
};
generator.spawnCommandSync = sinon.stub();
generator.install();
generator.spawnCommandSync.should.have.been.calledWith('tsd', ['install', '-so']);
generator.spawnCommandSync.should.have.been.calledWith('typings', ['install', '-s']);
});
});

Expand Down
16 changes: 8 additions & 8 deletions test/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/template/test-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('gulp-angular scripts template', function () {
model.props.jsPreprocessor.extension = 'ts';
result = scripts(model);
result.should.match(/function webpackWrapper\(watch, test, callback\)/);
result.should.match(/loaders:.*loaders: \['ng-annotate', 'awesome-typescript-loader'/);
result.should.match(/loaders:.*loaders: \['ng-annotate', 'ts-loader'/);
result.should.match(/gulp\.task\('scripts:watch'/);
result.should.not.match(/babel/);
result.should.not.match(/traceur/);
Expand Down
34 changes: 17 additions & 17 deletions test/template/test-tsd.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ chai.use(sinonChai);
var templateTools = require('../template-tools');
var mockModel = require('./mock-model');

describe('gulp-angular tsd template', function () {
var tsd;
describe('gulp-angular typings template', function () {
var typings;
var model;

before(function () {
return templateTools.load('_tsd.json')
return templateTools.load('_typings.json')
.then(function (templateModule) {
tsd = templateModule;
typings = templateModule;
});
});

Expand All @@ -25,14 +25,14 @@ describe('gulp-angular tsd template', function () {

it('should insert tmp directory', function () {
model.props.paths.tmp = 'test/tmp/dir';
var result = tsd(model);
var result = typings(model);
result.should.match(/"path": "test\/tmp\/dir/);
result.should.match(/"bundle": "test\/tmp\/dir/);
});

it('should insert default definitions', function () {
model.props.paths.tmp = 'test/tmp/dir';
var result = tsd(model);
var result = typings(model);
result.should.match(/angularjs\/angular.d.ts/);
result.should.match(/angularjs\/angular-mocks.d.ts/);
result.should.match(/jasmine\/jasmine.d.ts/);
Expand All @@ -46,71 +46,71 @@ describe('gulp-angular tsd template', function () {
cookies: true,
sanitize: true
};
var result = tsd(model);
var result = typings(model);
result.should.match(/angularjs\/angular-animate.d.ts/);
result.should.match(/angularjs\/angular-cookies.d.ts/);
result.should.match(/angularjs\/angular-sanitize.d.ts/);
});

it('should insert jQuery definition', function () {
model.props.jQuery.key = 'jquery2';
var result = tsd(model);
var result = typings(model);
result.should.match(/jquery\/jquery.d.ts/);
});

it('should insert Zepto definition', function () {
model.props.jQuery.key = 'zepto';
var result = tsd(model);
var result = typings(model);
result.should.match(/zepto\/zepto.d.ts/);
});

it('should insert ngResource definition', function () {
model.props.resource.key = 'angular-resource';
var result = tsd(model);
var result = typings(model);
result.should.match(/angularjs\/angular-resource.d.ts/);
});

it('should insert Restangular definition', function () {
model.props.resource.key = 'restangular';
var result = tsd(model);
var result = typings(model);
result.should.match(/restangular\/restangular.d.ts/);
});

it('should insert UI-Router definition', function () {
model.props.router.key = 'ui-router';
var result = tsd(model);
var result = typings(model);
result.should.match(/angular-ui-router\/angular-ui-router.d.ts/);
});

it('should insert ngRoute definition', function () {
model.props.router.key = 'angular-route';
var result = tsd(model);
var result = typings(model);
result.should.match(/angularjs\/angular-route.d.ts/);
});

it('should insert Bootstrap definition', function () {
model.props.ui.key = 'bootstrap';
model.props.bootstrapComponents = 'official';
var result = tsd(model);
var result = typings(model);
result.should.match(/bootstrap\/bootstrap.d.ts/);
});

it('should insert Foundation definition', function () {
model.props.ui.key = 'foundation';
model.props.foundationComponents = 'official';
var result = tsd(model);
var result = typings(model);
result.should.match(/foundation\/foundation.d.ts/);
});

it('should insert Angular-Mateiral definition', function () {
model.props.ui.key = 'angular-material';
var result = tsd(model);
var result = typings(model);
result.should.match(/angular-material\/angular-material.d.ts/);
});

it('should insert UI-Bootstrap definition', function () {
model.props.ui.key = 'angular-material';
var result = tsd(model);
var result = typings(model);
result.should.match(/angular-ui-bootstrap\/angular-ui-bootstrap.d.ts/);
});
});