Comparing version 0.6.0 to 0.6.2
@@ -6,3 +6,4 @@ module.exports = function (grunt) { | ||
var VERSION = require("./package.json").version; | ||
var VERSION = require("./package.json").version, | ||
BANNER = require("fs").readFileSync("src/notice.txt"); | ||
@@ -43,3 +44,3 @@ grunt.initConfig({ | ||
"options": { | ||
"banner": require("fs").readFileSync("src/notice.txt") | ||
"banner": BANNER | ||
}, | ||
@@ -59,6 +60,16 @@ "src": [ "dist/debug/outliner.debug.js" ], | ||
} | ||
}, | ||
"gh-pages": { | ||
"dist": { | ||
"options": { "base": "dist" }, | ||
"src": [ | ||
"outliner.min.js", | ||
"outliner.html" | ||
] | ||
} | ||
} | ||
}); | ||
grunt.loadNpmTasks("intern") | ||
grunt.loadNpmTasks("intern"); | ||
grunt.renameTask("release", "_release"); | ||
@@ -68,16 +79,27 @@ grunt.registerTask("default", "Clean build and minify", [ "clean:all", "concat:outliner-js", "copy:bookmarklet-js", "uglify", "_bookmarklet-release" ]); | ||
grunt.registerTask("release", function () { | ||
var bump = grunt.option("bump"); | ||
if (bump != "patch" && bump != "minor" && bump != "major") grunt.fail.fatal("Please pass --bump"); | ||
grunt.task.run(["_release:" + bump, "gh-pages"]); | ||
}); | ||
grunt.registerTask("_bookmarklet-release", "Prepare bookmarklet HTML for release", function () { | ||
var done = this.async(); | ||
var fs = require("fs"); | ||
var fs = require("fs"), | ||
ejs = require("ejs"); | ||
var bookmarkletHtml = fs.readFileSync("src/bookmarklet.html").toString(); | ||
ejs.renderFile("src/bookmarklet.html.ejs", { | ||
bookmarkletHtml = bookmarkletHtml.replace(/@VERSION/g, VERSION); | ||
bookmarkletHtml = bookmarkletHtml.replace(/@NOTICE/g, fs.readFileSync("src/notice.txt")); | ||
bookmarkletHtml = bookmarkletHtml.replace(/@RUNBOOKMARKLET/g, encodeURIComponent(fs.readFileSync("dist/debug/HTML5OutlineBookmarklet.min.js").toString())); | ||
bookmarkletHtml = bookmarkletHtml.replace(/@MINIFIED/g, encodeURIComponent(fs.readFileSync("dist/outliner.min.js").toString())); | ||
version: VERSION, | ||
banner: BANNER, | ||
bookmarklet: encodeURIComponent(fs.readFileSync("dist/debug/HTML5OutlineBookmarklet.min.js").toString()), | ||
outliner: encodeURIComponent(fs.readFileSync("dist/outliner.min.js").toString()) | ||
fs.writeFile("dist/outliner.html", bookmarkletHtml, done); | ||
}, function (err, bookmarklet) { | ||
if (err) grunt.fail.fatal(err); | ||
fs.writeFile("dist/outliner.html", bookmarklet, done); | ||
}); | ||
}); | ||
}; |
{ | ||
"name": "h5o", | ||
"version": "0.6.0", | ||
"version": "0.6.2", | ||
"description": "HTML5 outliner", | ||
@@ -25,2 +25,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"ejs": "^1.0.0", | ||
"grunt": "^0.4.5", | ||
@@ -32,2 +33,3 @@ "grunt-cli": "^0.1.13", | ||
"grunt-contrib-uglify": "^0.4.0", | ||
"grunt-gh-pages": "^0.9.1", | ||
"grunt-release": "^0.7.0", | ||
@@ -34,0 +36,0 @@ "intern": "^1.7.0", |
Sorry, the diff of this file is not supported yet
87318
48
885
12