Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (dev) {
minor = String(parseInt(minor) + 1);
}
// Generate the version file contents.
var contents =
"# DO NOT EDIT! NPM AUTOMATICALLY WRITES THIS FILE!\nversion_info = (" +
major + ", " +
minor + ", " +
patch +
(dev ? ", 'dev'" : "") +
")\n__version__ = '.'.join(map(str, version_info))\n";
// Write the contents to the file.
var fs = require("fs");
fs.writeFile("_version.py", contents, function(err) {
if(err) {
console.error("Could not write the Python version file", err);
process.exit(1);
} else {
console.log("Python version " + major + "." + minor + "." + patch + (dev ? "dev" : "") + " written");
}
});
}, function(err, result) {
if (err) console.error(err)
else {
fs.writeFile(outfile,result.css.toString(),'utf8',function(err){
if (err) console.warn(err.message);
});
}
});
}
.end((err, res) => {
if (err) callback(err)
let filepath = url.split('/')[url.split('/').length - 1]
if (!fs.existsSync(filepath) || (fs.existsSync(filepath) && fs.writeFileSync(filepath) != res.body)) {
fs.writeFile(filepath, res.body, (err) => {
callback(null, filepath)
})
}
})
}
export default function updateSettings(newsettings) {
//console.log(settingsconf)
//console.log(newsettings)
if (!fs.existsSync(prismdir)) {
fs.mkdirSync(prismdir);
fs.writeFile(settingsconf, '{"test":"tmp"}');
}
//Get current configuration
//let curconf = JSON.parse(fs.readFileSync(settingsconf));
//console.log(curconf)
fs.writeFile(settingsconf, JSON.stringify(newsettings), function(err) {
if(err) {
return console.log(err);
}
console.log("Prismatica configuration updated!");
});
}
specCollector(config.glob, function(specs) {
fs.writeFile(config.specFile, JSON.stringify(specs, null, 4), function (err) {
if (err) throw err;
fileCollector(config.specFile, config.comparisonFile, function(files){
var results = inspector(files);
var output = spitterOuter(results);
for (var i = 0; i < output.length; i++) {
console.log(output[i]);
}
});
});
});
contents.printToPDF({landscape: pageSettings.orientation === 1}, (error, data) => {
if (error) {
cb('not_saved')
return
}
fs.writeFile(filepaths[0], data, (error) => {
if (error) {
cb('not_saved')
return
}
cb('saved')
})
})
})
return function(callback) {
fs.writeFile(groupPath, data.embedded.plain, 'utf-8', callback);
};
};
templateContextMap[templatePath](project, req, db, function(data) {
var template = handlebars.compile(contents);
var newContents = template(data);
fs.writeFile(filePath, newContents, function(err) {
if (err) {
throw err;
}
});
});
});
saveCss(event, css) {
_bd_fs.writeFile(`${_bd_config.dataPath}/custom.css`, css, 'utf-8', err => {
if (err) {
event.sender.send('save-error', err);
return;
}
event.sender.send('save-ok');
});
}
}