Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (hasBugFixes && !hasFeaturesWithBugFixes) {
// there are bug fixes with no minor features
recommendedType = TYPE_PATCH;
}
if (hasBreakingChanges) {
// detected breaking changes
recommendedType = TYPE_MAJOR;
}
const humanReadableRecommendation = humanReadableTypes[recommendedType];
console.log(chalk.magenta('Detected the following unreleased changes from CHANGELOG.md'));
console.log('');
console.log(chalk.gray(unreleasedchanges));
console.log('');
console.log(`${chalk.magenta('The recommended version update for these changes is')} ${chalk.blue(humanReadableRecommendation)}`);
console.log(`${chalk.magenta('What part of the package version do you want to bump?')} ${chalk.gray('(major, minor, patch)')}`);
return await promptUserForVersionType();
}
${chalk.bold(`clone`)} ${chalk.gray(`[--cached] [directory]`)} - copy a dat into a dir
${chalk.bold(`pull`)} ${chalk.gray(`[--live] [directory]`)} - pull the latest version of a dat
${chalk.bold(`Open in beaker:`)}
${chalk.bold(`open`)} ${chalk.gray(`[directory]`)} - open the dat in a folder
${chalk.bold(`dev`)} ${chalk.gray(`[directory]`)} - create and open a temporary live-watching dat
${chalk.bold(`Management:`)}
${chalk.bold(`ls`)} ${chalk.gray(`[--mine]`)} - list dats saved in beaker
${chalk.bold(`save`)} - save a dat to beaker
${chalk.bold(`unsave`)} - unsave a dat from beaker
${chalk.blue(`Learn more at https://github.com/beakerbrowser/bkr`)}
`)
process.exit(err ? 1 : 0)
}
const render = (options, template, out) => {
const argumentsArr =
options.arguments.length > 0 ? options.arguments.split(',') : []
const args =
argumentsArr.length > 0
? argumentsArr.length > 1 ? `(${options.arguments})` : options.arguments
: '()'
const extendedOptions = Object.assign({}, options, {
arguments: args
})
chalk.blue(extendedOptions)
const input = path.join(templates, template)
const output = path.join(src, options.destination, options.name, out)
const code = ejs.render(fs.readFileSync(input, 'utf8'), extendedOptions)
fs.writeFileSync(output, code)
}
const questions = [{
type: 'input',
name: 'address',
message: chalk.blue(' proxy address: ')
}, {
type: 'input',
name: 'port',
message: chalk.blue(' proxy port: ')
}, {
type: 'input',
name: 'user',
message: chalk.blue(` user ${chalk.grey(`(optional)`)}: `)
}, {
type: 'input',
name: 'pass',
message: chalk.blue(` pass ${chalk.grey(`(optional)`)}: `)
}];
this.prompt(questions, function (data) {
app.clerk.prefs.set('proxy', 'on');
app.clerk.prefs.set('proxy-address', data.address);
app.clerk.prefs.set('proxy-port', data.port);
app.clerk.prefs.set('proxy-user', data.user);
app.clerk.prefs.set('proxy-pass', data.pass);
self.log('\n Great! Try out your connection.\n');
cb();
});
});
async function openChannels() {
let str = `${chalk.yellow('ChannelId:'.padEnd(64, ' '))} - ${chalk.blue('PeerId:')}\n`
try {
str += await node.paymentChannels.getAllChannels(
channel => {
if (!channel.state.counterparty)
return `${chalk.yellow(channel.channelId.toString('hex'))} - ${chalk.gray('pre-opened')}`
return pubKeyToPeerId(channel.state.counterparty).then(
peerId => `${chalk.yellow(channel.channelId.toString('hex'))} - ${chalk.blue(peerId.toB58String())}`
)
},
promises => {
if (promises.length == 0) return `\n No open channels.`
return Promise.all(promises).then(results => results.join('\n'))
function changePackage (choices: Choices) {
spinner.start(chalk.blue(`[${currentStep}/${stepNum}] Edit package.json`))
return new Promise((resolve) => {
fs.readFile(`${process.cwd()}/${program.init}/package.json`, (err: Object, data: Object) => {
if (err) throw err
const _data = JSON.parse(data.toString())
_data.name = program.init
_data.description = choices.description
_data.version = '1.0.0'
const str = JSON.stringify(_data, null, 2)
fs.writeFile(`${process.cwd()}/${program.init}/package.json`, str, function (err: Object) {
if (!err) {
spinner.succeed(chalk.blue(`[${currentStep}/${stepNum}] Edit package.json`))
currentStep++
resolve()
} else {
spinner.fail(chalk.blue(`[${currentStep}/${stepNum}] Edit package.json`))
.then((manifest) => {
logger.info(`Creating deployment ${chalk.blue(deploymentName)} with manifest:`);
logger.debug(manifest.toString());
return deploymentApi.createOrUpdateDeployment(deploymentName, projectKey, manifest);
});
};
"use strict";
require("source-map-support/register");
var actionAdd = require("./utils/actionAdd");
var actionUpdate = require("./utils/actionUpdate");
var actionDelete = require("./utils/actionDelete");
var algoliaSearch = require("algoliasearch");
var chalk = require("chalk");
var dotenv = require("dotenv").config();
var fs = require("fs");
var getLocalIndex = require("./utils/getLocalIndex");
var getRemoteIndex = require("./utils/getRemoteIndex");
var calculateOperations = require("./utils/calculateOperations");
var title = "[" + chalk.blue("Algolia") + "]";
module.exports = function update(indexName, indexData, options, cb) {
try {
if (!indexName) throw new Error("Please provide `indexName`");
if (!indexData) throw new Error("Please provide `indexData`. A valid Javacript object or path to a JSON file.");
if (typeof options === "function" && typeof cb !== "function") {
cb = options;
}
var client = algoliaSearch(process.env.ALGOLIA_APP_ID, process.env.ALGOLIA_ADMIN_KEY);
var index = client.initIndex(indexName);
var newIndex = getLocalIndex(indexData);
})
);
output += " ops/sec";
output += chalk.gray(" ±");
output += (margin > 5 ? chalk.red : margin > 2 ? chalk.yellow : chalk.green)(
margin.toLocaleString("en", {
style: "decimal",
useGrouping: false,
minimumFractionDigits: 2
})
);
output += chalk.blue("%");
output += chalk.gray(
` (${samples} ${samples === 1 ? "run" : "runs"} sampled)`
);
return output;
}
const hr = message => print(chalk.blue(`---------- ${message} ----------`));