mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-23 13:48:49 +00:00
77d15a8645
allowed backend tab to be accessible from `/embark`, `/backend`, and `/admin` added contracts apis to support intended functionality in the backend tab starting webserver service with plugins passed in to get api registrations added filesystem methods for reading directories removed duplicate method in plugin.js updated avatar for backend tab (did not exist in SCM) updated compiled contract properties for display (maybe they've changed) updated console command to get web3 host
126 lines
2.4 KiB
JavaScript
126 lines
2.4 KiB
JavaScript
const parseJson = require('parse-json');
|
|
let fs = require('fs-extra');
|
|
let utils = require('../utils/utils.js');
|
|
require('colors');
|
|
|
|
function mkdirpSync() {
|
|
return fs.mkdirpSync.apply(fs.mkdirpSync, arguments);
|
|
}
|
|
|
|
function mkdirp() {
|
|
return fs.mkdirp.apply(fs.mkdirp, arguments);
|
|
}
|
|
|
|
function copy() {
|
|
return fs.copy.apply(fs.copy, arguments);
|
|
}
|
|
|
|
function copySync() {
|
|
return fs.copySync.apply(fs.copySync, arguments);
|
|
}
|
|
|
|
function move(){
|
|
return fs.move.apply(fs.move, arguments);
|
|
}
|
|
|
|
function appendFileSync() {
|
|
return fs.appendFileSync.apply(fs.writeFileSync, arguments);
|
|
}
|
|
|
|
function writeFile() {
|
|
return fs.writeFile.apply(fs.writeFileSync, arguments);
|
|
}
|
|
|
|
function writeFileSync() {
|
|
return fs.writeFileSync.apply(fs.writeFileSync, arguments);
|
|
}
|
|
|
|
function readFile() {
|
|
return fs.readFile.apply(fs.readFile, arguments);
|
|
}
|
|
|
|
function readFileSync() {
|
|
return fs.readFileSync.apply(fs.readFileSync, arguments);
|
|
}
|
|
|
|
function readJSONSync() {
|
|
let content = readFileSync.apply(readFileSync, arguments);
|
|
try {
|
|
return parseJson(content);
|
|
} catch(e) {
|
|
console.error("error: ".red + arguments[0].green.underline + " " + e.message.green);
|
|
process.exit(0);
|
|
}
|
|
}
|
|
|
|
function writeJSONSync() {
|
|
return fs.writeJSONSync.apply(fs.writeJSONSync, arguments);
|
|
}
|
|
|
|
function writeJson() {
|
|
return fs.writeJson.apply(fs.writeJson, arguments);
|
|
}
|
|
|
|
function existsSync() {
|
|
return fs.existsSync.apply(fs.existsSync, arguments);
|
|
}
|
|
|
|
function access() {
|
|
return fs.access.apply(fs.access, arguments);
|
|
}
|
|
|
|
function removeSync() {
|
|
return fs.removeSync.apply(fs.removeSync, arguments);
|
|
}
|
|
|
|
// returns embarks root directory
|
|
function embarkPath(fileOrDir) {
|
|
return utils.joinPath(__dirname, '/../../', fileOrDir);
|
|
}
|
|
|
|
function dappPath() {
|
|
return utils.joinPath(utils.pwd(), ...arguments);
|
|
}
|
|
|
|
function createWriteStream() {
|
|
return fs.createWriteStream.apply(fs.createWriteStream, arguments);
|
|
}
|
|
|
|
function tmpDir() {
|
|
let os = require('os');
|
|
return utils.joinPath(os.tmpdir(), ...arguments);
|
|
}
|
|
|
|
function readdirSync() {
|
|
return fs.readdirSync.apply(fs.readdirSync, arguments);
|
|
}
|
|
|
|
function readdir() {
|
|
return fs.readdir.apply(fs.readdirSync, arguments);
|
|
}
|
|
|
|
module.exports = {
|
|
mkdirpSync,
|
|
mkdirp,
|
|
copy,
|
|
copySync,
|
|
move,
|
|
readFile,
|
|
readFileSync,
|
|
appendFileSync,
|
|
writeFile,
|
|
writeFileSync,
|
|
readJSONSync,
|
|
writeJson,
|
|
writeJSONSync,
|
|
access,
|
|
existsSync,
|
|
removeSync,
|
|
embarkPath,
|
|
dappPath,
|
|
createWriteStream,
|
|
tmpDir,
|
|
readdirSync,
|
|
readdir
|
|
};
|