diff --git a/.gitignore b/.gitignore index d78d133..baf9643 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ -Distribution Distribution/** -Source/*.js -Source/*.md -Source/*.txt +Build/** +Source/**/*.js node_modules/ npm-debug.log diff --git a/Gruntfile.js b/Gruntfile.js index 339545d..ffd5032 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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" ]); }; \ No newline at end of file diff --git a/Source/MathDecidr.d.ts b/Source/MathDecidr.d.ts index b3e7261..f242852 100644 --- a/Source/MathDecidr.d.ts +++ b/Source/MathDecidr.d.ts @@ -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. diff --git a/package.json b/package.json index 4dab81b..45ae6ea 100644 --- a/package.json +++ b/package.json @@ -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" } } \ No newline at end of file