diff --git a/Makefile.dryice.js b/Makefile.dryice.js index f0f1f391..8bf54562 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -31,14 +31,13 @@ var fs = require("fs"); var path = require("path"); -if (!fs.existsSync) - fs.existsSync = path.existsSync; -else - path.existsSync = fs.existsSync; -var copy = require('dryice').copy; +var copy = require('architect-build/copy'); +var build = require('architect-build/build'); +var async = require("asyncjs"); var ACE_HOME = __dirname; var BUILD_DIR = ACE_HOME + "/build"; +var CACHE = {}; function main(args) { if (args.indexOf("updateModes") !== -1) { @@ -49,7 +48,7 @@ function main(args) { if (x[0] == "-" && x[1] != "-") return "-" + x; return x; - }); + }).filter(Boolean); if (args[2] && (args[2][0] != "-" || args[2].indexOf("h") != -1)) type = args[2]; @@ -70,26 +69,15 @@ function main(args) { } else if (type == "demo") { demo(); } else if (type == "full") { - demo(ace()); - bookmarklet(); + ace(); + demo(); } else if (type == "highlighter") { - var project = buildAce({ - coreOnly: true, - exportModule: "ace/ext/static_highlight", - requires: ["ace/ext/static_highlight", "ace/theme/textmate"], - readFilters: [copy.filter.moduleDefines, function(a) { - console.log(a.substring(0, 2500)) - return a - }] - }) - copy({ - source: project.result, - filter: getWriteFilters(project.options, "main"), - dest: BUILD_DIR + "/static_highlight.js" - }); + // TODO } } +} +function showHelp(type) { console.log("--- Ace Dryice Build Tool ---"); console.log(""); console.log("Options:"); @@ -106,57 +94,23 @@ function main(args) { console.log(" --nc namespace require"); console.log(" --s shrinkwrap (combines all output files into one)"); console.log(""); - if (BUILD_DIR) - console.log(" output generated in " + type + __dirname + "/" + BUILD_DIR) + if (type) + console.log(" output for " + type + " generated in " + BUILD_DIR); } function ace() { - console.log('# ace ---------'); - - // uncompressed - var project = buildAce({ - compress: false, - noconflict: false - }); - buildAce({ - compress: false, - noconflict: true - }); - - // compressed - buildAce({ - compress: true, - noconflict: false - }); - buildAce({ - compress: true, - noconflict: true - }); - console.log('# ace License | Readme | Changelog ---------'); - copy({ - source: ACE_HOME + "/build_support/editor.html", - dest: BUILD_DIR + "/editor.html" - }); - copy({ - source: ACE_HOME + "/LICENSE", - dest: BUILD_DIR + "/LICENSE" - }); - copy({ - source: ACE_HOME + "/ChangeLog.txt", - dest: BUILD_DIR + "/ChangeLog.txt" - }); - - return project; + copy.file(ACE_HOME + "/build_support/editor.html", BUILD_DIR + "/editor.html"); + copy.file(ACE_HOME + "/LICENSE", BUILD_DIR + "/LICENSE"); + copy.file(ACE_HOME + "/ChangeLog.txt", BUILD_DIR + "/ChangeLog.txt"); + + console.log('# ace ---------'); + for (var i = 0; i < 4; i++) + buildAce({compress: i & 2, noconflict: i & 1}); } -function demo(project) { - project = project || buildAce({ - compress: false, - noconflict: false, - coreOnly: true - }); +function demo() { console.log('# kitchen sink ---------'); var version, ref; @@ -177,88 +131,63 @@ function demo(project) { .replace("%version%", version) .replace("%commit%", ref) ); - }; + } function fixDocPaths(data) { return data.replace(/"(demo|build)\//g, "\""); } - copy({ - source: ACE_HOME + "/kitchen-sink.html", - dest: BUILD_DIR + "/kitchen-sink.html", - filter: [changeComments, fixDocPaths] + copy(ACE_HOME + "/demo/kitchen-sink", BUILD_DIR + "/kitchen-sink", { + shallow: true, + replace: [changeComments, fixDocPaths], + include: /\.(css|html)$/ }); - - copy({ - source: ACE_HOME + "/demo/kitchen-sink/styles.css", - dest: BUILD_DIR + "/kitchen-sink/styles.css", - filter: [ changeComments ] - }); - - fs.readdirSync(ACE_HOME +"/demo/kitchen-sink/docs/").forEach(function(x) { - copy({ - source: ACE_HOME +"/demo/kitchen-sink/docs/" + x, - dest: BUILD_DIR + "/kitchen-sink/docs/" + x - }); - }); - - var demo = copy.createDataObject(); - - project.assumeAllFilesLoaded(); - copy({ - source: [{ - project: cloneProject(project), - require: [ "kitchen-sink/demo" ] - }], - filter: getWriteFilters({filters:[fixDocPaths]}, "demo"), - dest: demo - }); - - copy({ - source: demo, - dest: BUILD_DIR + "/kitchen-sink/demo.js", - }); - - copyFileSync(ACE_HOME + "/demo/kitchen-sink/logo.png", BUILD_DIR + "/kitchen-sink/logo.png"); - fs.readdirSync(ACE_HOME + "/demo/").forEach(function(x) { - if (/\s|requirejs/.test(x) || !/\.(js|html)$/.test(x)) - return; - copy({ - source: ACE_HOME +"/demo/" + x, - dest: BUILD_DIR + "/demo/" + x, - filter: [function(source) { - if (/\.(js)$/.test(x)) - return source; - var removeRequireJS - source = source.replace(/')} - scripts.forEach(function(s) { - s = s.replace(/"/g, ""); - if (s == "ace/ace") { - comment("load ace") - script("ace") - } else { - var extName = s.match(/[^/]*$/)[0]; - comment("load ace " + extName + " extension"); - script("ext-" + extName); - } - }); - result.push("')} + scripts.forEach(function(s) { + s = s.replace(/"/g, ""); + if (s == "ace/ace") { + comment("load ace"); + script("ace"); + } else { + var extName = s.match(/[^/]*$/)[0]; + comment("load ace " + extName + " extension"); + script("ext-" + extName); + } + }); + result.push(" - diff --git a/package.json b/package.json index cbabb3a0..58aabdf9 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "asyncjs": "0.0.x", "jsdom": "0.2.x", "amd-loader": "~0.0.4", - "dryice": "0.4.10" + "dryice": "0.4.11" }, "mappings": { "ace": "."