Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
process.exit(-1)
}
var oldVersion = config.currVersion
var newVersion = semver.inc(config.currVersion, config.mode)
var bumpedPkgJson = _.clone(config.pkgJson)
bumpedPkgJson.version = newVersion
var oldVersionRegExpGlobal = new RegExp(oldVersion, "g")
var bumpedApiString = config.apiString.replace(
oldVersionRegExpGlobal,
newVersion
)
jf.writeFileSync(config.packagePath, bumpedPkgJson, { spaces: 2 })
fs.writeFileSync(config.versionPath, bumpedApiString)
// updating CHANGELOG.md date
var nowDate = new Date()
var nowDateString = nowDate.toLocaleDateString("en-US").replace(/\//g, "-")
var changeLogDate = config.changeLogString.replace(
dateTemplateRegExp,
"## " + newVersion + " " + "(" + nowDateString + ")"
)
fs.writeFileSync(config.changeLogPath, changeLogDate)
var docsOldVersionRegExp = new RegExp(oldVersion.replace(/\./g, "_"), "g")
_.forEach(config.docFilesPaths, function(currDocPath) {
console.log("bumping file: <" + currDocPath + ">")
var currItemContents = fs.readFileSync(currDocPath, "utf8").toString()
var bumpedItemContents = currItemContents.replace(
export default function(path){
// add path to current paths
const paths = json.readFileSync(join(cwd, 'path.json'));
if (paths.indexOf(path) !== -1){
console.log(red(`Path ${path} already exists in paths`));
return;
}
paths.push(path);
json.writeFileSync(join(cwd, 'path.json'), paths, {spaces: 2});
// give instruction on how to load
console.log(yellow(`Added ${path} to paths config`));
console.log(`Run ${green('al load')} to load config`);
}
.then((maybeData) => {
if (maybeData) {
model.data = maybeData;
}
// now write out the file...
jsonfile.writeFileSync(fileName, model, {spaces: 2});
console.info(`Done. Exported "${model.item.title}" to ${fileName}`);
})
.catch((err) => {
function _initDB (file) {
// init DB.
var db = {} // init empty db
jsonfile.writeFileSync(file, db, {spaces: 2})
}
return new Promise(resolve => {
let file = AssistantSetup.getAbsolutePath()+'/config/client_secret.json';
jsonfile.writeFileSync(file, object, function (err) {
if (err) {
console.log('writeClientSecretJSON error: '+err)
}
});
resolve(true);
});
}
taskJsonFiles.forEach(function(taskJsonFile) {
console.log("Updating: " + taskJsonFile);
if (fs.existsSync(taskJsonFile)) {
var task = jsonfile.readFileSync(taskJsonFile);
task["version"] = newVersion;
jsonfile.writeFileSync(taskJsonFile, task, {spaces: 2, EOL: '\r\n'});
}
});
});
function recreateTempIndex() {
let indexMeta = readIndexMeta()
try {
indexMeta.version ++
INDEX_VERSION = indexMeta.version
indexMeta.updated = new Date()
jsonFile.writeFileSync(INDEX_META_PATH, indexMeta)
} catch (err) {
console.error(err)
}
let step2 = () => {
client.indices.create({ index: `${config.elasticsearch.indexName}_${INDEX_VERSION}` }).then(result=>{
console.log('Index Created', result)
console.log('** NEW INDEX VERSION', INDEX_VERSION, INDEX_META_DATA.created)
}).then((result) => {
putMappings(client, `${config.elasticsearch.indexName}_${INDEX_VERSION}`, () => {})
})
}
return client.indices.delete({
index: `${config.elasticsearch.indexName}_${INDEX_VERSION}`
.src('./dist/' + pkg.name + '.js')
.pipe(header(distHeader))
.pipe(gulp.dest('./dist/'))
.pipe(uglify())
.pipe(rename(pkg.name + '.min.js'))
.pipe(header(distHeader))
.pipe(gulp.dest('./dist/'));
bower.name = pkg.name;
bower.description = pkg.description;
bower.version = pkg.version;
bower.keywords = pkg.keywords;
bower.license = pkg.license;
bower.authors = [pkg.author];
jsonfile.writeFileSync('./bower.json', bower);
});
manifest["-ms-preload"] = {
"backgroundScript": "backgroundScriptsAPIBridge.js",
"contentScript": "contentScriptsAPIBridge.js"
};
}
var targetFileName;
switch (whichBrowser) {
case "chrome": targetFileName = "manifest-chrome.json"; break;
case "edge": targetFileName = "manifest-edge.json"; break;
case "firefox": targetFileName = "manifest-firefox.json"; break;
case "opera": targetFileName = "manifest-opera.json"; break;
default: targetFileName = "manifest.json"; break;
}
process.stdout.write("Generating " + targetFileName + " : ");
jsonfile.writeFileSync(path.join(__dirname, targetFileName), manifest, {spaces: 4});
process.stdout.write(chalk.green(" ✓") + "\n");
};
newSnippet = {
id: id,
name: req.body.name,
code: req.body.code,
description: req.body.description,
inlineCss: req.body.inlineCss,
includeJs: req.body.includeJs,
isEdited: false,
isDeleted: false
};
dataStore.push(newSnippet);
uniques.push(id);
jf.writeFileSync(dataPath, dataStore);
jf.writeFileSync(config.uniques, uniques);
newSnippet.category = Number(req.body.category);
res.json(newSnippet);
});