update-browserslist-db 1.3.4 → 1.4.0

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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/index.js +29 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -25,6 +25,12 @@ Or if using `bun`:
25
25
  bunx update-browserslist-db@latest
26
26
  ```
27
27
 
28
+ Or if using `aube`:
29
+
30
+ ```sh
31
+ aubx update-browserslist-db@latest
32
+ ```
33
+
28
34
  Or if using `yarn` 2+:
29
35
 
30
36
  ```sh
package/index.js CHANGED
@@ -40,11 +40,14 @@ function detectLockfile() {
40
40
  let lockfileShrinkwrap = join(packageDir, 'npm-shrinkwrap.json')
41
41
  let lockfileYarn = join(packageDir, 'yarn.lock')
42
42
  let lockfilePnpm = join(packageDir, 'pnpm-lock.yaml')
43
+ let lockfileAube = join(packageDir, 'aube-lock.yaml')
43
44
  let lockfileBun = join(packageDir, 'bun.lock')
44
45
  let lockfileBunBinary = join(packageDir, 'bun.lockb')
45
46
  let lockfileDeno = join(packageDir, 'deno.lock')
46
47
 
47
- if (existsSync(lockfilePnpm)) {
48
+ if (existsSync(lockfileAube)) {
49
+ return { file: lockfileAube, mode: 'aube' }
50
+ } else if (existsSync(lockfilePnpm)) {
48
51
  return { file: lockfilePnpm, mode: 'pnpm' }
49
52
  } else if (existsSync(lockfileBun) || existsSync(lockfileBunBinary)) {
50
53
  return { file: lockfileBun, mode: 'bun' }
@@ -61,7 +64,7 @@ function detectLockfile() {
61
64
  return { file: lockfileDeno, mode: 'deno' }
62
65
  }
63
66
  throw new BrowserslistUpdateError(
64
- 'No lockfile found. Run "npm install", "yarn install", "pnpm install", "bun install" or "deno install"'
67
+ 'No lockfile found. Run "npm install", "yarn install", "pnpm install", "bun install", "deno install" or "aube install"'
65
68
  )
66
69
  }
67
70
 
@@ -92,6 +95,9 @@ function getLatestInfo(lock) {
92
95
  if (lock.mode === 'bun') {
93
96
  return JSON.parse(execSync('bun info caniuse-lite --json').toString())
94
97
  }
98
+ if (lock.mode === 'aube') {
99
+ return JSON.parse(execSync('aube info caniuse-lite --json').toString())
100
+ }
95
101
  if (lock.mode === 'deno') {
96
102
  let result = JSON.parse(
97
103
  execSync(
@@ -558,11 +564,15 @@ function updatePnpmStrict(print, lock, packages) {
558
564
  } /* c8 ignore end */
559
565
  }
560
566
 
561
- function updatePnpm(print, lock) {
567
+ function getLockedPackages(lock) {
562
568
  let lockContent = readFileSync(lock.file).toString()
563
- let packages = lockContent.includes('baseline-browser-mapping')
569
+ return lockContent.includes('baseline-browser-mapping')
564
570
  ? ['caniuse-lite', 'baseline-browser-mapping']
565
571
  : ['caniuse-lite']
572
+ }
573
+
574
+ function updatePnpm(print, lock) {
575
+ let packages = getLockedPackages(lock)
566
576
  let command = 'pnpm up --depth=9999 --no-save ' + packages.join(' ')
567
577
 
568
578
  print('Updating caniuse-lite version\n' + pico.yellow('$ ' + command) + '\n')
@@ -594,6 +604,19 @@ function updatePnpm(print, lock) {
594
604
  } /* c8 ignore end */
595
605
  }
596
606
 
607
+ /**
608
+ * aube ignores `--depth` and only refreshes direct dependencies, so
609
+ * `aube update caniuse-lite` leaves a transitive caniuse-lite where it is.
610
+ * Asking for `@latest` re-resolves every copy without touching package.json.
611
+ * aube rejects names that are not in the dependency graph, so
612
+ * baseline-browser-mapping is only passed when the lockfile has it.
613
+ * aube applies its own minimumReleaseAge to the `@latest` resolution.
614
+ */
615
+ function updateAube(print, lock) {
616
+ let packages = getLockedPackages(lock)
617
+ updateWith(print, 'aube update ' + packages.map(i => i + '@latest').join(' '))
618
+ }
619
+
597
620
  function updateWith(print, cmd, message = 'Updating caniuse-lite version') {
598
621
  print(message + '\n' + pico.yellow('$ ' + cmd) + '\n')
599
622
  try {
@@ -637,6 +660,8 @@ module.exports = function updateDB(print = defaultPrint) {
637
660
  updatePnpm(print, lock)
638
661
  } else if (lock.mode === 'bun') {
639
662
  updateBun(print, lock, latest)
663
+ } else if (lock.mode === 'aube') {
664
+ updateAube(print, lock)
640
665
  } else if (lock.mode === 'deno') {
641
666
  updateWith(print, 'deno add npm:caniuse-lite npm:baseline-browser-mapping')
642
667
  updateWith(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "update-browserslist-db",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "description": "CLI tool to update caniuse-lite to refresh target browsers from Browserslist config",
5
5
  "keywords": [
6
6
  "browsers",