update-browserslist-db 1.0.14 → 1.0.16
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/.devcontainer.json +42 -0
- package/check-npm-version.js +2 -1
- package/cli.js +2 -2
- package/index.js +32 -17
- package/package.json +2 -2
- package/utils.js +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"image": "localhost/ai-opensource:latest",
|
|
3
|
+
"forwardPorts": [],
|
|
4
|
+
"mounts": [
|
|
5
|
+
{
|
|
6
|
+
"source": "pnpm-store",
|
|
7
|
+
"target": "/home/ai/.local/share/pnpm/store",
|
|
8
|
+
"type": "volume"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"source": "shell-history",
|
|
12
|
+
"target": "/home/ai/.shell-history/",
|
|
13
|
+
"type": "volume"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"workspaceMount": "",
|
|
17
|
+
"runArgs": [
|
|
18
|
+
"--userns=keep-id:uid=1000,gid=1000",
|
|
19
|
+
"--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z"
|
|
20
|
+
],
|
|
21
|
+
"customizations": {
|
|
22
|
+
"vscode": {
|
|
23
|
+
"extensions": [
|
|
24
|
+
"connor4312.nodejs-testing",
|
|
25
|
+
"dbaeumer.vscode-eslint",
|
|
26
|
+
"esbenp.prettier-vscode",
|
|
27
|
+
"stylelint.vscode-stylelint",
|
|
28
|
+
"svelte.svelte-vscode",
|
|
29
|
+
"yoavbls.pretty-ts-errors",
|
|
30
|
+
"tamasfe.even-better-toml",
|
|
31
|
+
"streetsidesoftware.code-spell-checker",
|
|
32
|
+
"editorconfig.editorconfig",
|
|
33
|
+
"yzhang.markdown-all-in-one",
|
|
34
|
+
"streetsidesoftware.code-spell-checker-russian",
|
|
35
|
+
"christian-kohler.path-intellisense",
|
|
36
|
+
"christian-kohler.npm-intellisense",
|
|
37
|
+
"VisualStudioExptTeam.vscodeintellicode",
|
|
38
|
+
"davidlday.languagetool-linter"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/check-npm-version.js
CHANGED
package/cli.js
CHANGED
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
let { existsSync, readFileSync, writeFileSync } = require('
|
|
2
|
-
let { execSync } = require('
|
|
3
|
-
let { join } = require('
|
|
1
|
+
let { existsSync, readFileSync, writeFileSync } = require('fs')
|
|
2
|
+
let { execSync } = require('child_process')
|
|
3
|
+
let { join } = require('path')
|
|
4
4
|
let escalade = require('escalade/sync')
|
|
5
5
|
let pico = require('picocolors')
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ function BrowserslistUpdateError(message) {
|
|
|
18
18
|
BrowserslistUpdateError.prototype = Error.prototype
|
|
19
19
|
|
|
20
20
|
// Check if HADOOP_HOME is set to determine if this is running in a Hadoop environment
|
|
21
|
-
const IsHadoopExists = !!
|
|
21
|
+
const IsHadoopExists = !!process.env.HADOOP_HOME
|
|
22
22
|
const yarnCommand = IsHadoopExists ? 'yarnpkg' : 'yarn'
|
|
23
23
|
|
|
24
24
|
/* c8 ignore next 3 */
|
|
@@ -63,9 +63,13 @@ function detectLockfile() {
|
|
|
63
63
|
function getLatestInfo(lock) {
|
|
64
64
|
if (lock.mode === 'yarn') {
|
|
65
65
|
if (lock.version === 1) {
|
|
66
|
-
return JSON.parse(
|
|
66
|
+
return JSON.parse(
|
|
67
|
+
execSync(yarnCommand + ' info caniuse-lite --json').toString()
|
|
68
|
+
).data
|
|
67
69
|
} else {
|
|
68
|
-
return JSON.parse(
|
|
70
|
+
return JSON.parse(
|
|
71
|
+
execSync(yarnCommand + ' npm info caniuse-lite --json').toString()
|
|
72
|
+
)
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
if (lock.mode === 'pnpm') {
|
|
@@ -210,7 +214,8 @@ function updatePackageManually(print, lock, latest) {
|
|
|
210
214
|
)
|
|
211
215
|
writeFileSync(lock.file, lockfileData.content)
|
|
212
216
|
|
|
213
|
-
let install =
|
|
217
|
+
let install =
|
|
218
|
+
lock.mode === 'yarn' ? yarnCommand + ' add -W' : lock.mode + ' install'
|
|
214
219
|
print(
|
|
215
220
|
'Installing new caniuse-lite version\n' +
|
|
216
221
|
pico.yellow('$ ' + install + ' caniuse-lite') +
|
|
@@ -233,7 +238,8 @@ function updatePackageManually(print, lock, latest) {
|
|
|
233
238
|
process.exit(1)
|
|
234
239
|
} /* c8 ignore end */
|
|
235
240
|
|
|
236
|
-
let del =
|
|
241
|
+
let del =
|
|
242
|
+
lock.mode === 'yarn' ? yarnCommand + ' remove -W' : lock.mode + ' uninstall'
|
|
237
243
|
print(
|
|
238
244
|
'Cleaning package.json dependencies from caniuse-lite\n' +
|
|
239
245
|
pico.yellow('$ ' + del + ' caniuse-lite') +
|
|
@@ -243,7 +249,7 @@ function updatePackageManually(print, lock, latest) {
|
|
|
243
249
|
}
|
|
244
250
|
|
|
245
251
|
function updateWith(print, cmd) {
|
|
246
|
-
print(
|
|
252
|
+
print('Updating caniuse-lite version\n' + pico.yellow('$ ' + cmd) + '\n')
|
|
247
253
|
try {
|
|
248
254
|
execSync(cmd)
|
|
249
255
|
} catch (e) /* c8 ignore start */ {
|
|
@@ -297,15 +303,24 @@ module.exports = function updateDB(print = defaultPrint) {
|
|
|
297
303
|
}
|
|
298
304
|
|
|
299
305
|
if (listError) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
'Target browser changes won’t be shown.\n'
|
|
306
|
+
if (listError.message.includes("Cannot find module 'browserslist'")) {
|
|
307
|
+
print(
|
|
308
|
+
pico.gray(
|
|
309
|
+
'Install `browserslist` to your direct dependencies ' +
|
|
310
|
+
'to see target browser changes\n'
|
|
311
|
+
)
|
|
307
312
|
)
|
|
308
|
-
|
|
313
|
+
} else {
|
|
314
|
+
print(
|
|
315
|
+
pico.red(
|
|
316
|
+
'\n' +
|
|
317
|
+
listError.stack +
|
|
318
|
+
'\n\n' +
|
|
319
|
+
'Problem with browser list retrieval.\n' +
|
|
320
|
+
'Target browser changes won’t be shown.\n'
|
|
321
|
+
)
|
|
322
|
+
)
|
|
323
|
+
}
|
|
309
324
|
} else {
|
|
310
325
|
let changes = diffBrowsers(oldList, newList)
|
|
311
326
|
if (changes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "update-browserslist-db",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "CLI tool to update caniuse-lite to refresh target browsers from Browserslist config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"caniuse",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"escalade": "^3.1.2",
|
|
34
|
-
"picocolors": "^1.0.
|
|
34
|
+
"picocolors": "^1.0.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"browserslist": ">= 4.21.0"
|
package/utils.js
CHANGED