Skip to content
Merged
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
3 changes: 0 additions & 3 deletions generators/app/templates/.tsdrc

This file was deleted.

2 changes: 1 addition & 1 deletion generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"typescript": "~1.6.2",
"ts-loader": "~0.8.0",
"tslint-loader": "~1.0.2",
"tsd": "~0.6.5",
"typings": "~0.7.9",
<% } else if (props.jsPreprocessor.srcExtension !== 'es6') { -%>
"gulp-angular-filesort": "~1.1.1",
<% } if (props.htmlPreprocessor.key !== 'noHtmlPrepro') { -%>
Expand Down
80 changes: 0 additions & 80 deletions generators/app/templates/_tsd.json

This file was deleted.

39 changes: 39 additions & 0 deletions generators/app/templates/_typings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "<%- appName %>",
"version": false,
"ambientDependencies": {
<% if (angularModulesObject.animate) { -%>
"angular-animate": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-animate.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if (angularModulesObject.cookies) { -%>
"angular-cookies": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-cookies.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if (angularModulesObject.sanitize) { -%>
"angular-sanitize": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-sanitize.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } -%>
"jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% if (props.jQuery.key === 'zepto') { -%>
"zepto": "github:DefinitelyTyped/DefinitelyTyped/zepto/zepto.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if (props.resource.key === 'angular-resource') { -%>
"angular-resource": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-resource.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if (props.resource.key === 'restangular') { -%>
"restangular": "github:DefinitelyTyped/DefinitelyTyped/restangular/restangular.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if (props.router.key === 'ui-router') { -%>
"angular-ui-router": "github:DefinitelyTyped/DefinitelyTyped/angular-ui-router/angular-ui-router.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if (props.router.key === 'angular-route') { -%>
"angular-route": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-route.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if(props.ui.key === 'bootstrap' && props.bootstrapComponents === 'official') { -%>
"bootstrap": "github:DefinitelyTyped/DefinitelyTyped/bootstrap/bootstrap.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if(props.ui.key === 'foundation' && props.foundationComponents === 'official') { -%>
"foundation": "github:DefinitelyTyped/DefinitelyTyped/foundation/foundation.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if(props.ui.key === 'angular-material') { -%>
"angular-material": "github:DefinitelyTyped/DefinitelyTyped/angular-material/angular-material.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } if(props.bootstrapComponents.key === 'ui-bootstrap') { -%>
"ui-bootstrap": "github:DefinitelyTyped/DefinitelyTyped/angular-ui-bootstrap/angular-ui-bootstrap.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
<% } -%>
"angular-mocks": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular-mocks.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
"angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
"karma-jasmine": "github:DefinitelyTyped/DefinitelyTyped/karma-jasmine/karma-jasmine.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
"moment-node": "github:DefinitelyTyped/DefinitelyTyped/moment/moment-node.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2",
"moment": "github:DefinitelyTyped/DefinitelyTyped/moment/moment.d.ts#bb051830df88f5a55dcf06b7fe85bf6b62cc97f2"
}
}
116 changes: 0 additions & 116 deletions test/template/test-tsd.js

This file was deleted.

116 changes: 116 additions & 0 deletions test/template/test-typings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
'use strict';

var chai = require('chai');
var sinonChai = require('sinon-chai');
chai.should();
chai.use(sinonChai);

var templateTools = require('../template-tools');
var mockModel = require('./mock-model');

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

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

beforeEach(function () {
model = mockModel();
});

it('should insert tmp directory', function () {
model.props.paths.tmp = 'test/tmp/dir';
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 = typings(model);
result.should.match(/angularjs\/angular.d.ts/);
result.should.match(/angularjs\/angular-mocks.d.ts/);
result.should.match(/jasmine\/jasmine.d.ts/);
result.should.match(/karma-jasmine\/karma-jasmine.d.ts/);
result.should.match(/moment\/moment-node.d.ts/);
});

it('should insert angular modules definitions', function () {
model.angularModulesObject = {
animate: true,
cookies: true,
sanitize: true
};
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 = typings(model);
result.should.match(/jquery\/jquery.d.ts/);
});

it('should insert Zepto definition', function () {
model.props.jQuery.key = 'zepto';
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 = typings(model);
result.should.match(/angularjs\/angular-resource.d.ts/);
});

it('should insert Restangular definition', function () {
model.props.resource.key = 'restangular';
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 = 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 = 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 = 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 = typings(model);
result.should.match(/foundation\/foundation.d.ts/);
});

it('should insert Angular-Mateiral definition', function () {
model.props.ui.key = 'angular-material';
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 = typings(model);
result.should.match(/angular-ui-bootstrap\/angular-ui-bootstrap.d.ts/);
});
});