Skip to content

Commit

Permalink
chore: update dependencies (#371)
Browse files Browse the repository at this point in the history
Most semver-major bumps are for dropping Node.js 6 support.
  • Loading branch information
Alicia Lopez committed Oct 25, 2019
1 parent deb4c14 commit 705d983
Show file tree
Hide file tree
Showing 24 changed files with 177 additions and 171 deletions.
12 changes: 6 additions & 6 deletions bin/ncu-ci
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ const argv = yargs
.argv;

const commandToType = {
'commit': COMMIT,
'pr': PR,
'benchmark': BENCHMARK
commit: COMMIT,
pr: PR,
benchmark: BENCHMARK
};

class CICommand {
Expand Down Expand Up @@ -203,7 +203,7 @@ class CICommand {
if (this.markdown) {
clipboardy.writeSync(this.markdown);
cli.separator('');
cli.log(`Written markdown to clipboard`);
cli.log('Written markdown to clipboard');
} else {
cli.error('No markdown generated');
}
Expand Down Expand Up @@ -289,7 +289,7 @@ class JobCommand extends CICommand {
class URLCommand extends CICommand {
async initialize() {
const { argv, cli, request, queue } = this;
let parsed = parseJobFromURL(argv.url);
const parsed = parseJobFromURL(argv.url);
if (parsed) {
queue.push({
type: parsed.type,
Expand Down Expand Up @@ -357,6 +357,6 @@ async function main(command, argv) {
}

function handler(argv) {
const [ command ] = argv._;
const [command] = argv._;
runPromise(main(command, argv));
}
5 changes: 3 additions & 2 deletions bin/ncu-team
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ async function main(argv) {
});
const request = new Request(credentials);

const [ command ] = argv._;
const [command] = argv._;
switch (command) {
case 'list':
case 'list': {
const info = new TeamInfo(cli, request, argv.org, argv.team);
await info.listMembers();
break;
}
case 'sync':
await TeamInfo.syncFile(cli, request, argv.file);
break;
Expand Down
2 changes: 1 addition & 1 deletion lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function auth(
}

if (options.jenkins) {
let { username, jenkins_token } = getMergedConfig();
const { username, jenkins_token } = getMergedConfig();
if (!username || !jenkins_token) {
process.stdout.write(
'Get your Jenkins API token in https://ci.nodejs.org/me/configure ' +
Expand Down
2 changes: 1 addition & 1 deletion lib/backport_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class BackportSession extends Session {
const cherries = commits.map(i => i.sha).reverse();
const pendingCommands = [
`git cherry-pick ${cherries.join(' ')}`,
`git push -u <your-fork-remote> <your-branch-name>`
'git push -u <your-fork-remote> <your-branch-name>'
];
const shouldPick = await cli.prompt(
'Do you want to cherry-pick the commits?');
Expand Down
2 changes: 1 addition & 1 deletion lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Cache {
}

wrap(Class, identities) {
for (let method of Object.keys(identities)) {
for (const method of Object.keys(identities)) {
const original = Class.prototype[method];
const identity = identities[method];
this.originals[method] = original;
Expand Down
16 changes: 8 additions & 8 deletions lib/ci/ci_result_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class TestBuild extends Job {
const builtOn = failure.builtOn ? `On ${failure.builtOn}: ` : '';
output += `\n\n${builtOn}${failure.reason}\n`;
} else {
output += `\n\n`;
output += '\n\n';
const builtOn = failure.builtOn ? ` on ${failure.builtOn}:` : '';
output += fold(`See failures${builtOn}`, failure.reason) + '\n\n';
}
Expand Down Expand Up @@ -378,7 +378,7 @@ function pad(any, length) {
return (any + '').padEnd(length);
}

const kHealthKeys = [ 'success', 'pending', 'aborted', 'failed', 'unstable' ];
const kHealthKeys = ['success', 'pending', 'aborted', 'failed', 'unstable'];
class Health {
constructor(builds) {
for (const key of kHealthKeys) {
Expand Down Expand Up @@ -450,7 +450,7 @@ class FailureAggregator {
.value();
const data = [];
for (const item of groupedByReason) {
const [ reason, failures ] = item;
const [reason, failures] = item;
// Uncomment this and redirect stderr away to see matched highlights
// console.log('HIGHLIGHT', reason);

Expand Down Expand Up @@ -490,8 +490,8 @@ class FailureAggregator {
let output = 'Failures in ';
output += `[${jobName}/${first.jobid}](${first.link}) to `;
output += `[${jobName}/${last.jobid}](${last.link}) `;
output += `that failed more than 2 PRs\n`;
output += `(Generated with \`ncu-ci `;
output += 'that failed more than 2 PRs\n';
output += '(Generated with `ncu-ci ';
output += `${process.argv.slice(2).join(' ')}\`)\n\n`;

output += this.health.formatAsMarkdown() + '\n';
Expand Down Expand Up @@ -736,7 +736,7 @@ function filterBuild(builds, type) {
async function listBuilds(cli, request, type) {
// assert(type === COMMIT || type === PR)
const { jobName } = CI_TYPES.get(type);
const tree = `builds[url,result]`;
const tree = 'builds[url,result]';
const url = `https://${CI_DOMAIN}/job/${jobName}/api/json?tree=${qs.escape(tree)}`;

cli.startSpinner(`Querying ${url}`);
Expand Down Expand Up @@ -998,10 +998,10 @@ class BenchmarkRun extends Job {
for (const line of results) {
const star = line.indexOf('*');
const name = line.slice(0, star).trim();
const [ file, ...config ] = name.split(' ');
const [file, ...config] = name.split(' ');
const confidence = line.match(/(\*+)/)[1];
const lastStar = line.lastIndexOf('*');
const [ improvement, ...accuracy ] =
const [improvement, ...accuracy] =
line.slice(lastStar + 1).split(/\s*%/).map(i => i.trim() + '%');
accuracy.pop(); // remove the last empty item
json.push({
Expand Down
2 changes: 1 addition & 1 deletion lib/ci/ci_type_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function parseJobFromURL(url) {
return undefined;
}

for (let [ type, info ] of CI_TYPES) {
for (const [type, info] of CI_TYPES) {
const match = url.match(info.pattern);
if (match) {
return {
Expand Down
6 changes: 4 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ exports.getConfigPath = function(configType, dir) {
switch (configType) {
case GLOBAL_CONFIG:
return getNcurcPath();
case PROJECT_CONFIG:
case PROJECT_CONFIG: {
const projectRcPath = path.join(dir || process.cwd(), '.ncurc');
return projectRcPath;
case LOCAL_CONFIG:
}
case LOCAL_CONFIG: {
const ncuDir = exports.getNcuDir(dir);
const configPath = path.join(ncuDir, 'config');
return configPath;
}
default:
throw Error('Invalid configType');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/github/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class GitHubTree {
}
const base = 'https://raw.githubusercontent.com';
const { owner, repo, lastCommit, path } = this;
let prefix = `${base}/${owner}/${repo}/${lastCommit}`;
const prefix = `${base}/${owner}/${repo}/${lastCommit}`;
if (assetPath.startsWith('/')) { // absolute
return `${prefix}/${assetPath}`;
} else {
Expand Down
8 changes: 4 additions & 4 deletions lib/landing_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class LandingSession extends Session {
cli.log(`There are ${subjects.length} commits in the PR`);
cli.log('Please run the following commands to complete landing\n\n' +
`$ ${suggestion}\n` +
`$ git node land --continue`);
'$ git node land --continue');
}

async apply() {
Expand Down Expand Up @@ -241,11 +241,11 @@ class LandingSession extends Session {
async continue() {
const { cli } = this;
if (this.readyToFinal()) {
cli.log(`Running \`final\`..`);
cli.log('Running `final`..');
return this.final();
}
if (this.readyToAmend()) {
cli.log(`Running \`amend\`..`);
cli.log('Running `amend`..');
return this.amend();
}
if (this.isApplying()) {
Expand All @@ -260,7 +260,7 @@ class LandingSession extends Session {
return;
}
if (this.hasStarted()) {
cli.log(`Running \`apply\`..`);
cli.log('Running `apply`..');
return this.apply();
}
cli.log(
Expand Down
2 changes: 1 addition & 1 deletion lib/metadata_gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MetadataGenerator {
const fixes = parser.getFixes();
const refs = parser.getRefs();

let meta = [
const meta = [
`PR-URL: ${prUrl}`,
...fixes.map((fix) => `Fixes: ${fix}`),
...refs.map((ref) => `Refs: ${ref}`),
Expand Down
24 changes: 12 additions & 12 deletions lib/pr_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PRChecker {
}

if (approved.length === 0) {
cli.error(`Approvals: 0`);
cli.error('Approvals: 0');
return;
}

Expand Down Expand Up @@ -214,7 +214,7 @@ class PRChecker {
}

if (lastCI) {
let afterCommits = [];
const afterCommits = [];
commits.forEach((commit) => {
commit = commit.commit;
if (commit.committedDate > lastCI.date) {
Expand All @@ -223,20 +223,20 @@ class PRChecker {
}
});

let totalCommits = afterCommits.length;
const totalCommits = afterCommits.length;
if (totalCommits > 0) {
let warnMsg = `Commits were pushed after the last ` +
const warnMsg = 'Commits were pushed after the last ' +
`${lastCI.typeName} CI run:`;

cli.warn(warnMsg);
let sliceLength = maxCommits === 0 ? totalCommits : -maxCommits;
const sliceLength = maxCommits === 0 ? totalCommits : -maxCommits;
afterCommits.slice(sliceLength)
.forEach(commit => {
cli.warn(`- ${commit.messageHeadline}`);
});

if (totalCommits > maxCommits) {
let infoMsg = '...(use `' +
const infoMsg = '...(use `' +
`--max-commits ${totalCommits}` +
'` to see the full list of commits)';
cli.warn(infoMsg);
Expand Down Expand Up @@ -298,7 +298,7 @@ class PRChecker {

checkGitConfig() {
const { cli, commits } = this;
for (let { commit } of commits) {
for (const { commit } of commits) {
if (commit.author.user === null) {
cli.warn('GitHub cannot link the author of ' +
`'${commit.messageHeadline}' to their GitHub account.`);
Expand All @@ -323,25 +323,25 @@ class PRChecker {
const reviewIndex = reviews.length - 1;
const reviewDate = reviews[reviewIndex].publishedAt;

let afterCommits = [];
const afterCommits = [];
commits.forEach((commit) => {
commit = commit.commit;
if (commit.committedDate > reviewDate) {
afterCommits.push(commit);
}
});

let totalCommits = afterCommits.length;
const totalCommits = afterCommits.length;
if (totalCommits > 0) {
cli.warn(`Commits were pushed since the last review:`);
let sliceLength = maxCommits === 0 ? totalCommits : -maxCommits;
cli.warn('Commits were pushed since the last review:');
const sliceLength = maxCommits === 0 ? totalCommits : -maxCommits;
afterCommits.slice(sliceLength)
.forEach(commit => {
cli.warn(`- ${commit.messageHeadline}`);
});

if (totalCommits > maxCommits) {
let infoMsg = '...(use `' +
const infoMsg = '...(use `' +
`--max-commits ${totalCommits}` +
'` to see the full list of commits)';
cli.warn(infoMsg);
Expand Down
4 changes: 2 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Request {
'authenticated with a Jenkins token');
}
return {
'Authorization': `Basic ${jenkinsCredentials}`,
Authorization: `Basic ${jenkinsCredentials}`,
'User-Agent': 'node-core-utils'
};
}
Expand All @@ -67,7 +67,7 @@ class Request {
const options = {
method: 'POST',
headers: {
'Authorization': `Basic ${githubCredentials}`,
Authorization: `Basic ${githubCredentials}`,
'User-Agent': 'node-core-utils'
},
body: JSON.stringify({
Expand Down
2 changes: 1 addition & 1 deletion lib/reviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class ReviewAnalyzer {
requestedChanges: []
};
const collaborators = this.collaborators;
for (const [ login, review ] of reviewers) {
for (const [login, review] of reviewers) {
const reviewer = collaborators.get(login.toLowerCase());
if (review.state === APPROVED) {
result.approved.push({ reviewer, review });
Expand Down
4 changes: 2 additions & 2 deletions lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class Session {

warnForWrongBranch() {
const { branch, cli } = this;
let rev = this.getCurrentBranch();
const rev = this.getCurrentBranch();
if (rev === 'HEAD') {
cli.warn(
'You are in detached HEAD state. Please run git-node on a valid ' +
Expand All @@ -352,7 +352,7 @@ class Session {
cli.separator();
cli.info(
`You can switch to \`${branch}\` with \`git checkout ${branch}\`, or\n` +
` reconfigure the target branch with:\n\n` +
' reconfigure the target branch with:\n\n' +
` $ ncu-config set branch ${rev}`);
cli.separator();
return true;
Expand Down
4 changes: 2 additions & 2 deletions lib/team_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ TeamInfo.update = async function(cli, request, content) {
let m;
// eslint-disable-next-line no-cond-assign
while ((m = RE.exec(content))) {
const [ , org, team ] = m;
const [, org, team] = m;
const mapKey = key(org, team);
if (!blocks.get(mapKey)) {
const info = new TeamInfo(cli, request, org, team);
const teamData = await info.getMemberContacts();
const opening = `<!-- ncu-team-sync.team(${org}/${team}) -->`;
const ending = `<!-- ncu-team-sync end -->`;
const ending = '<!-- ncu-team-sync end -->';
blocks.set(mapKey, `${opening}\n\n${teamData}\n\n${ending}`);
};
}
Expand Down
11 changes: 6 additions & 5 deletions lib/update-v8/minorUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ function getLatestV8Version() {
title: 'Get latest V8 version',
task: async(ctx) => {
const currentV8Tag = ctx.currentVersion.slice(0, 3).join('.');
let tags = await execa.stdout('git', ['tag', '-l', `${currentV8Tag}.*`], {
cwd: ctx.v8Dir
const result = await execa('git', ['tag', '-l', `${currentV8Tag}.*`], {
cwd: ctx.v8Dir,
encoding: 'utf8'
});
tags = toSortedArray(tags);
const tags = toSortedArray(result.stdout);
ctx.latestVersion = tags[0];
}
};
Expand Down Expand Up @@ -58,10 +59,10 @@ function minorUpdate() {

async function doMinorUpdate(ctx, latestStr) {
const currentStr = ctx.currentVersion.join('.');
const diff = await execa.stdout(
const { stdout: diff } = await execa(
'git',
['format-patch', '--stdout', `${currentStr}...${latestStr}`],
{ cwd: ctx.v8Dir }
{ cwd: ctx.v8Dir, encoding: 'utf8' }
);
try {
await execa('git', ['apply', '--directory', 'deps/v8'], {
Expand Down
Loading

0 comments on commit 705d983

Please sign in to comment.