New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lhci/utils

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lhci/utils - npm Package Compare versions

Comparing version 0.2.1-alpha.2 to 0.2.1-alpha.3

4

package.json
{
"name": "@lhci/utils",
"version": "0.2.1-alpha.2",
"version": "0.2.1-alpha.3",
"license": "Apache-2.0",

@@ -15,3 +15,3 @@ "repository": {

},
"gitHead": "0c1c082f26abb93e0701f9fea3362434bb76a35a"
"gitHead": "b014cbaefe989e45a883d4ba5c9e2d6174daf5c7"
}

@@ -11,2 +11,19 @@ /**

/**
* @param {Array<[string, ReadonlyArray<string>]>} commands
* @return {import('child_process').SpawnSyncReturns<string>}
*/
function runCommandsUntilFirstSuccess(commands) {
/** @type {import('child_process').SpawnSyncReturns<string>|undefined} */
let result;
for (const [command, args] of commands) {
result = childProcess.spawnSync(command, args, {encoding: 'utf8'});
if (result.status === 0) break;
}
if (!result) throw new Error('Must specify at least one command');
return result;
}
const envVars = process.env;

@@ -50,4 +67,7 @@

function getCurrentBranch() {
// Use Travis CI vars if available.
if (envVars.TRAVIS_PULL_REQUEST_BRANCH) return envVars.TRAVIS_PULL_REQUEST_BRANCH.slice(0, 40);
if (envVars.TRAVIS_BRANCH) return envVars.TRAVIS_BRANCH.slice(0, 40);
// Use GitHub Actions vars if available. See https://github.com/GoogleChrome/lighthouse-ci/issues/43#issuecomment-551174778
if (envVars.GITHUB_HEAD_REF) return envVars.GITHUB_HEAD_REF.slice(0, 40);

@@ -57,7 +77,9 @@ const result = childProcess.spawnSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {

});
if (result.status !== 0) {
const branch = result.stdout.trim().slice(0, 40);
if (result.status !== 0 || branch === 'HEAD') {
throw new Error('Unable to determine current branch with `git rev-parse --abbrev-ref HEAD`');
}
return result.stdout.trim().slice(0, 40);
return branch;
}

@@ -138,5 +160,6 @@

function getAncestorHashForBranch(hash = 'HEAD') {
const result = childProcess.spawnSync('git', ['merge-base', hash, 'master'], {
encoding: 'utf8',
});
const result = runCommandsUntilFirstSuccess([
['git', ['merge-base', hash, 'origin/master']],
['git', ['merge-base', hash, 'master']],
]);

@@ -143,0 +166,0 @@ // Ancestor hash is optional, so do not throw if it can't be computed.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc