Skip to content

Commit 28a37d5

Browse files
committed
fixed issues with Typescript typings definition -> Issue #2
1 parent 42318d9 commit 28a37d5

12 files changed

+55
-171
lines changed

.idea/libraries/Generated_files.xml

+31-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gruntfile.js

+14-32
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,7 @@ module.exports = function (grunt) {
143143
}
144144
},
145145
typings:{
146-
src: ['src/validation/Validation.ts','src/validation/Utils.ts','src/validation/FormSchema.ts'],
147-
dest: 'typings/<%= pkg.name %>',
148-
options: {
149-
basePath: 'src/validation',
150-
module: 'commonjs',
151-
target: 'es5',
152-
declaration: true,
153-
comments:false
154-
}
155-
},
156-
otherTypings: {
157-
src: ['src/validation/BasicValidators.ts'],
146+
src: ['src/validation/*.ts'],
158147
dest: 'typings/<%= pkg.name %>',
159148
options: {
160149
basePath: 'src/validation',
@@ -243,29 +232,22 @@ module.exports = function (grunt) {
243232
banner: '// Type definitions for <%= pkg.name %> - v<%= pkg.version %>\n' +
244233
'// Project: https://github.com/rsamec/form\n' +
245234
'// Definitions by: Roman Samec <https://github.com/rsamec>\n' +
246-
'// Definitions: https://github.com/borisyankov/DefinitelyTyped\n\n',
235+
'// Definitions: https://github.com/borisyankov/DefinitelyTyped\n\n' +
236+
'\n' +
237+
'/// <reference path="../../typings/q/Q.d.ts" />\n' +
238+
'/// <reference path="../../typings/underscore/underscore.d.ts" />\n' +
239+
'/// <reference path="../../typings/hashmap/hashmap.d.ts" />\n' +
240+
'/// <reference path="../../typings/node/node.d.ts" />\n',
241+
footer:'declare module "business-rule-engine" {export = Validation;}',
247242
process: function(src, filepath) {
248243
return '// Source: ' + filepath + '\n' +
249-
src.replace(/[ \t]*export = (\w*);?/g, 'declare module "business-rule-engine" {export = $1;}');
244+
src.replace(/.*<reference path=.*/g, '')//remove references
245+
.replace(/export.*/g, '')//remove exports
246+
.replace(/import.*/g, '');// + //remove imports
250247
}
251248
},
252249
files: {
253-
'typings/<%= pkg.name %>/<%= pkg.name %>.d.ts': ['typings/<%= pkg.name %>/Validation.d.ts']
254-
}
255-
},
256-
otherTypings:{
257-
258-
options:{
259-
process: function(src, filepath) {
260-
return '// Source: ' + filepath + '\n' +
261-
src.replace(/[ \t]*export = (\w*);?/g, 'declare module "node-$1" {export = $1;}');
262-
}
263-
},
264-
files: {
265-
'typings/<%= pkg.name %>/BasicValidators.d.ts': ['typings/<%= pkg.name %>/BasicValidators.d.ts'],
266-
'typings/<%= pkg.name %>/Utils.d.ts': ['typings/<%= pkg.name %>/Utils.d.ts'],
267-
'typings/<%= pkg.name %>/FormSchema.d.ts': ['typings/<%= pkg.name %>/FormSchema.d.ts']
268-
250+
'typings/<%= pkg.name %>/<%= pkg.name %>.d.ts': ['typings/<%= pkg.name %>/Utils.d.ts','typings/<%= pkg.name %>/Validation.d.ts','typings/<%= pkg.name %>/BasicValidators.d.ts','typings/<%= pkg.name %>/FormSchema.d.ts']
269251
}
270252
}
271253
}
@@ -286,8 +268,8 @@ module.exports = function (grunt) {
286268

287269

288270
grunt.registerTask('test', ['typescript:src','typescript:test', 'mochacli', 'watch']);
289-
grunt.registerTask('ci', ['complexity', 'jshint', 'mochacli']);
271+
//grunt.registerTask('ci', ['complexity', 'jshint', 'mochacli']);
290272
grunt.registerTask('dist', ['typescript:commonjs','typescript:amd','typescript:customValidatorsCommonjs','typescript:customValidatorsAmd','typescript:localCommonjs','typescript:localAmd','copy','concat:module','uglify:dist']);
291-
grunt.registerTask('typings',['typescript:typings','concat:typings','typescript:otherTypings','concat:otherTypings']);
273+
grunt.registerTask('typings',['typescript:typings','concat:typings']);
292274
grunt.registerTask('document', ['typedoc']);
293275
};

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "business-rules-engine",
33
"main": "dist/module/Validation.js",
4-
"version": "1.2.5",
4+
"version": "1.2.6",
55
"homepage": "https://github.com/rsamec/business-rules-engine",
66
"authors": [
77
"rsamec <[email protected]>"

dist/business-rules-engine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! business-rules-engine, v.1.2.5 05-12-2014 */
1+
/*! business-rules-engine, v.1.2.5 06-12-2014 */
22
var __extends = this.__extends || function (d, b) {
33
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
44
function __() { this.constructor = d; }

dist/business-rules-engine.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "business-rules-engine",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "business rules engine",
55
"main": "./commonjs/Validation",
66
"repository": {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "business-rules-engine",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "business rules engine",
55
"main": "src/validation",
66
"scripts": {

src/customValidators/DateCompareValidator.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import moment = require("moment");
55
import _ = require("underscore");
66

7+
78
/**
89
* @ngdoc object
910
* @name DateCompareValidator

src/validation/BasicValidators.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
///<reference path='../../typings/underscore/underscore.d.ts'/>
22
///<reference path='../../typings/q/Q.d.ts'/>
33
///<reference path='../../typings/node/node.d.ts'/>
4-
///<reference path='../../typings/business-rules-engine/business-rules-engine.d.ts'/>
4+
///<reference path='../../typings/business-rules-engine/Validation.d.ts'/>
55

66

77
import Q = require("q");
88
import _ = require("underscore");
9-
9+
import Validation = require("./Validation");
1010

1111
/**
1212
* Basic validation rules that enables to validate an value against common constraints.

src/validation/FormSchema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference path='../../typings/q/Q.d.ts'/>
22
///<reference path='../../typings/underscore/underscore.d.ts'/>
33
///<reference path='../../typings/node/node.d.ts'/>
4-
///<reference path='../../typings/business-rules-engine/business-rules-engine.d.ts'/>
4+
///<reference path='../../typings/business-rules-engine/Validation.d.ts'/>
55

66
import _ = require('underscore');
77
import Q = require('q');

test/validation/Utils.ts

-105
This file was deleted.

test/validation/rulesTranslate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference path='../../typings/mocha/mocha.d.ts'/>
22
///<reference path='../../typings/node/node.d.ts'/>
33
///<reference path='../../typings/underscore/underscore.d.ts'/>
4-
///<reference path='../../typings/q/q.d.ts'/>
4+
///<reference path='../../typings/Q/q.d.ts'/>
55

66

77
var Validation = require('../../src/validation/Validation.js');

0 commit comments

Comments
 (0)