-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
41 lines (41 loc) · 1.23 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
all: ['src/*.js']
},
uglify: {
javascript: {
expand: true,
cwd: 'javascript',
src: '*.js',
dest: 'minified'
}
}
});
grunt.task.registerTask('assemble', 'Build script', function() {
var tiny = require('webaudio-tinysynth');
var src = grunt.file.read('src/JZZ.synth.Tiny.js').split(/\r?\n/);
var dest = [];
for (var i = 0; i < src.length; i++) {
if (src[i] == '//#include webaudio-tinysynth') dest.push(tiny.toString());
else dest.push(src[i]);
}
grunt.file.write('javascript/JZZ.synth.Tiny.js', dest.join(require('os').EOL));
});
grunt.task.registerTask('version', 'Check version consistency', function() {
var pkg = grunt.file.readJSON('package.json');
var JZZ = require('jzz');
require('.')(JZZ);
var ver = JZZ.synth.Tiny.version();
if (ver == pkg.version) {
grunt.log.ok('Version:', ver);
}
else {
grunt.log.error('Version:', ver, '!=', pkg.version);
return false;
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('default', ['uglify', 'version']);
};