Skip to content

Commit 1a03fa7

Browse files
authored
Update JS dependencies (#15033)
* Update JS dependencies - Update all JS dependencies - For octicons, rename trashcan to trash - For svgo, migrate to v2 api, output seems to have slightly changed but icons look the same - For stylelint, update config, fix custom property duplicates - For monaco, drop legacy Edge support - For eslint, enable new rules, fix new issues - For less-loader, remove deprecated import syntax * update svgo usage in generate-images and rebuild logo.svg with it
1 parent a587a28 commit 1a03fa7

File tree

273 files changed

+1861
-1659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+1861
-1659
lines changed

.eslintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ rules:
344344
unicode-bom: [2, never]
345345
unicorn/better-regex: [0]
346346
unicorn/catch-error-name: [0]
347+
unicorn/consistent-destructuring: [2]
347348
unicorn/consistent-function-scoping: [2]
348349
unicorn/custom-error-definition: [0]
349350
unicorn/empty-brace-spaces: [2]
@@ -356,19 +357,24 @@ rules:
356357
unicorn/import-style: [0]
357358
unicorn/new-for-builtins: [2]
358359
unicorn/no-abusive-eslint-disable: [0]
360+
unicorn/no-array-for-each: [0]
359361
unicorn/no-array-instanceof: [0]
362+
unicorn/no-array-push-push: [2]
360363
unicorn/no-console-spaces: [0]
361364
unicorn/no-fn-reference-in-iterator: [0]
362365
unicorn/no-for-loop: [0]
363366
unicorn/no-hex-escape: [0]
364367
unicorn/no-keyword-prefix: [0]
365368
unicorn/no-lonely-if: [2]
366369
unicorn/no-nested-ternary: [0]
370+
unicorn/no-new-array: [0]
367371
unicorn/no-new-buffer: [0]
368372
unicorn/no-null: [0]
369373
unicorn/no-object-as-default-parameter: [2]
370374
unicorn/no-process-exit: [0]
371375
unicorn/no-reduce: [2]
376+
unicorn/no-static-only-class: [2]
377+
unicorn/no-this-assignment: [2]
372378
unicorn/no-unreadable-array-destructuring: [0]
373379
unicorn/no-unsafe-regex: [0]
374380
unicorn/no-unused-properties: [2]
@@ -378,8 +384,12 @@ rules:
378384
unicorn/numeric-separators-style: [0]
379385
unicorn/prefer-add-event-listener: [2]
380386
unicorn/prefer-array-find: [2]
387+
unicorn/prefer-array-flat: [2]
388+
unicorn/prefer-array-index-of: [2]
389+
unicorn/prefer-array-some: [2]
381390
unicorn/prefer-dataset: [2]
382391
unicorn/prefer-date-now: [2]
392+
unicorn/prefer-default-parameters: [0]
383393
unicorn/prefer-event-key: [2]
384394
unicorn/prefer-includes: [2]
385395
unicorn/prefer-math-trunc: [2]
@@ -391,6 +401,7 @@ rules:
391401
unicorn/prefer-optional-catch-binding: [2]
392402
unicorn/prefer-query-selector: [0]
393403
unicorn/prefer-reflect-apply: [0]
404+
unicorn/prefer-regexp-test: [2]
394405
unicorn/prefer-replace-all: [0]
395406
unicorn/prefer-set-has: [0]
396407
unicorn/prefer-spread: [0]

build/generate-images.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33

44
const imageminZopfli = require('imagemin-zopfli');
5-
const Svgo = require('svgo');
5+
const {optimize, extendDefaultPlugins} = require('svgo');
66
const {fabric} = require('fabric');
77
const {readFile, writeFile} = require('fs').promises;
88
const {resolve} = require('path');
@@ -24,14 +24,15 @@ function loadSvg(svg) {
2424

2525
async function generate(svg, outputFile, {size, bg}) {
2626
if (outputFile.endsWith('.svg')) {
27-
const svgo = new Svgo({
28-
plugins: [
29-
{removeDimensions: true},
30-
{addAttributesToSVGElement: {attributes: [{width: size}, {height: size}]}},
31-
],
27+
const {data} = optimize(svg, {
28+
plugins: extendDefaultPlugins([
29+
'removeDimensions',
30+
{
31+
name: 'addAttributesToSVGElement',
32+
params: {attributes: [{width: size}, {height: size}]}
33+
},
34+
]),
3235
});
33-
34-
const {data} = await svgo.optimize(svg);
3536
await writeFile(outputFile, data);
3637
return;
3738
}

build/generate-svg.js

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33

44
const fastGlob = require('fast-glob');
5-
const Svgo = require('svgo');
5+
const {optimize, extendDefaultPlugins} = require('svgo');
66
const {resolve, parse} = require('path');
77
const {readFile, writeFile, mkdir} = require('fs').promises;
88

@@ -25,31 +25,20 @@ async function processFile(file, {prefix, fullName} = {}) {
2525
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
2626
}
2727

28-
const svgo = new Svgo({
29-
plugins: [
30-
{removeXMLNS: true},
31-
{removeDimensions: true},
28+
const {data} = optimize(await readFile(file, 'utf8'), {
29+
plugins: extendDefaultPlugins([
30+
'removeXMLNS',
31+
'removeDimensions',
3232
{
33-
addClassesToSVGElement: {
34-
classNames: [
35-
'svg',
36-
name,
37-
],
38-
},
33+
name: 'addClassesToSVGElement',
34+
params: {classNames: ['svg', name]},
3935
},
4036
{
41-
addAttributesToSVGElement: {
42-
attributes: [
43-
{'width': '16'},
44-
{'height': '16'},
45-
{'aria-hidden': 'true'},
46-
],
47-
},
37+
name: 'addAttributesToSVGElement',
38+
params: {attributes: [{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'}]},
4839
},
49-
],
40+
]),
5041
});
51-
52-
const {data} = await svgo.optimize(await readFile(file, 'utf8'));
5342
await writeFile(resolve(outputDir, `${name}.svg`), data);
5443
}
5544

docs/content/page/index.de-de.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ Gitea ist ein [Gogs](http://gogs.io)-Fork.
3232

3333
## Browser Unterstützung
3434

35-
- Letzten 2 Versions von Chrome, Firefox, Safari, Edge (EdgeHTML) and Edge (Chromium)
35+
- Letzten 2 Versions von Chrome, Firefox, Safari und Edge
3636
- Firefox ESR

docs/content/page/index.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
262262

263263
## Browser Support
264264

265-
- Last 2 versions of Chrome, Firefox, Safari, Edge (EdgeHTML) and Edge (Chromium)
265+
- Last 2 versions of Chrome, Firefox, Safari and Edge
266266
- Firefox ESR
267267

268268
## Components

docs/content/page/index.zh-tw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Gitea 是從 [Gogs](http://gogs.io) Fork 出來的,請閱讀部落格文章 [G
261261

262262
## 瀏覽器支援
263263

264-
- 最近 2 個版本的 Chrome, Firefox, Safari, Edge (EdgeHTML), Edge (Chromium)
264+
- 最近 2 個版本的 Chrome, Firefox, Safari, Edge
265265
- Firefox ESR
266266

267267
## 元件

0 commit comments

Comments
 (0)