Skip to content

Commit

Permalink
chore: update dev deps (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 authored Oct 18, 2024
1 parent 5765beb commit b6da28c
Show file tree
Hide file tree
Showing 25 changed files with 384 additions and 774 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lint-staged
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"lint:js": "prettier --check \"src/**/*.js\" \"tests/*.js\" \"src/e\"",
"lint": "npm run lint:js && npm run lint:markdown",
"prettier:write": "prettier --write \"src/**/*.js\" \"tests/*.js\" \"src/e\"",
"prepare": "husky",
"test": "nyc --reporter=lcov --reporter=text-summary vitest run --reporter=verbose --exclude tests/bootstrap.spec.mjs",
"test:all": "nyc --reporter=lcov --reporter=text-summary vitest run --reporter=verbose"
},
Expand Down Expand Up @@ -41,12 +42,12 @@
"yaml": "^2.4.5"
},
"devDependencies": {
"@electron/lint-roller": "^1.5.0",
"husky": "^4.2.0",
"lint-staged": "^10.0.2",
"nyc": "^17.0.0",
"prettier": "^1.19.1",
"vitest": "^2.0.1"
"@electron/lint-roller": "^1.13.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"nyc": "^17.1.0",
"prettier": "^3.3.3",
"vitest": "^2.1.3"
},
"lint-staged": {
"*.js": [
Expand All @@ -56,10 +57,5 @@
"prettier --write"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
2 changes: 1 addition & 1 deletion src/ci/ci-cancel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { archOption, ArchTypes, BuildTypes } = require('./common');

const { APPVEYOR_CLOUD_TOKEN } = process.env;

const cancelAppveyorBuild = async id => {
const cancelAppveyorBuild = async (id) => {
const { statusCode } = await got
.delete(`https://ci.appveyor.com/api/builds/electron-bot/${ArchTypes[arch]}/${id}`, {
headers: {
Expand Down
18 changes: 9 additions & 9 deletions src/ci/ci-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { APPVEYOR_CLOUD_TOKEN } = process.env;

const APPVEYOR_BOT_ID = 40616121;

const colorForStatus = status => {
const colorForStatus = (status) => {
switch (status) {
case 'success':
return chalk.green(status);
Expand All @@ -38,7 +38,7 @@ const colorForStatus = status => {
}
};

const getAppveyorStatusString = check => {
const getAppveyorStatusString = (check) => {
switch (check.state) {
case 'success':
return chalk.green('success');
Expand All @@ -64,13 +64,13 @@ const appveyorArchMap = {

const formatLink = (name, url) => `\x1B]8;;${url}\x1B\\${name}\x1B]8;;\x1B\\`;

const getWorkflowID = url => url.pathname.replace('/workflow-run/', '');
const getWorkflowID = (url) => url.pathname.replace('/workflow-run/', '');
const getBuildID = ({ pathname }) => {
const index = pathname.lastIndexOf('/builds/') + 8;
return pathname.substring(index, pathname.length);
};

const getType = prs => {
const getType = (prs) => {
// If there are no PRs, we're on a PR fork branch.
if (prs.length === 0) return 'branch';

Expand All @@ -79,7 +79,7 @@ const getType = prs => {
return isMain ? 'main' : 'branch';
};

const getArch = url => url.pathname.match(/(electron-[a-zA-Z0-9]*-testing)/)[0];
const getArch = (url) => url.pathname.match(/(electron-[a-zA-Z0-9]*-testing)/)[0];

const printStatuses = (statuses, link) => {
let result = '';
Expand All @@ -100,14 +100,14 @@ const printStatuses = (statuses, link) => {

if (check.jobs) {
const failed = [];
const succeeded = check.jobs.filter(j => {
const succeeded = check.jobs.filter((j) => {
const passed = j.status === 'success';
if (!passed) failed.push(j);
return passed;
});

if (succeeded.length) {
const names = succeeded.map(s => s.name);
const names = succeeded.map((s) => s.name);
result +=
succeeded.length === check.jobs.length
? ' ⦿ all jobs succeeded\n'
Expand All @@ -124,7 +124,7 @@ const printStatuses = (statuses, link) => {
return result;
};

const parseRef = ref => {
const parseRef = (ref) => {
const pullPattern = /^#?\d{1,7}$/;
if (pullPattern.test(ref)) {
const pullNum = ref.startsWith('#') ? ref.substring(1) : ref;
Expand All @@ -139,7 +139,7 @@ program
.option('-r|--ref <ref>', 'The ref to check CI job status for')
.option('-n|--no-link', 'Do not show smart linking for CI status information')
.option('-s|--show-jobs', 'Whether to also list the jobs for each workflow')
.action(async options => {
.action(async (options) => {
const electronDir = path.resolve(current().root, 'src', 'electron');
const currentRef = execFileSync('git', ['branch', '--show-current'], { cwd: electronDir })
.toString()
Expand Down
10 changes: 5 additions & 5 deletions src/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const { fatal } = require('./utils/logging');

const MB_BYTES = 1024 * 1024;

const progressStream = function(tokens) {
const progressStream = function (tokens) {
var pt = new stream.PassThrough();

pt.on('pipe', function(stream) {
stream.on('response', function(res) {
pt.on('pipe', function (stream) {
stream.on('response', function (res) {
const total = parseInt(res.headers['content-length'], 10);
const bar = new ProgressBar(tokens, { total: Math.round(total) });

pt.on('data', function(chunk) {
pt.on('data', function (chunk) {
const elapsed = new Date() - bar.start;
const rate = bar.curr / (elapsed / 1000);
bar.tick(chunk.length, {
Expand All @@ -36,7 +36,7 @@ function tryDownload(attemptsLeft = 3) {
pipeline(
got.default.stream(process.argv[2]),
...(process.env.CI ? [write] : [progress, write]),
).catch(err => {
).catch((err) => {
if (attemptsLeft === 0) {
return fatal(err);
}
Expand Down
10 changes: 5 additions & 5 deletions src/e
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ program
.alias('run')
.description('Run the Electron executable')
.allowUnknownOption()
.action(args => {
.action((args) => {
try {
const exec = evmConfig.execOf(evmConfig.current());
const opts = { stdio: 'inherit' };
Expand All @@ -115,7 +115,7 @@ program
.command('node [args...]')
.description('Run the Electron build as if it were a Node.js executable')
.allowUnknownOption()
.action(args => {
.action((args) => {
try {
const exec = evmConfig.execOf(evmConfig.current());
const opts = {
Expand All @@ -141,7 +141,7 @@ program.command('debug', 'Run the Electron build with a debugger (gdb or lldb)')
program
.command('use <name>')
.description('Use build config <name> when running other `e` commands')
.action(name => {
.action((name) => {
try {
evmConfig.setCurrent(name);
console.log(`Now using config ${color.config(name)}`);
Expand All @@ -155,7 +155,7 @@ program
.command('remove <name>')
.alias('rm')
.description('Remove build config <name> from list')
.action(name => {
.action((name) => {
try {
evmConfig.remove(name);
console.log(`Removed config ${color.config(name)}`);
Expand Down Expand Up @@ -196,7 +196,7 @@ program
program
.command('sanitize-config [name]')
.description('Update and overwrite an existing config to conform to latest build-tools updates')
.action(name => {
.action((name) => {
try {
const configName = name || evmConfig.currentName();
evmConfig.sanitizeConfigWithName(configName, true);
Expand Down
26 changes: 4 additions & 22 deletions src/e-auto-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ program
}
});

program
.command('check')
.description('check for updates and apply them')
.action(checkForUpdates);
program.command('check').description('check for updates and apply them').action(checkForUpdates);

function checkForUpdates() {
try {
Expand All @@ -56,23 +53,12 @@ function checkForUpdates() {
const globalNodeModulesPaths = [];

try {
globalNodeModulesPaths.push(
cp
.execSync('npm root -g')
.toString('utf8')
.trim(),
);
globalNodeModulesPaths.push(cp.execSync('npm root -g').toString('utf8').trim());
} catch {}

try {
globalNodeModulesPaths.push(
path.join(
cp
.execSync('npx yarn global dir')
.toString('utf8')
.trim(),
'node_modules',
),
path.join(cp.execSync('npx yarn global dir').toString('utf8').trim(), 'node_modules'),
);
} catch {}

Expand Down Expand Up @@ -102,11 +88,7 @@ function checkForUpdates() {
}

const execOpts = { cwd: path.resolve(__dirname, '..') };
const git = args =>
cp
.execSync(`git ${args}`, execOpts)
.toString('utf8')
.trim();
const git = (args) => cp.execSync(`git ${args}`, execOpts).toString('utf8').trim();

const headCmd = 'rev-parse --verify HEAD';
const headBefore = git(headCmd);
Expand Down
6 changes: 3 additions & 3 deletions src/e-backport.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { fatal } = require('./utils/logging');
program
.arguments('[pr]')
.description('Assists with manual backport processes')
.action(async prNumberStr => {
.action(async (prNumberStr) => {
const prNumber = parseInt(prNumberStr, 10);
if (isNaN(prNumber) || `${prNumber}` !== prNumberStr) {
fatal(`backport requires a number, "${prNumberStr}" was provided`);
Expand All @@ -36,8 +36,8 @@ program
}

const targetBranches = pr.labels
.filter(label => label.name.startsWith('needs-manual-bp/'))
.map(label => label.name.substring(16));
.filter((label) => label.name.startsWith('needs-manual-bp/'))
.map((label) => label.name.substring(16));
if (targetBranches.length === 0) {
fatal('The given pull request is not needing any manual backports yet');
return;
Expand Down
4 changes: 2 additions & 2 deletions src/e-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getGNArgs(config) {
// GN_EXTRA_ARGS is a list of GN args to append to the default args.
const { GN_EXTRA_ARGS } = process.env;
if (process.env.CI && GN_EXTRA_ARGS) {
const envArgs = GN_EXTRA_ARGS.split(' ').map(s => s.trim());
const envArgs = GN_EXTRA_ARGS.split(' ').map((s) => s.trim());
return [...configArgs, ...envArgs].join(os.EOL);
}

Expand Down Expand Up @@ -59,7 +59,7 @@ function runNinja(config, target, ninjaArgs) {
reclient.auth(config);

// Autoninja sets this absurdly high, we take it down a notch
if (!ninjaArgs.includes('-j') && !ninjaArgs.find(arg => /^-j[0-9]+$/.test(arg.trim()))) {
if (!ninjaArgs.includes('-j') && !ninjaArgs.find((arg) => /^-j[0-9]+$/.test(arg.trim()))) {
ninjaArgs.push('-j', 200);
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/e-cherry-pick.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ async function getGerritPatchDetailsFromURL(gerritUrl, security) {
);

const patch = await fetch(patchUrl)
.then(resp => resp.text())
.then(text => Buffer.from(text, 'base64').toString('utf8'));
.then((resp) => resp.text())
.then((text) => Buffer.from(text, 'base64').toString('utf8'));

const [, commitId] = /^From ([0-9a-f]+)/.exec(patch);

Expand Down
4 changes: 2 additions & 2 deletions src/e-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ try {
{ exec: 'lldb', runner: run_lldb },
];

const choice = choices.find(choice => commandExistsSync(choice.exec));
const choice = choices.find((choice) => commandExistsSync(choice.exec));
if (choice) {
choice.runner(evmConfig.current());
} else {
fatal(
`No debugger found in PATH! Looked for [${choices
.map(choice => `'${choice.exec}'`)
.map((choice) => `'${choice.exec}'`)
.join(', ')}]`,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/e-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function ensureRoot(config, force) {

ensureDir(root);

const hasOtherFiles = fs.readdirSync(root).some(file => file !== '.gclient');
const hasOtherFiles = fs.readdirSync(root).some((file) => file !== '.gclient');
if (hasOtherFiles && !force) {
fatal(`Root ${color.path(root)} is not empty. Please choose a different root directory.`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/e-open.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function getPullURLsFromGitHub(sha1) {
if (response.statusCode !== 200) {
fatal(`Could not open PR: ${opts.url} got ${response.headers.status}`);
}
ret.push(...(response.body || []).map(pull => pull.html_url).filter(url => !!url));
ret.push(...(response.body || []).map((pull) => pull.html_url).filter((url) => !!url));
} catch (error) {
console.log(color.err, error);
}
Expand All @@ -65,7 +65,7 @@ async function getPullURLsFromGitHub(sha1) {
// get the pull request URLs for a git object or pull number
async function getPullURLs(ref) {
const { pullNumber, sha1 } = getCommitInfo(ref);
const makeURL = num => `https://github.com/electron/electron/pull/${num}`;
const makeURL = (num) => `https://github.com/electron/electron/pull/${num}`;

if (pullNumber) {
return [makeURL(pullNumber)];
Expand Down
4 changes: 2 additions & 2 deletions src/e-patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ program
console.log(
`Supported targets: ${[...Object.keys(targets), 'all']
.sort()
.map(a => color.cmd(a))
.map((a) => color.cmd(a))
.join(', ')}`,
);
console.log(`See ${color.path(patchesConfig)}`);
Expand Down Expand Up @@ -70,7 +70,7 @@ program
console.log(
`${color.err} Supported targets: ${[...Object.keys(targets), 'all']
.sort()
.map(a => color.cmd(a))
.map((a) => color.cmd(a))
.join(', ')}`,
);
fatal(`See ${color.path(patchesConfig)}`);
Expand Down
2 changes: 1 addition & 1 deletion src/e-pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ program
guessPRTarget(current()),
)
.option('-b, --backport <pull_request>', 'Pull request being backported')
.action(async options => {
.action(async (options) => {
if (!options.source) {
fatal(`'source' is required to create a PR`);
} else if (!options.target) {
Expand Down
Loading

0 comments on commit b6da28c

Please sign in to comment.