Let’s make our build system great (and fast) again

This commit is contained in:
Artur Paikin 2016-01-16 01:46:27 -05:00
parent 1c64d07bbe
commit 0fc2191fbf
4 changed files with 15 additions and 12 deletions

View file

@ -11,7 +11,7 @@
"build:umd": "./bin/build-umd && ./bin/build-umd-locale",
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min && npm run build:css",
"clean": "rm -rf lib && rm -rf dist",
"docs": "cd website && node documentation.js",
"docs": "cd website && node build-documentation.js",
"lint": "eslint src/**/*.js",
"server": "browser-sync start --config .browsersync.js",
"start": "npm run build && npm run web",
@ -22,13 +22,13 @@
"watch:css": "nodemon --watch src --ext scss -x \"npm run build && node website/update.js\"",
"watch:examples": "cd website && node build-examples.js watch",
"watch:js": "nodemon --watch src --ext js -x \"npm run build && node website/update.js\"",
"watch": "nodemon --watch src --ext scss,js -x \"npm run build && node website/update.js\"",
"web:build": "cd website && node update.js && ./node_modules/.bin/hexo generate",
"watch": "nodemon --watch src --ext scss,js -x \"npm run build:umd && npm run build:css && node website/update.js\"",
"web:build": "cd website && node update.js && npm run docs && ./node_modules/.bin/hexo generate ",
"web:clean": "cd website && ./node_modules/.bin/hexo clean",
"web:deploy": "npm run web:install && npm run web:disc && npm run web:build && ./bin/web-deploy",
"web:disc": "npm run build:umd:fullpath && discify dist/uppy-fp.js --output website/src/_disc.html && echo '---\nlayout: false\n---\n' |cat - website/src/_disc.html > website/src/disc.html && rm website/src/_disc.html",
"web:install": "cd website && rm -rf node_modules/hexo-renderer-uppyexamples && npm install",
"web:preview": "cd website && ./node_modules/.bin/hexo server --debug",
"web:preview": "cd website && ./node_modules/.bin/hexo server --debug & npm run watch:examples",
"web:update-frontpage-code-sample": "cd website && ./node_modules/.bin/hexo generate && cp -f public/frontpage-code-sample.html ./themes/uppy/layout/partials/frontpage-code-sample.html",
"web": "npm run web:install && npm run web:clean && npm run web:build && npm run web:preview"
},

View file

@ -5,7 +5,7 @@ var inject = require('mdast-util-inject');
var chalk = require('chalk');
var fs = require('fs');
var docOrder = ['Core'];
var docOrder = ['Core', 'Translator', 'Plugin'];
documentation('../src/index.js', {order: docOrder}, function (err, comments) {
if (err) console.log(err);

View file

@ -33,8 +33,8 @@ var watchify = require('watchify');
var webRoot = __dirname;
var uppyRoot = path.dirname(webRoot);
var srcPattern = webRoot + '/src/examples/**/js/app.es6';
var dstPattern = webRoot + '/public/examples/**/js/app.js';
var srcPattern = webRoot + '/src/examples/**/app.es6';
var dstPattern = webRoot + '/public/examples/**/app.js';
var watchifyEnabled = process.argv[2] === 'watch';
var browserifyPlugins = [];
@ -105,7 +105,7 @@ glob(srcPattern, function(err, files) {
}
});
var exampleName = path.basename(path.dirname(path.dirname(file)));
var exampleName = path.basename(path.dirname(file));
var output = dstPattern.replace('**', exampleName);
var parentDir = path.dirname(output);

View file

@ -10,8 +10,7 @@ var webRoot = path.dirname(path.dirname(__dirname));
var uppyRoot = path.dirname(webRoot);
var browserifyScript = webRoot + '/build-examples.js'
hexo.extend.renderer.register('es6', 'js', function(data, options, callback) {
function parseExamplesBrowserify (data, options, callback) {
if (!data || !data.path) {
return callback(null);
}
@ -32,7 +31,7 @@ hexo.extend.renderer.register('es6', 'js', function(data, options, callback) {
hexo.log.i('hexo-renderer-uppyexamples: ' + stdout.trim());
fs.readFile(tmpFile, 'utf-8', function(err, bundledJS) {
fs.readFile(tmpFile, 'utf-8', function (err, bundledJS) {
if (err) {
return callback(err);
}
@ -41,8 +40,12 @@ hexo.extend.renderer.register('es6', 'js', function(data, options, callback) {
// @TODO remove this hack
// once this is resolved: https://github.com/hexojs/hexo/issues/1663
bundledJS = bundledJS.replace(/</g, ' < ');
// bundledJS = bundledJS.replace(/<(?!=)/g, ' < ');
callback(null, bundledJS);
});
});
});
}
// hexo.extend.renderer.register('es6', 'js', parseExamplesBrowserify);