update-browserslist-db 1.0.0 → 1.0.3
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.
- package/index.d.ts +1 -1
- package/index.js +11 -5
- package/package.json +4 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -15,6 +15,11 @@ function BrowserslistUpdateError(message) {
|
|
|
15
15
|
|
|
16
16
|
BrowserslistUpdateError.prototype = Error.prototype
|
|
17
17
|
|
|
18
|
+
/* c8 ignore next 3 */
|
|
19
|
+
function defaultPrint(str) {
|
|
20
|
+
process.stdout.write(str)
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
function detectLockfile() {
|
|
19
24
|
let packageDir = escalade('.', (dir, names) => {
|
|
20
25
|
return names.indexOf('package.json') !== -1 ? dir : ''
|
|
@@ -23,7 +28,7 @@ function detectLockfile() {
|
|
|
23
28
|
if (!packageDir) {
|
|
24
29
|
throw new BrowserslistUpdateError(
|
|
25
30
|
'Cannot find package.json. ' +
|
|
26
|
-
'Is this the right directory to run `npx
|
|
31
|
+
'Is this the right directory to run `npx update-browserslist-db` in?'
|
|
27
32
|
)
|
|
28
33
|
}
|
|
29
34
|
|
|
@@ -67,8 +72,9 @@ function getLatestInfo(lock) {
|
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
function getBrowsersList() {
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
let spawn = childProcess.spawnSync('npx', ['browserslist'])
|
|
76
|
+
if (spawn.status !== 0) throw new Error(spawn.stderr.toString())
|
|
77
|
+
return spawn.stdout
|
|
72
78
|
.toString()
|
|
73
79
|
.trim()
|
|
74
80
|
.split('\n')
|
|
@@ -268,7 +274,7 @@ function updateWith(print, cmd) {
|
|
|
268
274
|
} /* c8 ignore end */
|
|
269
275
|
}
|
|
270
276
|
|
|
271
|
-
module.exports = function updateDB(print) {
|
|
277
|
+
module.exports = function updateDB(print = defaultPrint) {
|
|
272
278
|
let lock = detectLockfile()
|
|
273
279
|
let latest = getLatestInfo(lock)
|
|
274
280
|
|
|
@@ -305,7 +311,7 @@ module.exports = function updateDB(print) {
|
|
|
305
311
|
print(
|
|
306
312
|
pico.red(
|
|
307
313
|
'\n' +
|
|
308
|
-
browsersListRetrievalError.
|
|
314
|
+
browsersListRetrievalError.message +
|
|
309
315
|
'\n\n' +
|
|
310
316
|
'Problem with browser list retrieval.\n' +
|
|
311
317
|
'Target browser changes won’t be shown.\n'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "update-browserslist-db",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "CLI tool to update caniuse-lite to refresh target browsers from Browserslist config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"caniuse",
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"escalade": "^3.1.1",
|
|
30
30
|
"picocolors": "^1.0.0"
|
|
31
31
|
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"browserslist": ">= 4.21.0"
|
|
34
|
+
},
|
|
32
35
|
"bin": {
|
|
33
36
|
"browserslist-lint": "cli.js"
|
|
34
37
|
}
|