mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-19 00:01:16 -04:00
Compare commits
6 Commits
fc7d3f7315
...
42f7c2ad89
Author | SHA1 | Date | |
---|---|---|---|
|
42f7c2ad89 | ||
|
fee8522052 | ||
|
34c440996d | ||
|
283b19bad5 | ||
|
f0045f4113 | ||
|
0abd78e6a8 |
@ -44,5 +44,3 @@ rules:
|
||||
ignore: |
|
||||
.venv
|
||||
node_modules
|
||||
/models/fixtures
|
||||
/models/migrations/fixtures
|
||||
|
@ -128,8 +128,6 @@ If pre-built frontend files are present it is possible to only build the backend
|
||||
TAGS="bindata" make backend
|
||||
```
|
||||
|
||||
Webpack source maps are by default enabled in development builds and disabled in production builds. They can be enabled by setting the `ENABLE_SOURCEMAP=true` environment variable.
|
||||
|
||||
## Test
|
||||
|
||||
After following the steps above, a `gitea` binary will be available in the working directory.
|
||||
@ -260,3 +258,11 @@ GOARCH=amd64 \
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" \
|
||||
make build
|
||||
```
|
||||
|
||||
## Source Maps
|
||||
|
||||
By default, gitea generates reduced source maps for frontend files to conserve space. This can be controlled with the `ENABLE_SOURCEMAP` environment variable:
|
||||
|
||||
- `ENABLE_SOURCEMAP=true` generates all source maps, the default for development builds
|
||||
- `ENABLE_SOURCEMAP=reduced` generates limited source maps, the default for production builds
|
||||
- `ENABLE_SOURCEMAP=false` generates no source maps
|
||||
|
@ -100,8 +100,6 @@ TAGS="bindata sqlite sqlite_unlock_notify" make build
|
||||
TAGS="bindata" make backend
|
||||
```
|
||||
|
||||
在开发构建中,默认启用 Webpack 源映射,在生产构建中禁用。可以通过设置`ENABLE_SOURCEMAP=true`环境变量来启用它们。
|
||||
|
||||
## 测试
|
||||
|
||||
按照上述步骤完成后,工作目录中将会有一个`gitea`二进制文件。可以从该目录进行测试,或将其移动到带有测试数据的目录中。当手动从命令行启动 Gitea 时,可以通过按下`Ctrl + C`来停止程序。
|
||||
@ -221,3 +219,11 @@ GOARCH=amd64 \
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" \
|
||||
make build
|
||||
```
|
||||
|
||||
## 源映射
|
||||
|
||||
默认情况下,gitea 会为前端文件生成精简的源映射以节省空间。 这可以通过“ENABLE_SOURCEMAP”环境变量进行控制:
|
||||
|
||||
- `ENABLE_SOURCEMAP=true` 生成所有源映射,这是开发版本的默认设置
|
||||
- `ENABLE_SOURCEMAP=reduced` 生成有限的源映射,这是生产版本的默认设置
|
||||
- `ENABLE_SOURCEMAP=false` 不生成源映射
|
||||
|
@ -135,4 +135,3 @@
|
||||
user_id: 31
|
||||
repo_id: 28
|
||||
mode: 4
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
id: 1
|
||||
uid: 1
|
||||
name: Token A
|
||||
#token: d2c6c1ba3890b309189a8e618c72a162e4efbf36
|
||||
# token: d2c6c1ba3890b309189a8e618c72a162e4efbf36
|
||||
token_hash: 2b3668e11cb82d3af8c6e4524fc7841297668f5008d1626f0ad3417e9fa39af84c268248b78c481daa7e5dc437784003494f
|
||||
token_salt: QuSiZr1byZ
|
||||
token_last_eight: e4efbf36
|
||||
@ -13,7 +13,7 @@
|
||||
id: 2
|
||||
uid: 1
|
||||
name: Token B
|
||||
#token: 4c6f36e6cf498e2a448662f915d932c09c5a146c
|
||||
# token: 4c6f36e6cf498e2a448662f915d932c09c5a146c
|
||||
token_hash: 1a0e32a231ebbd582dc626c1543a42d3c63d4fa76c07c72862721467c55e8f81c923d60700f0528b5f5f443f055559d3a279
|
||||
token_salt: Lfwopukrq5
|
||||
token_last_eight: 9c5a146c
|
||||
@ -24,10 +24,10 @@
|
||||
id: 3
|
||||
uid: 2
|
||||
name: Token A
|
||||
#token: 90a18faa671dc43924b795806ffe4fd169d28c91
|
||||
# token: 90a18faa671dc43924b795806ffe4fd169d28c91
|
||||
token_hash: d6d404048048812d9e911d93aefbe94fc768d4876fdf75e3bef0bdc67828e0af422846d3056f2f25ec35c51dc92075685ec5
|
||||
token_salt: 99ArgXKlQQ
|
||||
token_last_eight: 69d28c91
|
||||
created_unix: 946687980
|
||||
updated_unix: 946687980
|
||||
#commented out tokens so you can see what they are in plaintext
|
||||
# commented out tokens so you can see what they are in plaintext
|
||||
|
@ -1,5 +1,5 @@
|
||||
-
|
||||
id: 1 #issue reaction
|
||||
id: 1 # issue reaction
|
||||
type: zzz # not allowed reaction (added before allowed reaction list has changed)
|
||||
issue_id: 1
|
||||
comment_id: 0
|
||||
@ -7,7 +7,7 @@
|
||||
created_unix: 1573248001
|
||||
|
||||
-
|
||||
id: 2 #issue reaction
|
||||
id: 2 # issue reaction
|
||||
type: zzz # not allowed reaction (added before allowed reaction list has changed)
|
||||
issue_id: 1
|
||||
comment_id: 0
|
||||
@ -15,7 +15,7 @@
|
||||
created_unix: 1573248002
|
||||
|
||||
-
|
||||
id: 3 #issue reaction
|
||||
id: 3 # issue reaction
|
||||
type: eyes # allowed reaction
|
||||
issue_id: 1
|
||||
comment_id: 0
|
||||
@ -23,7 +23,7 @@
|
||||
created_unix: 1573248003
|
||||
|
||||
-
|
||||
id: 4 #comment reaction
|
||||
id: 4 # comment reaction
|
||||
type: laugh # allowed reaction
|
||||
issue_id: 1
|
||||
comment_id: 2
|
||||
@ -31,7 +31,7 @@
|
||||
created_unix: 1573248004
|
||||
|
||||
-
|
||||
id: 5 #comment reaction
|
||||
id: 5 # comment reaction
|
||||
type: laugh # allowed reaction
|
||||
issue_id: 1
|
||||
comment_id: 2
|
||||
|
@ -150,6 +150,7 @@
|
||||
content: "review approved by user20"
|
||||
updated_unix: 946684833
|
||||
created_unix: 946684833
|
||||
|
||||
-
|
||||
id: 18
|
||||
type: 4
|
||||
@ -169,4 +170,3 @@
|
||||
content: "review request for user15"
|
||||
updated_unix: 946684835
|
||||
created_unix: 946684835
|
||||
|
||||
|
@ -26,4 +26,3 @@
|
||||
id: 5
|
||||
issue_id: 2
|
||||
label_id: 87
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
-
|
||||
id: 3
|
||||
repo_id: 0
|
||||
org_id: 3
|
||||
org_id: 3
|
||||
name: orglabel3
|
||||
color: '#abcdef'
|
||||
num_issues: 0
|
||||
|
@ -23,4 +23,3 @@
|
||||
id: 5
|
||||
repo_id: 3
|
||||
org_id: 0
|
||||
|
||||
|
@ -28,4 +28,3 @@
|
||||
attestation_type: 'fido-u2f'
|
||||
sign_count: 1
|
||||
clone_warning: false
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
<div class="default text">{{ctx.Locale.Tr "repo.projects.template.desc_helper"}}</div>
|
||||
<div class="menu">
|
||||
{{range $element := .BoardTypes}}
|
||||
<div class="item" data-id="{{$element.BoardType}}" data-value="{{$element.BoardType}}">{{ctx.Locale.Tr ctx.Locale.Translation}}</div>
|
||||
<div class="item" data-id="{{$element.BoardType}}" data-value="{{$element.BoardType}}">{{ctx.Locale.Tr $element.Translation}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
@ -43,12 +43,12 @@
|
||||
{{range $element := .CardTypes}}
|
||||
{{if or (eq $.card_type $element.CardType) (and (not $.PageIsEditProjects) (eq $element.CardType 1))}}
|
||||
<input type="hidden" name="card_type" value="{{$element.CardType}}">
|
||||
<div class="default text">{{ctx.Locale.Tr ctx.Locale.Translation}}</div>
|
||||
<div class="default text">{{ctx.Locale.Tr $element.Translation}}</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<div class="menu">
|
||||
{{range $element := .CardTypes}}
|
||||
<div class="item" data-id="{{$element.CardType}}" data-value="{{$element.CardType}}">{{ctx.Locale.Tr ctx.Locale.Translation}}</div>
|
||||
<div class="item" data-id="{{$element.CardType}}" data-value="{{$element.CardType}}">{{ctx.Locale.Tr $element.Translation}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<div class="flex-item">
|
||||
{{$providerData := index $.OAuth2Providers $loginSource.Name}}
|
||||
<div class="flex-item-leading">
|
||||
{{$providerData.IconHTML}}
|
||||
{{$providerData.IconHTML 20}}
|
||||
</div>
|
||||
<div class="flex-item-main">
|
||||
<span class="flex-item-title" data-tooltip-content="{{$provider}}">
|
||||
|
@ -225,7 +225,8 @@ const sfc = {
|
||||
this.fetchArtifacts(), // refresh artifacts if upload-artifact step done
|
||||
]);
|
||||
} catch (err) {
|
||||
if (!(err instanceof TypeError)) throw err; // avoid network error while unloading page
|
||||
if (err instanceof TypeError) return; // avoid network error while unloading page
|
||||
throw err;
|
||||
}
|
||||
|
||||
this.artifacts = artifacts['artifacts'] || [];
|
||||
|
@ -25,41 +25,55 @@ export function initGiteaFomantic() {
|
||||
return escape(text, preserveHTML) + svg('octicon-x', 16, `${className.delete} icon`);
|
||||
};
|
||||
|
||||
const transitionNopBehaviors = new Set([
|
||||
'clear queue', 'stop', 'stop all', 'destroy',
|
||||
'force repaint', 'repaint', 'reset',
|
||||
'looping', 'remove looping', 'disable', 'enable',
|
||||
'set duration', 'save conditions', 'restore conditions',
|
||||
]);
|
||||
// stand-in for removed transition module
|
||||
$.fn.transition = function (arg) {
|
||||
if (arg === 'is supported') return true;
|
||||
if (arg === 'is animating') return false;
|
||||
if (arg === 'is inward') return false;
|
||||
if (arg === 'is outward') return false;
|
||||
if (arg === 'stop all') return;
|
||||
$.fn.transition = function (arg0, arg1, arg2) {
|
||||
if (arg0 === 'is supported') return true;
|
||||
if (arg0 === 'is animating') return false;
|
||||
if (arg0 === 'is inward') return false;
|
||||
if (arg0 === 'is outward') return false;
|
||||
|
||||
const isIn = arg?.animation?.endsWith(' in');
|
||||
const isOut = arg?.animation?.endsWith(' out');
|
||||
|
||||
let ret;
|
||||
if (arg === 'show' || isIn) {
|
||||
arg?.onStart?.(this);
|
||||
ret = this.each((_, el) => {
|
||||
el.classList.remove('hidden');
|
||||
el.classList.add('visible');
|
||||
if (isIn) el.classList.add('transition');
|
||||
if (arg?.displayType) el.style.setProperty('display', arg.displayType, 'important');
|
||||
arg?.onShow?.(this);
|
||||
});
|
||||
arg?.onComplete?.(this);
|
||||
} else if (arg === 'hide' || isOut) {
|
||||
arg?.onStart?.(this);
|
||||
ret = this.each((_, el) => {
|
||||
el.classList.add('hidden');
|
||||
el.classList.remove('visible');
|
||||
// don't remove the transition class because fomantic didn't do it either
|
||||
el.style.removeProperty('display');
|
||||
arg?.onHidden?.(this);
|
||||
});
|
||||
arg?.onComplete?.(this);
|
||||
let argObj;
|
||||
if (typeof arg0 === 'string') {
|
||||
// many behaviors are no-op now. https://fomantic-ui.com/modules/transition.html#/usage
|
||||
if (transitionNopBehaviors.has(arg0)) return this;
|
||||
// now, the arg0 is an animation name, the syntax: (animation, duration, complete)
|
||||
argObj = {animation: arg0, ...(arg1 && {duration: arg1}), ...(arg2 && {onComplete: arg2})};
|
||||
} else if (typeof arg0 === 'object') {
|
||||
argObj = arg0;
|
||||
} else {
|
||||
throw new Error(`invalid argument: ${arg0}`);
|
||||
}
|
||||
|
||||
return ret;
|
||||
const isAnimationIn = argObj.animation?.startsWith('show') || argObj.animation?.endsWith(' in');
|
||||
const isAnimationOut = argObj.animation?.startsWith('hide') || argObj.animation?.endsWith(' out');
|
||||
this.each((_, el) => {
|
||||
let toShow = isAnimationIn;
|
||||
if (!isAnimationIn && !isAnimationOut) {
|
||||
// If the animation is not in/out, then it must be a toggle animation.
|
||||
// Fomantic uses computed styles to check "visibility", but to avoid unnecessary arguments, here it only checks the class.
|
||||
toShow = this.hasClass('hidden'); // maybe it could also check "!this.hasClass('visible')", leave it to the future until there is a real problem.
|
||||
}
|
||||
argObj.onStart?.call(el);
|
||||
if (toShow) {
|
||||
el.classList.remove('hidden');
|
||||
el.classList.add('visible', 'transition');
|
||||
if (argObj.displayType) el.style.setProperty('display', argObj.displayType, 'important');
|
||||
argObj.onShow?.call(el);
|
||||
} else {
|
||||
el.classList.add('hidden');
|
||||
el.classList.remove('visible'); // don't remove the transition class because the Fomantic animation style is `.hidden.transition`.
|
||||
el.style.removeProperty('display');
|
||||
argObj.onHidden?.call(el);
|
||||
}
|
||||
argObj.onComplete?.call(el);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
initFomanticApiPatch();
|
||||
|
@ -28,11 +28,15 @@ for (const path of glob('web_src/css/themes/*.css')) {
|
||||
|
||||
const isProduction = env.NODE_ENV !== 'development';
|
||||
|
||||
let sourceMapEnabled;
|
||||
// ENABLE_SOURCEMAP accepts the following values:
|
||||
// true - all enabled, the default in development
|
||||
// reduced - minimal sourcemaps, the default in production
|
||||
// false - all disabled
|
||||
let sourceMaps;
|
||||
if ('ENABLE_SOURCEMAP' in env) {
|
||||
sourceMapEnabled = env.ENABLE_SOURCEMAP === 'true';
|
||||
sourceMaps = ['true', 'false'].includes(env.ENABLE_SOURCEMAP) ? env.ENABLE_SOURCEMAP : 'reduced';
|
||||
} else {
|
||||
sourceMapEnabled = !isProduction;
|
||||
sourceMaps = isProduction ? 'reduced' : 'true';
|
||||
}
|
||||
|
||||
const filterCssImport = (url, ...args) => {
|
||||
@ -105,7 +109,9 @@ export default {
|
||||
css: !LightningCssMinifyPlugin,
|
||||
legalComments: 'none',
|
||||
}),
|
||||
LightningCssMinifyPlugin && new LightningCssMinifyPlugin(),
|
||||
LightningCssMinifyPlugin && new LightningCssMinifyPlugin({
|
||||
sourceMap: sourceMaps === 'true',
|
||||
}),
|
||||
],
|
||||
splitChunks: {
|
||||
chunks: 'async',
|
||||
@ -143,7 +149,7 @@ export default {
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: sourceMapEnabled,
|
||||
sourceMap: sourceMaps === 'true',
|
||||
url: {filter: filterCssImport},
|
||||
import: {filter: filterCssImport},
|
||||
},
|
||||
@ -181,9 +187,10 @@ export default {
|
||||
filename: 'css/[name].css',
|
||||
chunkFilename: 'css/[name].[contenthash:8].css',
|
||||
}),
|
||||
sourceMapEnabled && (new SourceMapDevToolPlugin({
|
||||
sourceMaps !== 'false' && new SourceMapDevToolPlugin({
|
||||
filename: '[file].[contenthash:8].map',
|
||||
})),
|
||||
...(sourceMaps === 'reduced' && {include: /^js\/index\.js$/}),
|
||||
}),
|
||||
new MonacoWebpackPlugin({
|
||||
filename: 'js/monaco-[name].[contenthash:8].worker.js',
|
||||
}),
|
||||
|
Loading…
x
Reference in New Issue
Block a user