Prefer const/let over var
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// writes helpers require for vnc.html (they should output app.js)
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// util.promisify requires Node.js 8.x, so we have our own
|
||||
function promisify(original) {
|
||||
return function () {
|
||||
let obj = this;
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
const obj = this;
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
return new Promise((resolve, reject) => {
|
||||
original.apply(obj, args.concat((err, value) => {
|
||||
if (err) return reject(err);
|
||||
@@ -22,12 +22,12 @@ module.exports = {
|
||||
'amd': {
|
||||
appWriter: (base_out_path, script_base_path, out_path) => {
|
||||
// setup for requirejs
|
||||
let ui_path = path.relative(base_out_path,
|
||||
const ui_path = path.relative(base_out_path,
|
||||
path.join(script_base_path, 'app', 'ui'));
|
||||
return writeFile(out_path, `requirejs(["${ui_path}"], function (ui) {});`)
|
||||
.then(() => {
|
||||
console.log(`Please place RequireJS in ${path.join(script_base_path, 'require.js')}`);
|
||||
let require_path = path.relative(base_out_path,
|
||||
const require_path = path.relative(base_out_path,
|
||||
path.join(script_base_path, 'require.js'))
|
||||
return [ require_path ];
|
||||
});
|
||||
@@ -40,8 +40,8 @@ module.exports = {
|
||||
opts.plugins.unshift("add-module-exports");
|
||||
},
|
||||
appWriter: (base_out_path, script_base_path, out_path) => {
|
||||
var browserify = require('browserify');
|
||||
var b = browserify(path.join(script_base_path, 'app/ui.js'), {});
|
||||
const browserify = require('browserify');
|
||||
const b = browserify(path.join(script_base_path, 'app/ui.js'), {});
|
||||
return promisify(b.bundle).call(b)
|
||||
.then((buf) => writeFile(out_path, buf))
|
||||
.then(() => []);
|
||||
@@ -51,15 +51,15 @@ module.exports = {
|
||||
},
|
||||
'systemjs': {
|
||||
appWriter: (base_out_path, script_base_path, out_path) => {
|
||||
let ui_path = path.relative(base_out_path,
|
||||
const ui_path = path.relative(base_out_path,
|
||||
path.join(script_base_path, 'app', 'ui.js'));
|
||||
return writeFile(out_path, `SystemJS.import("${ui_path}");`)
|
||||
.then(() => {
|
||||
console.log(`Please place SystemJS in ${path.join(script_base_path, 'system-production.js')}`);
|
||||
// FIXME: Should probably be in the legacy directory
|
||||
let promise_path = path.relative(base_out_path,
|
||||
const promise_path = path.relative(base_out_path,
|
||||
path.join(base_out_path, 'vendor', 'promise.js'))
|
||||
let systemjs_path = path.relative(base_out_path,
|
||||
const systemjs_path = path.relative(base_out_path,
|
||||
path.join(script_base_path, 'system-production.js'))
|
||||
return [ promise_path, systemjs_path ];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user