update-browserslist-db 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,8 @@ let pico = require('picocolors')
4
4
 
5
5
  if (!existsSync('deno.lock')) {
6
6
  try {
7
- let version = parseInt(execSync('npm -v'))
7
+ let output = execSync('npm -v').toString().trim()
8
+ let version = parseInt(output.replace(/^[^\d]*/, ''))
8
9
  if (version <= 6) {
9
10
  process.stderr.write(
10
11
  pico.red(
package/cli.js CHANGED
@@ -28,7 +28,7 @@ function error(msg) {
28
28
  if (isArg('--help') || isArg('-h')) {
29
29
  process.stdout.write(getPackage().description + '.\n\n' + USAGE + '\n')
30
30
  } else if (isArg('--version') || isArg('-v')) {
31
- process.stdout.write('browserslist-lint ' + getPackage().version + '\n')
31
+ process.stdout.write(getPackage().name + ' ' + getPackage().version + '\n')
32
32
  } else {
33
33
  try {
34
34
  updateDb()
package/index.js CHANGED
@@ -67,31 +67,46 @@ function detectLockfile() {
67
67
  }
68
68
 
69
69
  function getLatestInfo(lock) {
70
- if (lock.mode === 'yarn') {
71
- if (lock.version === 1) {
72
- return JSON.parse(
73
- execSync(YARN_CMD + ' info caniuse-lite --json').toString()
74
- ).data
75
- } else {
76
- return JSON.parse(
77
- execSync(YARN_CMD + ' npm info caniuse-lite --json').toString()
70
+ try {
71
+ if (lock.mode === 'yarn') {
72
+ if (lock.version === 1) {
73
+ return JSON.parse(
74
+ execSync(YARN_CMD + ' info caniuse-lite --json').toString()
75
+ ).data
76
+ } else {
77
+ return JSON.parse(
78
+ execSync(YARN_CMD + ' npm info caniuse-lite --json').toString()
79
+ )
80
+ }
81
+ }
82
+ if (lock.mode === 'pnpm') {
83
+ return JSON.parse(execSync('pnpm info caniuse-lite --json').toString())
84
+ }
85
+ if (lock.mode === 'bun') {
86
+ return JSON.parse(execSync('bun info caniuse-lite --json').toString())
87
+ }
88
+ if (lock.mode === 'deno') {
89
+ let result = JSON.parse(
90
+ execSync(
91
+ 'deno run -A npm:npm show caniuse-lite version --json'
92
+ ).toString()
78
93
  )
94
+ return { version: Array.isArray(result) ? result[0] : result }
79
95
  }
80
- }
81
- if (lock.mode === 'pnpm') {
82
- return JSON.parse(execSync('pnpm info caniuse-lite --json').toString())
83
- }
84
- if (lock.mode === 'bun') {
85
- return JSON.parse(execSync(' bun info caniuse-lite --json').toString())
86
- }
87
- if (lock.mode === 'deno') {
88
- let result = JSON.parse(
89
- execSync('deno x -y npm:npm show caniuse-lite version --json').toString()
90
- )
91
- return { version: Array.isArray(result) ? result[0] : result }
92
- }
93
96
 
94
- return JSON.parse(execSync('npm show caniuse-lite --json').toString())
97
+ return JSON.parse(execSync('npm show caniuse-lite --json').toString())
98
+ } catch (e) {
99
+ if (e.code === 'ENOENT' || e.status === 127) {
100
+ throw new BrowserslistUpdateError(
101
+ 'Cannot find ' +
102
+ lock.mode +
103
+ ' binary in PATH. Please install ' +
104
+ lock.mode +
105
+ ' or run updates manually.'
106
+ )
107
+ }
108
+ throw e
109
+ }
95
110
  }
96
111
 
97
112
  function getBrowsers() {
@@ -355,7 +370,7 @@ module.exports = function updateDB(print = defaultPrint) {
355
370
  let packages = lockContent.includes('baseline-browser-mapping')
356
371
  ? 'caniuse-lite baseline-browser-mapping'
357
372
  : 'caniuse-lite'
358
- updateWith(print, 'pnpm up --depth=Infinity --no-save ' + packages)
373
+ updateWith(print, 'pnpm up --depth=9999 --no-save ' + packages)
359
374
  } else if (lock.mode === 'bun') {
360
375
  updateBun(print, lock, latest)
361
376
  } else if (lock.mode === 'deno') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "update-browserslist-db",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "CLI tool to update caniuse-lite to refresh target browsers from Browserslist config",
5
5
  "keywords": [
6
6
  "browsers",