Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else {
t = timeSlot('day');
}
ev = {
action: action,
time: t + (dayTime*h)
};
events.push(ev);
}
}
}
// WRITE IT //
var s = writeSchedule(time,events);
jsonfile.writeFile(file, s, function(err) {
if (err) {
console.log("failed to write new schedule window");
} else {
console.log("written new schedule window");
}
});
}
let countFormat = elem.length.toString()
let countNew = elem.filter(x => x).length.toString()
while (countFormat.length <= 10) {
countFormat += ' '
}
while (countNew.length <= 10) {
countNew += ' '
}
cards2Json[`${ankiDecks[i]}`] = `\tCards: ${countFormat}New: ${countNew}Due: ${ankiCardsCount[i].length - elem
.filter(x => x).length}\t\t${elem2.filter(x => x).length > 0 ? ` Suspend: ${elem2.filter(x => x).length}` : ''}`
}
/* eslint-enable no-await-in-loop */
jsonfile.writeFile(fileAnkiCards, cards2Json, {
spaces: 2
}, error => {
if (error !== null) {
process.stderr.write(error)
}
})
jsonfile.writeFile(fileAnkiModels, ankiModels, {
spaces: 2
}, error => {
if (error !== null) {
process.stderr.write(error)
}
})
alfy.cache.set('refresh-done', true)
}
return new Promise(async resolve => {
const file = 'package.json'
const obj = await readFile(file).catch(error => console.error(error));
delete obj.devDependencies;
delete obj.scripts;
await writeFile(`${outputDir}/package.json`, obj, { spaces: 4, EOL: os.EOL }).catch(error => console.error(error));
resolve();
});
}
.then(deployment => {
let madeUpdates = false;
deployment.forEach(obj => {
if (!(obj.data.connectorId)) {
return;
}
const update = optimized.find(o => o.id == obj.data.connectorId);
if (update && obj.data.icon !== update.icon) {
obj.data.icon = update.icon;
madeUpdates = true;
}
})
if (madeUpdates) {
jsonfile.writeFile(DEPLOYMENT_JSON, deployment).then(
() => jq.run('.', DEPLOYMENT_JSON, { sort: true }).then(out => fs.writeFileSync(DEPLOYMENT_JSON, out + '\n'))
)
let schemaJava = fs.readFileSync(SCHEMA_JAVA).toString();
schemaJava = schemaJava.replace(/VERSION = (\d+);/, (match, version) => 'VERSION = ' + (parseInt(version, 10) + 1) + ';');
fs.writeFileSync(SCHEMA_JAVA, schemaJava);
}
})
.catch(error => console.error(error))
jsonfile.readFile(file, function (err, project) {
project.version = semversion;
jsonfile.writeFile(file, project, {spaces: 2}, function(err) {
console.error(err);
});
})
saveConfig:function(plugin, config) {
if (plugin && config) {
var configuration = require(path.join(dirname,'configuration'));
configuration.plugins[plugin] = config;
var jsonfile = require('jsonfile');
jsonfile.writeFile(path.join(dirname, 'configuration.json'), configuration, {spaces: 2, EOL: '\r\n'}, function(err) {
if (err) console.error("[assistant-"+plugin+"] Erreur lors de la sauvegarde de la configuration : "+err);
else console.log("[assistant-"+plugin+"] Configuration sauvegardée.");
})
}
}
};
console.log(BbRole.address);
console.log('\x1b[33m%s\x1b[0m:', 'Set ContestPoolFactory Address');
console.log(ContestPoolFactory.address);
console.log('\x1b[33m%s\x1b[0m:', 'Set ResultsLookup Address');
console.log(ResultsLookup.address);
console.log('\x1b[33m%s\x1b[0m:', 'Set BbVault Address');
console.log(BbVault.address);
console.log('\x1b[33m%s\x1b[0m:', 'Set BBSettings Address');
console.log(BbSettings.address);
console.log('\x1b[33m%s\x1b[0m:', 'Set BbUpgrade Address');
console.log(BbUpgrade.address);
console.log('\x1b[33m%s\x1b[0m:', 'Set ContestPoolBase Address');
console.log(ContestPoolBase.address);
console.log('\x1b[32m%s\x1b[0m', 'Post - Storage Direct Access Removed');
jsonfile.writeFile(contractsJson, contracts, {spaces: 2, EOL: '\r\n'}, function (err) {
console.log(`JSON file created at '${contractsJson}'.`);
console.error("Errors: " + err);
});
} catch (error) {
console.error("Error on deploy: ", error);
}
return deployer;
});
(lsf, cb) => jsonfile.writeFile(lsf, newStates, cb)
],
function initialize() {
addCliCommands();
//if gtb-config doesn't exist, create it then read it and parse the cli arguments
if (_.isUndefined(gtbConfig)) {
con.log(`Creating gtb-config for the first time...`);
writeFile(gtbConfigPath, {
projects: []
}, jsonFileSettings, () => {
readGtbConfig();
parseArguments();
});
}
//if gtb config exists, just parse the arguments
else {
parseArguments();
}
}
filename => {
if (filename) {
jsonfile.writeFile(filename, arg.spec, function(err) {
if (!err) {
event.sender.send("onSaveSuccess", {
name: arg.name,
path: filename
});
}
});
}
}
);