Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Universal Module Definition for require.js and friends, namespacing, bower, travis, etc. #18

Merged
merged 12 commits into from
Apr 4, 2014
Merged
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
WebCola/compiledtypescript.js
WebCola/doc
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "0.10"
before_script:
- "npm install -g grunt-cli"
162 changes: 102 additions & 60 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,102 @@
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-yuidoc');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
typescript: {
base: {
src: ['WebCola/src/*.ts'],
dest: 'WebCola/compiledtypescript.js',
options: {
module: 'amd',
target: 'es5',
sourcemap: false
}
}
},
concat: {
options: {},
dist: {
src: ['WebCola/compiledtypescript.js', 'WebCola/src/d3adaptor.js', 'WebCola/src/rbtree.js', 'WebCola/src/scc.js','WebCola/src/handle_disconnected.js'],
dest: 'WebCola/cola.v1.min.js'
}
},
uglify: {
dist: {
options: {
//sourceMap: 'WebCola/cola.min.map',
//sourceMapIn: 'WebCola/compiledtypescript.js.map',
//sourceMapRoot: 'WebCola'
},
files: {
'WebCola/cola.v1.min.js': ['WebCola/compiledtypescript.js', 'WebCola/src/d3adaptor.js', 'WebCola/src/rbtree.js', 'WebCola/src/scc.js','WebCola/src/handle_disconnected.js']
}
}
},
qunit: {
all: ['WebCola/test/*.html']
},
yuidoc: {
compile: {
name: 'cola.js',
description: 'Javascript constraint based layout for high-quality graph visualization and exploration using D3.js and other web-based graphics libraries.',
version: '1',
url: 'http://marvl.infotech.monash.edu/webcola',
options: {
paths: 'WebCola/src',
outdir: 'WebCola/doc'
}
}
}
});

grunt.registerTask('default', ['typescript', 'uglify', 'qunit', 'yuidoc']);
grunt.registerTask('nougly', ['typescript', 'concat', 'qunit']);
grunt.registerTask('nougly-notest', ['typescript', 'concat']);
}
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('./tasks/examples')(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
default: {
files: ["<%= concat.dist.src %>", "Gruntfile.js", "templates/*"],
tasks: ["default"]
},
typescript: {
files: ["<%= typescript.base.src %>"],
tasks: ["typescript"]
},
test: {
files: ["WebCola/test/*.js"],
tasks: ["qunit"]
}
},
typescript: {
base: {
src: ['WebCola/src/*.ts'],
dest: 'WebCola/compiledtypescript.js',
options: {
module: 'amd',
target: 'es5',
sourcemap: false
}
},
examples: {
src: ['WebCola/examples/*.ts'],
options: {
module: 'amd',
target: 'es5',
sourcemap: false
}
}
},
concat: {
options: {},
dist: {
src: [
'WebCola/compiledtypescript.js',
'WebCola/src/d3adaptor.js',
'WebCola/src/rbtree.js',
'WebCola/src/scc.js',
'WebCola/src/handle_disconnected.js'
],
dest: 'WebCola/cola.v1.min.js'
}
},
umd: {
all: {
src: '<%= concat.dist.dest %>',
template: 'templates/umd.hbs',
objectToExport: 'cola',
deps: {
'default': ['d3']
}
}
},
uglify: {
dist: {
options: {
//sourceMap: 'WebCola/cola.min.map',
//sourceMapIn: 'WebCola/compiledtypescript.js.map',
//sourceMapRoot: 'WebCola'
},
files: {
'WebCola/cola.v1.min.js': [
'<%= concat.dist.dest %>'
]
}
}
},
qunit: {
all: ['WebCola/test/*.html']
},
examples: {
all: ["WebCola/examples/*.html"]
},
yuidoc: {
compile: {
name: 'cola.js',
description: 'Javascript constraint based layout for high-quality graph visualization and exploration using D3.js and other web-based graphics libraries.',
version: '1',
url: 'http://marvl.infotech.monash.edu/webcola',
options: {
paths: 'WebCola/src',
outdir: 'WebCola/doc'
}
}
}
});

grunt.registerTask('default', ['typescript:base', 'concat', 'umd', 'uglify', 'qunit']);
grunt.registerTask('nougly', ['typescript:base', 'concat', 'umd', 'qunit']);
grunt.registerTask('nougly-notest', ['typescript', 'concat']);
grunt.registerTask('docs', ['yuidoc', 'typescript:examples']);
grunt.registerTask('full', ['default', 'typescript:examples', 'examples']);
};
Loading