Updated TS to two-step builds (source & combined)

This commit is contained in:
Josh Goldberg
2015-12-29 14:52:21 -05:00
parent eea434d885
commit 7696bc29b6
4 changed files with 74 additions and 48 deletions
+2 -4
View File
@@ -1,7 +1,5 @@
Distribution
Distribution/**
Source/*.js
Source/*.md
Source/*.txt
Build/**
Source/**/*.js
node_modules/
npm-debug.log
+65 -37
View File
@@ -4,50 +4,82 @@ module.exports = function (grunt) {
"meta": {
"paths": {
"source": "Source",
"build": "Build",
"dist": "Distribution"
}
},
"tslint": {
"options": {
"configuration": grunt.file.readJSON("tslint.json")
},
"files": {
"src": ["<%= meta.paths.source %>/<%= pkg.name %>.ts"]
}
},
"typescript": {
"base": {
"src": "<%= meta.paths.source %>/<%= pkg.name %>.ts",
"dest": "<%= meta.paths.source %>/<%= pkg.name %>.js"
}
},
"clean": ["<%= meta.paths.dist %>"],
"copy": {
"default": {
"options": {
"configuration": grunt.file.readJSON("tslint.json")
},
"files": {
"src": ["<%= meta.paths.source %>/*.ts"]
}
}
},
"clean": {
"prebuild": [
"<%= meta.paths.dist %>",
"<%= meta.paths.build %>"
],
"postbuild": [
"<%= meta.paths.dist %>/<%= pkg.name %>.js",
"<%= meta.paths.build %>"
]
},
"copy": {
"prebuild": {
"files": [{
"src": "<%= meta.paths.source %>/<%= pkg.name %>.js",
"dest": "<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.js"
"src": "<%= meta.paths.source %>/*.ts",
"dest": "<%= meta.paths.build %>/",
"expand": true,
"flatten": true
}, {
"src": "<%= meta.paths.source %>/<%= pkg.name %>.ts",
"dest": "<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.ts"
"dest": "<%= meta.paths.build %>/",
"expand": true,
"flatten": true,
"rename": function (dest, src) {
return dest + "/<%= pkg.name %>-<%= pkg.version %>.ts";
}
}, {
"src": "<%= meta.paths.source %>/References/*.ts",
"dest": "<%= meta.paths.build %>",
"expand": true,
"flatten": true
}, {
"src": "<%= meta.paths.source %>/References/*.?s",
"dest": "<%= meta.paths.dist %>/",
"expand": true,
"flatten": true
}, {
"src": "README.md",
"dest": "<%= meta.paths.dist %>/"
}, {
"src": "README.md",
"dest": "<%= meta.paths.source %>/"
}, {
"src": "LICENSE.txt",
"dest": "<%= meta.paths.dist %>/"
}, {
"src": "LICENSE.txt",
"dest": "<%= meta.paths.source %>/"
}]
},
"distribution": {
"files": [{
"src": "<%= meta.paths.source %>/<%= pkg.name %>.js",
"dest": "<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.js"
}]
}
},
"preprocess": {
"default": {
"src": "<%= meta.paths.build %>/<%= pkg.name %>.ts",
"dest": "<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.ts"
}
},
"typescript": {
"source": {
"src": "<%= meta.paths.source %>/*.ts"
},
"distribution": {
"src": "<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.ts"
}
},
"uglify": {
@@ -55,31 +87,27 @@ module.exports = function (grunt) {
"compress": true,
"sourceMap": true
},
"dist": {
"default": {
"files": {
"<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.min.js": ["<%= meta.paths.source %>/<%= pkg.name %>.js"],
"<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.min.js": [
"<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.js"
]
}
}
},
"preprocess": {
"dist": {
"src": "<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.ts",
"dest": "<%= meta.paths.dist %>/<%= pkg.name %>-<%= pkg.version %>.ts"
}
},
"mocha_phantomjs": {
"all": ["Tests/*.html"]
"default": ["Tests/*.html"]
}
});
grunt.loadNpmTasks("grunt-tslint");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-preprocess");
grunt.loadNpmTasks("grunt-typescript");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-mocha-phantomjs");
grunt.loadNpmTasks("grunt-preprocess");
grunt.loadNpmTasks("grunt-tslint");
grunt.loadNpmTasks("grunt-typescript");
grunt.registerTask("default", [
"tslint", "typescript", "clean", "copy", "uglify", "preprocess", "mocha_phantomjs"
"tslint", "clean", "copy:prebuild", "preprocess", "typescript:source", "copy:distribution", "typescript:distribution", "clean:postbuild", "uglify", "mocha_phantomjs"
]);
};
+4 -4
View File
@@ -5,7 +5,7 @@ declare module MathDecidr {
export interface IConstants {
[i: string]: any;
}
/**
* A calculation Function.
*
@@ -16,14 +16,14 @@ declare module MathDecidr {
export interface IEquation {
(constants: IConstants, equations: IEquationContainer, ...args: any[]): any;
}
/**
* A collection of equations, keyed by name.
*/
export interface IEquationContainer {
[i: string]: IEquation;
}
/**
* Settings to initialize a new IMathDecidr.
*/
@@ -38,7 +38,7 @@ declare module MathDecidr {
*/
equations?: IEquationContainer;
}
/**
* A computation utility to automate running common equations with access
* to a set of constant values.
+3 -3
View File
@@ -22,11 +22,11 @@
"grunt-contrib-copy": "~0.8.X",
"grunt-contrib-uglify": "~0.8.X",
"grunt-mocha-phantomjs": "~2.X",
"grunt-tslint": "~3.X",
"grunt-typescript": "~0.7.X",
"grunt-tslint": "~3.0.X",
"grunt-typescript": "~0.8.X",
"mocha": "~2.2.X",
"grunt-preprocess": "~4.1.X",
"tslint": "~3.X",
"tslint": "~3.2.X",
"typescript": "~1.7.X"
}
}