|
@@ -12,7 +12,8 @@ const browserifyScript = `${webRoot}/build-examples.js`
|
|
|
|
|
|
function parseExamplesBrowserify (data, options, callback) {
|
|
function parseExamplesBrowserify (data, options, callback) {
|
|
if (!data || !data.path) {
|
|
if (!data || !data.path) {
|
|
- return callback(null)
|
|
|
|
|
|
+ callback(null)
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
|
|
if (!data.path.match(/\/examples\//)) {
|
|
if (!data.path.match(/\/examples\//)) {
|
|
@@ -26,20 +27,24 @@ function parseExamplesBrowserify (data, options, callback) {
|
|
// hexo.log.i('hexo-renderer-uppyexamples: change detected in examples. running: ' + cmd);
|
|
// hexo.log.i('hexo-renderer-uppyexamples: change detected in examples. running: ' + cmd);
|
|
exec(cmd, (err, stdout) => {
|
|
exec(cmd, (err, stdout) => {
|
|
if (err) {
|
|
if (err) {
|
|
- return callback(err)
|
|
|
|
|
|
+ callback(err)
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
|
|
hexo.log.i(`hexo-renderer-uppyexamples: ${stdout.trim()}`)
|
|
hexo.log.i(`hexo-renderer-uppyexamples: ${stdout.trim()}`)
|
|
|
|
|
|
|
|
+ // eslint-disable-next-line no-shadow
|
|
fs.readFile(tmpFile, 'utf-8', (err, bundledJS) => {
|
|
fs.readFile(tmpFile, 'utf-8', (err, bundledJS) => {
|
|
if (err) {
|
|
if (err) {
|
|
- return callback(err)
|
|
|
|
|
|
+ callback(err)
|
|
|
|
+ return
|
|
}
|
|
}
|
|
// hexo.log.i('hexo-renderer-uppyexamples: read: ' + tmpFile);
|
|
// hexo.log.i('hexo-renderer-uppyexamples: read: ' + tmpFile);
|
|
|
|
|
|
// @TODO remove this hack
|
|
// @TODO remove this hack
|
|
// once this is resolved: https://github.com/hexojs/hexo/issues/1663
|
|
// once this is resolved: https://github.com/hexojs/hexo/issues/1663
|
|
// bundledJS = bundledJS.replace(/</g, ' < ');
|
|
// bundledJS = bundledJS.replace(/</g, ' < ');
|
|
|
|
+ // eslint-disable-next-line no-param-reassign
|
|
bundledJS = bundledJS.replace(/<(?!=)/g, ' < ')
|
|
bundledJS = bundledJS.replace(/<(?!=)/g, ' < ')
|
|
|
|
|
|
callback(null, bundledJS)
|
|
callback(null, bundledJS)
|