Generate separate filer for testing in node so we don't overwrite dist/filer.js

This commit is contained in:
David Humphrey 2014-05-17 14:44:29 -04:00
parent 9c932b4743
commit 3aa670dd90
3 changed files with 31 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules node_modules
bower_components bower_components
*~ *~
dist/filer-test.js

View File

@ -4,7 +4,7 @@ module.exports = function(grunt) {
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
clean: ['dist/'], clean: ['dist/filer-test.js'],
uglify: { uglify: {
options: { options: {
@ -79,6 +79,30 @@ module.exports = function(grunt) {
} }
} }
} }
},
test: {
options: {
paths: {
"src": "../src",
"build": "../build"
},
baseUrl: "lib",
name: "build/almond",
include: ["src/index"],
out: "dist/filer-test.js",
optimize: "none",
wrap: {
startFile: 'build/wrap.start',
endFile: 'build/wrap.end'
},
shim: {
// TextEncoder and TextDecoder shims. encoding-indexes must get loaded first,
// and we use a fake one for reduced size, since we only care about utf8.
"encoding": {
deps: ["encoding-indexes-shim"]
}
}
}
} }
} }
}); });
@ -89,10 +113,11 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-shell'); grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('develop', ['clean', 'requirejs']); grunt.registerTask('develop', ['clean', 'requirejs:develop']);
grunt.registerTask('filer-test', ['clean', 'requirejs:test']);
grunt.registerTask('release', ['develop', 'uglify']); grunt.registerTask('release', ['develop', 'uglify']);
grunt.registerTask('check', ['jshint']); grunt.registerTask('check', ['jshint']);
grunt.registerTask('test', ['check', 'develop', 'shell:mocha']); grunt.registerTask('test', ['check', 'filer-test', 'shell:mocha']);
grunt.registerTask('default', ['test']); grunt.registerTask('default', ['test']);
}; };

View File

@ -7,7 +7,8 @@ requirejs.config({
"spec": "../tests/spec", "spec": "../tests/spec",
"bugs": "../tests/bugs", "bugs": "../tests/bugs",
"util": "../tests/lib/test-utils", "util": "../tests/lib/test-utils",
"Filer": "../dist/filer" // see gruntfile.js for how dist/filer-test.js gets built
"Filer": "../dist/filer-test"
}, },
baseUrl: "./lib", baseUrl: "./lib",
optimize: "none", optimize: "none",