Skip to content

Commit

Permalink
Revert yarn changes since they faaling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Apr 29, 2024
1 parent 3471da2 commit 3873659
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ function detectLockfile() {
)
}

function getLatestInfo(print, lock) {
function getLatestInfo(lock) {
if (lock.mode === 'yarn') {
if (lock.version === 1) {
return JSON.parse(updateWith(print, 'yarnpkg info caniuse-lite --json', true).toString()).data
return JSON.parse(execSync('yarnpkg info caniuse-lite --json').toString())
.data
} else {
return JSON.parse(
updateWith(print, 'yarnpkg npm info caniuse-lite --json', true).toString()
execSync('yarnpkg npm info caniuse-lite --json').toString()
)
}
}
Expand Down Expand Up @@ -215,7 +216,7 @@ function updatePackageManually(print, lock, latest) {
'\n'
)
try {
updateWith(print, install + ' caniuse-lite');
execSync(install + ' caniuse-lite')
} catch (e) /* c8 ignore start */ {
print(
pico.red(
Expand All @@ -241,18 +242,14 @@ function updatePackageManually(print, lock, latest) {
execSync(del + ' caniuse-lite')
}

function updateWith(print, cmd, getResult = false) {
function updateWith(print, cmd) {
print(
'Updating caniuse-lite version\n' +
pico.yellow('$ ' + cmd.replace('yarnpkg', 'yarn')) +
'\n'
)
try {
let result = execSync(cmd);

if(getResult){
return result;
}
execSync(cmd)
} catch (e) /* c8 ignore start */ {
print(pico.red(e.stdout.toString()))
print(
Expand All @@ -272,7 +269,7 @@ function updateWith(print, cmd, getResult = false) {

module.exports = function updateDB(print = defaultPrint) {
let lock = detectLockfile()
let latest = getLatestInfo(print, lock)
let latest = getLatestInfo(lock)

let listError
let oldList
Expand Down

0 comments on commit 3873659

Please sign in to comment.