Skip to content

Commit

Permalink
Working on #3: Modularized source code using CommonJS module format. …
Browse files Browse the repository at this point in the history
…Added Grunt build with support for Browserify, PEG.js parser generation, Bower dependency resolution, QUnit PhantomJS testing and minification.
  • Loading branch information
incompleteopus committed Nov 12, 2013
1 parent 64d48f3 commit 4e2971b
Show file tree
Hide file tree
Showing 23 changed files with 1,318 additions and 9,247 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bower_components
node_modules
lib/managed
dist
159 changes: 159 additions & 0 deletions Gruntfile.js
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"]);

};
10 changes: 10 additions & 0 deletions bower.json
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"
}
}
2 changes: 0 additions & 2 deletions lib/jquery-1.8.3.min.js

This file was deleted.

9 changes: 0 additions & 9 deletions lib/peg-0.7.0.min.js

This file was deleted.

468 changes: 468 additions & 0 deletions lib/unmanaged/vexflow/vexflow-min.js

Large diffs are not rendered by default.

360 changes: 0 additions & 360 deletions lib/vexflow-min.js

This file was deleted.

46 changes: 46 additions & 0 deletions package.json
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"
}
}
Loading

0 comments on commit 4e2971b

Please sign in to comment.