Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JS dependencies #15033

Merged
merged 5 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ rules:
unicode-bom: [2, never]
unicorn/better-regex: [0]
unicorn/catch-error-name: [0]
unicorn/consistent-destructuring: [2]
unicorn/consistent-function-scoping: [2]
unicorn/custom-error-definition: [0]
unicorn/empty-brace-spaces: [2]
Expand All @@ -356,19 +357,24 @@ rules:
unicorn/import-style: [0]
unicorn/new-for-builtins: [2]
unicorn/no-abusive-eslint-disable: [0]
unicorn/no-array-for-each: [0]
unicorn/no-array-instanceof: [0]
unicorn/no-array-push-push: [2]
unicorn/no-console-spaces: [0]
unicorn/no-fn-reference-in-iterator: [0]
unicorn/no-for-loop: [0]
unicorn/no-hex-escape: [0]
unicorn/no-keyword-prefix: [0]
unicorn/no-lonely-if: [2]
unicorn/no-nested-ternary: [0]
unicorn/no-new-array: [0]
unicorn/no-new-buffer: [0]
unicorn/no-null: [0]
unicorn/no-object-as-default-parameter: [2]
unicorn/no-process-exit: [0]
unicorn/no-reduce: [2]
unicorn/no-static-only-class: [2]
unicorn/no-this-assignment: [2]
unicorn/no-unreadable-array-destructuring: [0]
unicorn/no-unsafe-regex: [0]
unicorn/no-unused-properties: [2]
Expand All @@ -378,8 +384,12 @@ rules:
unicorn/numeric-separators-style: [0]
unicorn/prefer-add-event-listener: [2]
unicorn/prefer-array-find: [2]
unicorn/prefer-array-flat: [2]
unicorn/prefer-array-index-of: [2]
unicorn/prefer-array-some: [2]
unicorn/prefer-dataset: [2]
unicorn/prefer-date-now: [2]
unicorn/prefer-default-parameters: [0]
unicorn/prefer-event-key: [2]
unicorn/prefer-includes: [2]
unicorn/prefer-math-trunc: [2]
Expand All @@ -391,6 +401,7 @@ rules:
unicorn/prefer-optional-catch-binding: [2]
unicorn/prefer-query-selector: [0]
unicorn/prefer-reflect-apply: [0]
unicorn/prefer-regexp-test: [2]
unicorn/prefer-replace-all: [0]
unicorn/prefer-set-has: [0]
unicorn/prefer-spread: [0]
Expand Down
17 changes: 9 additions & 8 deletions build/generate-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';

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

async function generate(svg, outputFile, {size, bg}) {
if (outputFile.endsWith('.svg')) {
const svgo = new Svgo({
plugins: [
{removeDimensions: true},
{addAttributesToSVGElement: {attributes: [{width: size}, {height: size}]}},
],
const {data} = optimize(svg, {
plugins: extendDefaultPlugins([
'removeDimensions',
{
name: 'addAttributesToSVGElement',
params: {attributes: [{width: size}, {height: size}]}
},
]),
});

const {data} = await svgo.optimize(svg);
await writeFile(outputFile, data);
return;
}
Expand Down
31 changes: 10 additions & 21 deletions build/generate-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';

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

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

const svgo = new Svgo({
plugins: [
{removeXMLNS: true},
{removeDimensions: true},
const {data} = optimize(await readFile(file, 'utf8'), {
plugins: extendDefaultPlugins([
'removeXMLNS',
'removeDimensions',
{
addClassesToSVGElement: {
classNames: [
'svg',
name,
],
},
name: 'addClassesToSVGElement',
params: {classNames: ['svg', name]},
},
{
addAttributesToSVGElement: {
attributes: [
{'width': '16'},
{'height': '16'},
{'aria-hidden': 'true'},
],
},
name: 'addAttributesToSVGElement',
params: {attributes: [{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'}]},
},
],
]),
});

const {data} = await svgo.optimize(await readFile(file, 'utf8'));
await writeFile(resolve(outputDir, `${name}.svg`), data);
}

Expand Down
2 changes: 1 addition & 1 deletion docs/content/page/index.de-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Gitea ist ein [Gogs](http://gogs.io)-Fork.

## Browser Unterstützung

- Letzten 2 Versions von Chrome, Firefox, Safari, Edge (EdgeHTML) and Edge (Chromium)
- Letzten 2 Versions von Chrome, Firefox, Safari und Edge
- Firefox ESR
2 changes: 1 addition & 1 deletion docs/content/page/index.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.

## Browser Support

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

## Components
Expand Down
2 changes: 1 addition & 1 deletion docs/content/page/index.zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Gitea 是從 [Gogs](http://gogs.io) Fork 出來的,請閱讀部落格文章 [G

## 瀏覽器支援

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

## 元件
Expand Down
Loading