Socket
Socket
Sign inDemoInstall

update-browserslist-db

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

update-browserslist-db - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

59

index.js

@@ -1,6 +0,6 @@

let childProcess = require('child_process')
let { writeFileSync, readFileSync, existsSync } = require('fs')
let { execSync } = require('child_process')
let { join } = require('path')
let escalade = require('escalade/sync')
let pico = require('picocolors')
let path = require('path')
let fs = require('fs')

@@ -37,17 +37,17 @@ const { detectIndent, detectEOL } = require('./utils')

let lockfileNpm = path.join(packageDir, 'package-lock.json')
let lockfileShrinkwrap = path.join(packageDir, 'npm-shrinkwrap.json')
let lockfileYarn = path.join(packageDir, 'yarn.lock')
let lockfilePnpm = path.join(packageDir, 'pnpm-lock.yaml')
let lockfileNpm = join(packageDir, 'package-lock.json')
let lockfileShrinkwrap = join(packageDir, 'npm-shrinkwrap.json')
let lockfileYarn = join(packageDir, 'yarn.lock')
let lockfilePnpm = join(packageDir, 'pnpm-lock.yaml')
if (fs.existsSync(lockfilePnpm)) {
if (existsSync(lockfilePnpm)) {
return { mode: 'pnpm', file: lockfilePnpm }
} else if (fs.existsSync(lockfileNpm)) {
} else if (existsSync(lockfileNpm)) {
return { mode: 'npm', file: lockfileNpm }
} else if (fs.existsSync(lockfileYarn)) {
} else if (existsSync(lockfileYarn)) {
let lock = { mode: 'yarn', file: lockfileYarn }
lock.content = fs.readFileSync(lock.file).toString()
lock.content = readFileSync(lock.file).toString()
lock.version = /# yarn lockfile v1/.test(lock.content) ? 1 : 2
return lock
} else if (fs.existsSync(lockfileShrinkwrap)) {
} else if (existsSync(lockfileShrinkwrap)) {
return { mode: 'npm', file: lockfileShrinkwrap }

@@ -63,8 +63,7 @@ }

if (lock.version === 1) {
return JSON.parse(
childProcess.execSync('yarn info caniuse-lite --json').toString()
).data
return JSON.parse(execSync('yarn info caniuse-lite --json').toString())
.data
} else {
return JSON.parse(
childProcess.execSync('yarn npm info caniuse-lite --json').toString()
execSync('yarn npm info caniuse-lite --json').toString()
)

@@ -74,9 +73,5 @@ }

if (lock.mode === 'pnpm') {
return JSON.parse(
childProcess.execSync('pnpm info caniuse-lite --json').toString()
)
return JSON.parse(execSync('pnpm info caniuse-lite --json').toString())
}
return JSON.parse(
childProcess.execSync('npm show caniuse-lite --json').toString()
)
return JSON.parse(execSync('npm show caniuse-lite --json').toString())
}

@@ -132,2 +127,10 @@

}
if (node.packages) {
for (let path in node.packages) {
if (path.endsWith('/caniuse-lite')) {
metadata.versions[node.packages[path].version] = true
delete node.packages[path]
}
}
}
return node

@@ -172,3 +175,3 @@ }

function updateLockfile(lock, latest) {
if (!lock.content) lock.content = fs.readFileSync(lock.file).toString()
if (!lock.content) lock.content = readFileSync(lock.file).toString()

@@ -194,3 +197,3 @@ let updatedLockFile

'Installed version: ' +
pico.bold(pico.green(latest.version)) +
pico.bold(pico.green(caniuseVersions[0])) +
'\n' +

@@ -213,3 +216,3 @@ pico.bold(pico.green('caniuse-lite is up to date')) +

)
fs.writeFileSync(lock.file, lockfileData.content)
writeFileSync(lock.file, lockfileData.content)

@@ -223,3 +226,3 @@ let install = lock.mode === 'yarn' ? 'yarn add -W' : lock.mode + ' install'

try {
childProcess.execSync(install + ' caniuse-lite')
execSync(install + ' caniuse-lite')
} catch (e) /* c8 ignore start */ {

@@ -246,3 +249,3 @@ print(

)
childProcess.execSync(del + ' caniuse-lite')
execSync(del + ' caniuse-lite')
}

@@ -253,3 +256,3 @@

try {
childProcess.execSync(cmd)
execSync(cmd)
} catch (e) /* c8 ignore start */ {

@@ -256,0 +259,0 @@ print(pico.red(e.stdout.toString()))

{
"name": "update-browserslist-db",
"version": "1.0.10",
"version": "1.0.11",
"description": "CLI tool to update caniuse-lite to refresh target browsers from Browserslist config",

@@ -18,2 +18,6 @@ "keywords": [

"url": "https://tidelift.com/funding/github/npm/browserslist"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}

@@ -36,5 +40,3 @@ ],

},
"bin": {
"browserslist-lint": "cli.js"
}
"bin": "cli.js"
}

@@ -21,4 +21,3 @@ # Update Browserslist DB

## Docs
Read **[full docs](https://github.com/browserslist/update-db#readme)** on GitHub.
Read full docs **[here](https://github.com/browserslist/update-db#readme)**.
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