progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/update-browserslist-db
20
assets_old/node_modules/update-browserslist-db/LICENSE
generated
vendored
Normal file
20
assets_old/node_modules/update-browserslist-db/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright 2022 Andrey Sitnik <andrey@sitnik.ru> and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
assets_old/node_modules/update-browserslist-db/README.md
generated
vendored
Normal file
23
assets_old/node_modules/update-browserslist-db/README.md
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Update Browserslist DB
|
||||
|
||||
<img width="120" height="120" alt="Browserslist logo by Anton Lovchikov"
|
||||
src="https://browserslist.github.io/browserslist/logo.svg" align="right">
|
||||
|
||||
CLI tool to update `caniuse-lite` with browsers DB
|
||||
from [Browserslist](https://github.com/browserslist/browserslist/) config.
|
||||
|
||||
Some queries like `last 2 version` or `>1%` depends on actual data
|
||||
from `caniuse-lite`.
|
||||
|
||||
```sh
|
||||
npx update-browserslist-db@latest
|
||||
```
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=update-browserslist-db">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="Sponsored by Evil Martians" width="236" height="54">
|
||||
</a>
|
||||
|
||||
|
||||
## Docs
|
||||
Read **[full docs](https://github.com/browserslist/update-db#readme)** on GitHub.
|
16
assets_old/node_modules/update-browserslist-db/check-npm-version.js
generated
vendored
Normal file
16
assets_old/node_modules/update-browserslist-db/check-npm-version.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
let { execSync } = require('child_process')
|
||||
let pico = require('picocolors')
|
||||
|
||||
try {
|
||||
let version = parseInt(execSync('npm -v'))
|
||||
if (version <= 6) {
|
||||
process.stderr.write(
|
||||
pico.red(
|
||||
'Update npm or call ' +
|
||||
pico.yellow('npx browserslist@latest --update-db') +
|
||||
'\n'
|
||||
)
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
} catch (e) {}
|
42
assets_old/node_modules/update-browserslist-db/cli.js
generated
vendored
Executable file
42
assets_old/node_modules/update-browserslist-db/cli.js
generated
vendored
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
let { readFileSync } = require('fs')
|
||||
let { join } = require('path')
|
||||
|
||||
require('./check-npm-version')
|
||||
let updateDb = require('./')
|
||||
|
||||
const ROOT = __dirname
|
||||
|
||||
function getPackage() {
|
||||
return JSON.parse(readFileSync(join(ROOT, 'package.json')))
|
||||
}
|
||||
|
||||
let args = process.argv.slice(2)
|
||||
|
||||
let USAGE = 'Usage:\n npx update-browserslist-db\n'
|
||||
|
||||
function isArg(arg) {
|
||||
return args.some(i => i === arg)
|
||||
}
|
||||
|
||||
function error(msg) {
|
||||
process.stderr.write('update-browserslist-db: ' + msg + '\n')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (isArg('--help') || isArg('-h')) {
|
||||
process.stdout.write(getPackage().description + '.\n\n' + USAGE + '\n')
|
||||
} else if (isArg('--version') || isArg('-v')) {
|
||||
process.stdout.write('browserslist-lint ' + getPackage().version + '\n')
|
||||
} else {
|
||||
try {
|
||||
updateDb()
|
||||
} catch (e) {
|
||||
if (e.name === 'BrowserslistUpdateError') {
|
||||
error(e.message)
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
6
assets_old/node_modules/update-browserslist-db/index.d.ts
generated
vendored
Normal file
6
assets_old/node_modules/update-browserslist-db/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* Run update and print output to terminal.
|
||||
*/
|
||||
declare function updateDb(print?: (str: string) => void): Promise<void>
|
||||
|
||||
export = updateDb
|
301
assets_old/node_modules/update-browserslist-db/index.js
generated
vendored
Normal file
301
assets_old/node_modules/update-browserslist-db/index.js
generated
vendored
Normal file
|
@ -0,0 +1,301 @@
|
|||
let childProcess = require('child_process')
|
||||
let escalade = require('escalade/sync')
|
||||
let pico = require('picocolors')
|
||||
let path = require('path')
|
||||
let fs = require('fs')
|
||||
|
||||
function BrowserslistUpdateError(message) {
|
||||
this.name = 'BrowserslistUpdateError'
|
||||
this.message = message
|
||||
this.browserslist = true
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, BrowserslistUpdateError)
|
||||
}
|
||||
}
|
||||
|
||||
BrowserslistUpdateError.prototype = Error.prototype
|
||||
|
||||
/* c8 ignore next 3 */
|
||||
function defaultPrint(str) {
|
||||
process.stdout.write(str)
|
||||
}
|
||||
|
||||
function detectLockfile() {
|
||||
let packageDir = escalade('.', (dir, names) => {
|
||||
return names.indexOf('package.json') !== -1 ? dir : ''
|
||||
})
|
||||
|
||||
if (!packageDir) {
|
||||
throw new BrowserslistUpdateError(
|
||||
'Cannot find package.json. ' +
|
||||
'Is this the right directory to run `npx update-browserslist-db` in?'
|
||||
)
|
||||
}
|
||||
|
||||
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')
|
||||
|
||||
if (fs.existsSync(lockfilePnpm)) {
|
||||
return { mode: 'pnpm', file: lockfilePnpm }
|
||||
} else if (fs.existsSync(lockfileNpm)) {
|
||||
return { mode: 'npm', file: lockfileNpm }
|
||||
} else if (fs.existsSync(lockfileYarn)) {
|
||||
let lock = { mode: 'yarn', file: lockfileYarn }
|
||||
lock.content = fs.readFileSync(lock.file).toString()
|
||||
lock.version = /# yarn lockfile v1/.test(lock.content) ? 1 : 2
|
||||
return lock
|
||||
} else if (fs.existsSync(lockfileShrinkwrap)) {
|
||||
return { mode: 'npm', file: lockfileShrinkwrap }
|
||||
}
|
||||
throw new BrowserslistUpdateError(
|
||||
'No lockfile found. Run "npm install", "yarn install" or "pnpm install"'
|
||||
)
|
||||
}
|
||||
|
||||
function getLatestInfo(lock) {
|
||||
if (lock.mode === 'yarn') {
|
||||
if (lock.version === 1) {
|
||||
return JSON.parse(
|
||||
childProcess.execSync('yarn info caniuse-lite --json').toString()
|
||||
).data
|
||||
} else {
|
||||
return JSON.parse(
|
||||
childProcess.execSync('yarn npm info caniuse-lite --json').toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
return JSON.parse(
|
||||
childProcess.execSync('npm show caniuse-lite --json').toString()
|
||||
)
|
||||
}
|
||||
|
||||
function getBrowsers() {
|
||||
let browserslist = require('browserslist')
|
||||
return browserslist().reduce((result, entry) => {
|
||||
if (!result[entry[0]]) {
|
||||
result[entry[0]] = []
|
||||
}
|
||||
result[entry[0]].push(entry[1])
|
||||
return result
|
||||
}, {})
|
||||
}
|
||||
|
||||
function diffBrowsers(old, current) {
|
||||
let browsers = Object.keys(old).concat(
|
||||
Object.keys(current).filter(browser => old[browser] === undefined)
|
||||
)
|
||||
return browsers
|
||||
.map(browser => {
|
||||
let oldVersions = old[browser] || []
|
||||
let currentVersions = current[browser] || []
|
||||
let common = oldVersions.filter(v => currentVersions.includes(v))
|
||||
let added = currentVersions.filter(v => !common.includes(v))
|
||||
let removed = oldVersions.filter(v => !common.includes(v))
|
||||
return removed
|
||||
.map(v => pico.red('- ' + browser + ' ' + v))
|
||||
.concat(added.map(v => pico.green('+ ' + browser + ' ' + v)))
|
||||
})
|
||||
.reduce((result, array) => result.concat(array), [])
|
||||
.join('\n')
|
||||
}
|
||||
|
||||
function updateNpmLockfile(lock, latest) {
|
||||
let metadata = { latest, versions: [] }
|
||||
let content = deletePackage(JSON.parse(lock.content), metadata)
|
||||
metadata.content = JSON.stringify(content, null, ' ')
|
||||
return metadata
|
||||
}
|
||||
|
||||
function deletePackage(node, metadata) {
|
||||
if (node.dependencies) {
|
||||
if (node.dependencies['caniuse-lite']) {
|
||||
let version = node.dependencies['caniuse-lite'].version
|
||||
metadata.versions[version] = true
|
||||
delete node.dependencies['caniuse-lite']
|
||||
}
|
||||
for (let i in node.dependencies) {
|
||||
node.dependencies[i] = deletePackage(node.dependencies[i], metadata)
|
||||
}
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
let yarnVersionRe = /version "(.*?)"/
|
||||
|
||||
function updateYarnLockfile(lock, latest) {
|
||||
let blocks = lock.content.split(/(\n{2,})/).map(block => {
|
||||
return block.split('\n')
|
||||
})
|
||||
let versions = {}
|
||||
blocks.forEach(lines => {
|
||||
if (lines[0].indexOf('caniuse-lite@') !== -1) {
|
||||
let match = yarnVersionRe.exec(lines[1])
|
||||
versions[match[1]] = true
|
||||
if (match[1] !== latest.version) {
|
||||
lines[1] = lines[1].replace(
|
||||
/version "[^"]+"/,
|
||||
'version "' + latest.version + '"'
|
||||
)
|
||||
lines[2] = lines[2].replace(
|
||||
/resolved "[^"]+"/,
|
||||
'resolved "' + latest.dist.tarball + '"'
|
||||
)
|
||||
if (lines.length === 4) {
|
||||
lines[3] = latest.dist.integrity
|
||||
? lines[3].replace(
|
||||
/integrity .+/,
|
||||
'integrity ' + latest.dist.integrity
|
||||
)
|
||||
: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
let content = blocks.map(lines => lines.join('\n')).join('')
|
||||
return { content, versions }
|
||||
}
|
||||
|
||||
function updateLockfile(lock, latest) {
|
||||
if (!lock.content) lock.content = fs.readFileSync(lock.file).toString()
|
||||
|
||||
if (lock.mode === 'yarn') {
|
||||
return updateYarnLockfile(lock, latest)
|
||||
} else {
|
||||
return updateNpmLockfile(lock, latest)
|
||||
}
|
||||
}
|
||||
|
||||
function updatePackageManually(print, lock, latest) {
|
||||
let lockfileData = updateLockfile(lock, latest)
|
||||
let caniuseVersions = Object.keys(lockfileData.versions).sort()
|
||||
if (caniuseVersions.length === 1 && caniuseVersions[0] === latest.version) {
|
||||
print(
|
||||
'Installed version: ' +
|
||||
pico.bold(pico.green(latest.version)) +
|
||||
'\n' +
|
||||
pico.bold(pico.green('caniuse-lite is up to date')) +
|
||||
'\n'
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (caniuseVersions.length === 0) {
|
||||
caniuseVersions[0] = 'none'
|
||||
}
|
||||
print(
|
||||
'Installed version' +
|
||||
(caniuseVersions.length === 1 ? ': ' : 's: ') +
|
||||
pico.bold(pico.red(caniuseVersions.join(', '))) +
|
||||
'\n' +
|
||||
'Removing old caniuse-lite from lock file\n'
|
||||
)
|
||||
fs.writeFileSync(lock.file, lockfileData.content)
|
||||
|
||||
let install = lock.mode === 'yarn' ? 'yarn add -W' : lock.mode + ' install'
|
||||
print(
|
||||
'Installing new caniuse-lite version\n' +
|
||||
pico.yellow('$ ' + install + ' caniuse-lite') +
|
||||
'\n'
|
||||
)
|
||||
try {
|
||||
childProcess.execSync(install + ' caniuse-lite')
|
||||
} catch (e) /* c8 ignore start */ {
|
||||
print(
|
||||
pico.red(
|
||||
'\n' +
|
||||
e.stack +
|
||||
'\n\n' +
|
||||
'Problem with `' +
|
||||
install +
|
||||
' caniuse-lite` call. ' +
|
||||
'Run it manually.\n'
|
||||
)
|
||||
)
|
||||
process.exit(1)
|
||||
} /* c8 ignore end */
|
||||
|
||||
let del = lock.mode === 'yarn' ? 'yarn remove -W' : lock.mode + ' uninstall'
|
||||
print(
|
||||
'Cleaning package.json dependencies from caniuse-lite\n' +
|
||||
pico.yellow('$ ' + del + ' caniuse-lite') +
|
||||
'\n'
|
||||
)
|
||||
childProcess.execSync(del + ' caniuse-lite')
|
||||
}
|
||||
|
||||
function updateWith(print, cmd) {
|
||||
print('Updating caniuse-lite version\n' + pico.yellow('$ ' + cmd) + '\n')
|
||||
try {
|
||||
childProcess.execSync(cmd)
|
||||
} catch (e) /* c8 ignore start */ {
|
||||
print(pico.red(e.stdout.toString()))
|
||||
print(
|
||||
pico.red(
|
||||
'\n' +
|
||||
e.stack +
|
||||
'\n\n' +
|
||||
'Problem with `' +
|
||||
cmd +
|
||||
'` call. ' +
|
||||
'Run it manually.\n'
|
||||
)
|
||||
)
|
||||
process.exit(1)
|
||||
} /* c8 ignore end */
|
||||
}
|
||||
|
||||
module.exports = function updateDB(print = defaultPrint) {
|
||||
let lock = detectLockfile()
|
||||
let latest = getLatestInfo(lock)
|
||||
|
||||
let listError
|
||||
let oldList
|
||||
try {
|
||||
oldList = getBrowsers()
|
||||
} catch (e) {
|
||||
listError = e
|
||||
}
|
||||
|
||||
print('Latest version: ' + pico.bold(pico.green(latest.version)) + '\n')
|
||||
|
||||
if (lock.mode === 'yarn' && lock.version !== 1) {
|
||||
updateWith(print, 'yarn up -R caniuse-lite')
|
||||
} else if (lock.mode === 'pnpm') {
|
||||
updateWith(print, 'pnpm up caniuse-lite')
|
||||
} else {
|
||||
updatePackageManually(print, lock, latest)
|
||||
}
|
||||
|
||||
print('caniuse-lite has been successfully updated\n')
|
||||
|
||||
let newList
|
||||
if (!listError) {
|
||||
try {
|
||||
newList = getBrowsers()
|
||||
} catch (e) /* c8 ignore start */ {
|
||||
listError = e
|
||||
} /* c8 ignore end */
|
||||
}
|
||||
|
||||
if (listError) {
|
||||
print(
|
||||
pico.red(
|
||||
'\n' +
|
||||
listError.stack +
|
||||
'\n\n' +
|
||||
'Problem with browser list retrieval.\n' +
|
||||
'Target browser changes won’t be shown.\n'
|
||||
)
|
||||
)
|
||||
} else {
|
||||
let changes = diffBrowsers(oldList, newList)
|
||||
if (changes) {
|
||||
print('\nTarget browser changes:\n')
|
||||
print(changes + '\n')
|
||||
} else {
|
||||
print('\n' + pico.green('No target browser changes') + '\n')
|
||||
}
|
||||
}
|
||||
}
|
38
assets_old/node_modules/update-browserslist-db/package.json
generated
vendored
Normal file
38
assets_old/node_modules/update-browserslist-db/package.json
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "update-browserslist-db",
|
||||
"version": "1.0.5",
|
||||
"description": "CLI tool to update caniuse-lite to refresh target browsers from Browserslist config",
|
||||
"keywords": [
|
||||
"caniuse",
|
||||
"browsers",
|
||||
"target"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/browserslist"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/browserslist"
|
||||
}
|
||||
],
|
||||
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
||||
"license": "MIT",
|
||||
"repository": "browserslist/update-db",
|
||||
"types": "./index.d.ts",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"escalade": "^3.1.1",
|
||||
"picocolors": "^1.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"browserslist": ">= 4.21.0"
|
||||
},
|
||||
"bin": {
|
||||
"browserslist-lint": "cli.js"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue