-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on #3: Modularized source code using CommonJS module format. …
…Added Grunt build with support for Browserify, PEG.js parser generation, Bower dependency resolution, QUnit PhantomJS testing and minification.
- Loading branch information
1 parent
64d48f3
commit 4e2971b
Showing
23 changed files
with
1,318 additions
and
9,247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bower_components | ||
node_modules | ||
lib/managed | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
module.exports = function(grunt) { | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON("package.json"), | ||
clean: { | ||
dist: { | ||
src: ["dist"] | ||
} | ||
}, | ||
bower: { | ||
install: { | ||
options: { | ||
targetDir: "./lib/managed", | ||
layout: "byComponent", | ||
install: true, | ||
verbose: false, | ||
cleanTargetDir: false, | ||
cleanBowerDir: false, | ||
bowerOptions: {} | ||
} | ||
} | ||
}, | ||
peg: { | ||
options: { | ||
// Options for PEG.js parser generator | ||
}, | ||
vexabc : { | ||
src: "src/vexabc.pegjs", | ||
dest: "dist/vexabc-pegjs-parser-raw.js", | ||
options: { | ||
// Export parser definition | ||
exportVar: "module.exports", | ||
cache: true | ||
} | ||
} | ||
}, | ||
browserify: { | ||
underscore: { | ||
src: [], | ||
dest: "dist/underscore.js", | ||
options: { | ||
shim: { | ||
underscore: { | ||
path: "lib/managed/underscore/underscore-min.js", | ||
exports: "_" | ||
} | ||
} | ||
} | ||
}, | ||
vexflow: { | ||
src: [], | ||
dest: "dist/vexflow.js", | ||
options: { | ||
shim: { | ||
vexflow: { | ||
path: "lib/unmanaged/vexflow/vexflow-min.js", | ||
exports: "Vex" | ||
} | ||
} | ||
} | ||
}, | ||
vexabc_pegjs_parser: { | ||
src: ["dist/vexabc-pegjs-parser-raw.js"], | ||
dest: "dist/vexabc-pegjs-parser.js", | ||
options: { | ||
external: ["underscore"], | ||
alias: ["dist/vexabc-pegjs-parser-raw.js:vexabc-pegjs-parser"] | ||
} | ||
}, | ||
vexabc: { | ||
src: ["src/vexabc.js"], | ||
dest: "dist/<%= pkg.name %>.js", | ||
options: { | ||
external: ["underscore", "vexflow", "vexabc-pegjs-parser"], | ||
alias: ["src/vexabc.js:vexabc"] | ||
} | ||
} | ||
}, | ||
concat: { | ||
options: { | ||
separator: ";", | ||
}, | ||
dist: { | ||
src: ["dist/underscore.js", "dist/vexflow.js", "dist/vexabc-pegjs-parser.js", "dist/vexabc.js"], | ||
dest: "dist/<%= pkg.name %>-full.js", | ||
}, | ||
}, | ||
uglify: { | ||
options: { | ||
banner: "/*! <%= pkg.name %> <%= grunt.template.today('dd-mm-yyyy') %> */\n" | ||
}, | ||
dist: { | ||
files: { | ||
"dist/<%= pkg.name %>-full-min.js": ["dist/<%= pkg.name %>-full.js"] | ||
} | ||
} | ||
}, | ||
qunit: { | ||
test: ["test/test.html"] | ||
}, | ||
jshint: { | ||
src: ["Gruntfile.js", "src/**/*.js"], | ||
test: { | ||
files: { | ||
test: ["test/**/*.js"] | ||
}, | ||
options: { | ||
quotmark: false, | ||
jquery: true, | ||
globals: { | ||
VexAbc: true, | ||
// QUnit | ||
test: true, | ||
ok: true, | ||
deepEqual: true | ||
} | ||
} | ||
}, | ||
options: { | ||
// options here to override JSHint defaults | ||
curly: true, | ||
eqeqeq: true, | ||
eqnull: true, | ||
expr: true, | ||
immed: true, | ||
indent: 2, | ||
multistr: true, | ||
newcap: true, | ||
noarg: true, | ||
quotmark: "double", | ||
smarttabs: true, | ||
trailing: true, | ||
undef: true, | ||
unused: true, | ||
|
||
node: true, | ||
} | ||
}, | ||
watch: { | ||
src: ["<%= jshint.src %>"], | ||
tasks: ["jshint", "peg", "browserify"] | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks("grunt-contrib-clean"); | ||
grunt.loadNpmTasks("grunt-contrib-jshint"); | ||
grunt.loadNpmTasks("grunt-contrib-qunit"); | ||
grunt.loadNpmTasks("grunt-contrib-uglify"); | ||
grunt.loadNpmTasks("grunt-contrib-watch"); | ||
grunt.loadNpmTasks("grunt-contrib-concat"); | ||
grunt.loadNpmTasks("grunt-browserify"); | ||
grunt.loadNpmTasks("grunt-bower-task"); | ||
grunt.loadNpmTasks("grunt-peg"); | ||
|
||
grunt.registerTask("test", ["jshint", "peg", "browserify", "bower", "qunit"]); | ||
|
||
grunt.registerTask("default", ["jshint", "peg", "browserify", "bower", "qunit", "concat", "uglify"]); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "vexabc", | ||
"version": "0.2.0", | ||
"dependencies": { | ||
"underscore": "1.5.2", | ||
"jquery": "1.10.2", | ||
"bootstrap": "3.0.2", | ||
"qunit": "1.12" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "vexabc", | ||
"version": "0.2.0", | ||
"description": "ABC notation parser and renderer for VexFlow", | ||
"homepage": "https://github.com/incompleteopus/vexabc/", | ||
"author": { | ||
"name": "Mikael Nousiainen", | ||
"email": "[email protected]", | ||
"url": "https://github.com/incompleteopus/" | ||
}, | ||
"files": [], | ||
"main": "src/vexabc", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/incompleteopus/vexabc.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/incompleteopus/vexabc/issues" | ||
}, | ||
"licenses" : [ | ||
{ | ||
"type" : "MPL 2.0", | ||
"url" : "https://github.com/incompleteopus/vexabc/blob/master/LICENSE" | ||
} | ||
], | ||
"dependencies": { | ||
"underscore": "1.5.2" | ||
}, | ||
"devDependencies": { | ||
"grunt": ">= 0.4.1", | ||
"grunt-contrib-clean": "0.5.0", | ||
"grunt-contrib-concat": "0.3.0", | ||
"grunt-contrib-jshint": "0.7.1", | ||
"grunt-contrib-qunit": "0.3.0", | ||
"grunt-contrib-uglify": "0.2.5", | ||
"grunt-contrib-watch": "0.5.3", | ||
"browserify": "~2.35.1", | ||
"grunt-browserify": "~1.2.11", | ||
"debowerify": "0.3.0", | ||
"grunt-bower-task": "0.3.3", | ||
"grunt-peg": "git://github.com/incompleteopus/grunt-peg.git#master" | ||
}, | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
} | ||
} |
Oops, something went wrong.