Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
msvs_version,
debug,
runtime,
electronVersion: dependentElectronVersion
});
console.log(script);
// print build info
signale.info("Package Version =", packageVersion);
signale.info("Platform =", platform);
signale.info("Dependent Electron Version =", dependentElectronVersion);
signale.info("Build Runtime =", runtime, "\n");
// create two stream and start
signale.pending("Build C++ addon for Agora Electron SDK...\n");
const errLogWriteStream = fs.createWriteStream("error-log.txt", {
flags: "a"
});
const buildStream = shell.exec(
script,
{
silent: silent
},
(code, stdout, stderr) => {
if (code !== 0) {
// failed
errLogWriteStream.write(stderr, "utf8");
signale.fatal(
"Failed to build, check complete error log in",
shell.pwd() + "/error-log.txt\n"
);
async function shutdown() {
logger.pending("Shutting down...");
// attempts to cleanup docker containers
await execa.sync(
'docker kill $(docker ps -q --filter "label=wflow") || true',
{ shell: true }
);
// removes all data from workspaces
rimraf.sync(`${tempDirectory}/wflow`);
logger.success("Thanks for using Workflow!");
process.exit();
}
rimraf(removeDir, err => {
if (err) {
signale.fatal(err);
process.exit(1);
}
// print download info
signale.info('Package Version =', packageVersion);
signale.info('Platform =', platform);
signale.info('Dependent Electron Version =', dependentElectronVersion);
signale.info('Download Url =', downloadUrl, '\n');
// start
signale.pending('Downloading prebuilt C++ addon for Agora Electron SDK...\n');
download(downloadUrl, outputDir, {
strip: 1,
extract: true
}).then(() => {
signale.success('Success', 'Download finished');
}).catch(err => {
signale.fatal('Failed', err);
});
});
};
{ type: "app", trigger: "Ctrl+Shift+I", action: "DEV_DEBUG", enabled: false },
{ type: "app", trigger: "Ctrl+Shift+F5", action: "DEV_RELOAD", enabled: true },
{ type: "shell", trigger: "Ctrl+Shift+Alt+Space", action: "neofetch", linebreak: true, enabled: false }
], "", 4));
signale.info(`Default keymap written to ${shortcutsFile}`);
}
//Create default window state file
if(!fs.existsSync(lastWindowStateFile)) {
fs.writeFileSync(lastWindowStateFile, JSON.stringify({
useFullscreen: true
}, "", 4));
signale.info(`Default last window state written to ${lastWindowStateFile}`);
}
// Copy default themes & keyboard layouts & fonts
signale.pending("Mirroring internal assets...");
try {
fs.mkdirSync(themesDir);
} catch(e) {
// Folder already exists
}
fs.readdirSync(innerThemesDir).forEach(e => {
fs.writeFileSync(path.join(themesDir, e), fs.readFileSync(path.join(innerThemesDir, e), {encoding:"utf-8"}));
});
try {
fs.mkdirSync(kblayoutsDir);
} catch(e) {
// Folder already exists
}
fs.readdirSync(innerKblayoutsDir).forEach(e => {
fs.writeFileSync(path.join(kblayoutsDir, e), fs.readFileSync(path.join(innerKblayoutsDir, e), {encoding:"utf-8"}));
});
const Handlebars = require('handlebars')
const fs = require('fs')
const signale = require('signale');
// plugins
const layouts = require('metalsmith-layouts')
const permalinks = require('metalsmith-permalinks')
const define = require('metalsmith-define')
// data
const langs = require('./langs.json')
const jsonpkg = require('../../package.json')
// handlebars helpers
Handlebars.registerHelper('to_lowercase', str => str.toLowerCase())
signale.pending('Build page initiated...');
Metalsmith(__dirname)
.use(define({
'langs': langs,
'version': jsonpkg.version
}))
.use(layouts({
'engine': 'handlebars',
'partials': 'partials',
'pattern': '**/*.html',
'default': 'default.html',
'cache': false
}))
.use(permalinks(':lang/'))
.destination('../../lang')
function generateTestData() {
signale.pending('Generating example data...');
function populateStateForRecoveryTests() {
const exId = jobList.shift();
if (!exId) return Promise.resolve(true);
const client = misc.es();
return misc.teraslice().cluster.get(`/ex/${exId}`)
.then((exConfig) => {
exConfig.ex_id = 'testex';
const date = new Date();
const iso = date.toISOString();
const index = `teracluster__state-${iso.split('-').slice(0, 2).join('.')}`;
const time = date.getTime();
const pastDate = new Date(time - 600000);
exConfig.operations[1].index = 'test-recovery-300';
exConfig._status = 'failed';
function dockerUp() {
signale.pending('Bringing Docker environment up...');
return misc.compose
.up({
build: '',
timeout: 5,
})
.then(() => waitForClusterMaster())
.then(() => {
signale.success('Docker environment is good to go');
});
}
function waitForTerasliceNodes() {
signale.pending('Waiting for Teraslice...');
return forNodes(4).then(() => {
signale.success('Teraslice is ready');
});
}