Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function checkSchedule() {
console.log('checking schedule...');
// READ SCHEDULE JSON //
jsonfile.readFile(file, function(err, obj) {
if (err) {
console.log('schedule read error');
} else {
// IF WE'RE DUE A NEW SCHEDULE WINDOW //
var time = new Date();
var rescheduling = false;
if (obj.reschedule) {
var rescheduleTime = new Date(obj.reschedule);
if (time > rescheduleTime) {
rescheduling = true;
}
} else {
console.log('obj.reschedule not found');
rescheduling = true;
var buildNumber = version.substring(lastDash + 1, version.length);
var num = "00000000" + parseInt(buildNumber);
buildNumber = num.substr(num.length-5);
var dependsVersion = version.substring(0, lastDash) + '-*';
if (tag) {
// Turn version into tag, dependsVersion = version
version = tag;
dependsVersion = version;
} else {
version = version.substring(0, lastDash) + '-' + buildNumber;
}
jsonfile.readFile(file, function (err, project) {
if (err)
console.error(err);
console.log("Version: " + version);
console.log("Dependency Version: " + dependsVersion);
// Patch the project.version
project.version = version;
// Patch dependencies
if (project.dependencies['Steeltoe.CloudFoundry.Connector'] ) {
project.dependencies['Steeltoe.CloudFoundry.Connector'] = dependsVersion;
}
if (project.dependencies['Steeltoe.Extensions.Configuration.CloudFoundry']) {
return new Promise(function (resolve, reject) {
if (self.isMemDb) resolve(self.db)
jsonfile.readFile(self.db, function (err, obj) {
if (err) {
reject(err) // file not found
} else {
resolve(obj) // file exists
}
})
})
}
fs.writeFile(dir + "/react-js/public/index.html", dataString, function (err) {
if (err) {
return console.log(err);
} else {
console.log(dir + "/react-js/public/index.html ready to by mobile app with cordova");
//-- react package.json --//
const jsonfile = require('jsonfile');
const file = dir + '/react-js/package.json';
jsonfile.readFile(file)
.then(obj => {
obj.homepage = "./";
jsonfile.writeFile(file, obj, function (err) {
if (err) {
console.error("ERROR: add homepage to react package.json . ", err);
return;
} else {
console.log("updete homepage in react-js package.json , now it's ready to by mobile app with cordova.");
reco.replaceWwwRootDir(dir + '/cordova/www');
}
})
})
.catch(error => {
reco.setState({ error: true });
console.error("reco-cli-recoFiles=> ERROR: ", error);
fs.exists(path, function(exists) {
var data = fs.readFileSync(path);
if (exists && data.includes('vocabularyName')) {
jsonfile.readFile(path, function(err, obj) {
if (err)
console.log(err);
if (obj.hasOwnProperty('text'))
res.render('index', {
title: 'Home',
metaData: str,
homePage: obj.text
});
});
}
});
});
const path = require('path');
const jsonfile = require('jsonfile');
jsonfile
.readFile('./src/package.json')
.then(json => {
console.dir(`update version to "${json.version}"`);
jsonfile
.writeFile('./dist/package.json', json, {
spaces: 2,
EOL: '\r\n',
})
.then(res => {
console.log('Write complete : dist/package.json');
});
jsonfile.readFile('./package.json').then(obj => {
obj.version = json.version;
jsonfile
function time() {
const jsonfile = require('jsonfile');
jsonfile.readFile("apps.json", function (err, obj) {
if (err) console.error(err);
const appList = obj.apps;
for (let i = 0; i < appList.length; i++) {
if (appList[i].name == "Time") {
const dta = obj.apps[i].config;
const timeDiv = document.getElementById(dta.div);
const showSeconds = dta.showseconds;
const twentyFourHourClock = dta.twentyfourhourclock;
var date = new Date();
var dayList = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var day = dayList[date.getDay()];
var monthList = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var month = monthList[date.getMonth()];
var year = date.getFullYear();
var dateNumb = date.getDate();
})
reporter.writeReportToFile()
logger.info('[FINISHED]: Code.json processing')
})
.catch(function (err) {
logger.error(err)
})
}
logger.info('[STARTED]: Code.json processing')
const reporter = new Reporter({REPORT_FILEPATH: './data/report.json'}, logger)
JsonFile.readFile('./data/agencyMetadata.json', (error, agencies) => {
main(agencies, reporter)
})