mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-20 00:00:55 -04:00
Compare commits
6 Commits
fc7d3f7315
...
42f7c2ad89
Author | SHA1 | Date | |
---|---|---|---|
|
42f7c2ad89 | ||
|
fee8522052 | ||
|
34c440996d | ||
|
283b19bad5 | ||
|
f0045f4113 | ||
|
0abd78e6a8 |
@ -44,5 +44,3 @@ rules:
|
|||||||
ignore: |
|
ignore: |
|
||||||
.venv
|
.venv
|
||||||
node_modules
|
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
|
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
|
## Test
|
||||||
|
|
||||||
After following the steps above, a `gitea` binary will be available in the working directory.
|
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" \
|
TAGS="bindata sqlite sqlite_unlock_notify" \
|
||||||
make build
|
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
|
TAGS="bindata" make backend
|
||||||
```
|
```
|
||||||
|
|
||||||
在开发构建中,默认启用 Webpack 源映射,在生产构建中禁用。可以通过设置`ENABLE_SOURCEMAP=true`环境变量来启用它们。
|
|
||||||
|
|
||||||
## 测试
|
## 测试
|
||||||
|
|
||||||
按照上述步骤完成后,工作目录中将会有一个`gitea`二进制文件。可以从该目录进行测试,或将其移动到带有测试数据的目录中。当手动从命令行启动 Gitea 时,可以通过按下`Ctrl + C`来停止程序。
|
按照上述步骤完成后,工作目录中将会有一个`gitea`二进制文件。可以从该目录进行测试,或将其移动到带有测试数据的目录中。当手动从命令行启动 Gitea 时,可以通过按下`Ctrl + C`来停止程序。
|
||||||
@ -221,3 +219,11 @@ GOARCH=amd64 \
|
|||||||
TAGS="bindata sqlite sqlite_unlock_notify" \
|
TAGS="bindata sqlite sqlite_unlock_notify" \
|
||||||
make build
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 源映射
|
||||||
|
|
||||||
|
默认情况下,gitea 会为前端文件生成精简的源映射以节省空间。 这可以通过“ENABLE_SOURCEMAP”环境变量进行控制:
|
||||||
|
|
||||||
|
- `ENABLE_SOURCEMAP=true` 生成所有源映射,这是开发版本的默认设置
|
||||||
|
- `ENABLE_SOURCEMAP=reduced` 生成有限的源映射,这是生产版本的默认设置
|
||||||
|
- `ENABLE_SOURCEMAP=false` 不生成源映射
|
||||||
|
@ -135,4 +135,3 @@
|
|||||||
user_id: 31
|
user_id: 31
|
||||||
repo_id: 28
|
repo_id: 28
|
||||||
mode: 4
|
mode: 4
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@
|
|||||||
content: "review approved by user20"
|
content: "review approved by user20"
|
||||||
updated_unix: 946684833
|
updated_unix: 946684833
|
||||||
created_unix: 946684833
|
created_unix: 946684833
|
||||||
|
|
||||||
-
|
-
|
||||||
id: 18
|
id: 18
|
||||||
type: 4
|
type: 4
|
||||||
@ -169,4 +170,3 @@
|
|||||||
content: "review request for user15"
|
content: "review request for user15"
|
||||||
updated_unix: 946684835
|
updated_unix: 946684835
|
||||||
created_unix: 946684835
|
created_unix: 946684835
|
||||||
|
|
||||||
|
@ -26,4 +26,3 @@
|
|||||||
id: 5
|
id: 5
|
||||||
issue_id: 2
|
issue_id: 2
|
||||||
label_id: 87
|
label_id: 87
|
||||||
|
|
||||||
|
@ -23,4 +23,3 @@
|
|||||||
id: 5
|
id: 5
|
||||||
repo_id: 3
|
repo_id: 3
|
||||||
org_id: 0
|
org_id: 0
|
||||||
|
|
||||||
|
@ -28,4 +28,3 @@
|
|||||||
attestation_type: 'fido-u2f'
|
attestation_type: 'fido-u2f'
|
||||||
sign_count: 1
|
sign_count: 1
|
||||||
clone_warning: false
|
clone_warning: false
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<div class="default text">{{ctx.Locale.Tr "repo.projects.template.desc_helper"}}</div>
|
<div class="default text">{{ctx.Locale.Tr "repo.projects.template.desc_helper"}}</div>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
{{range $element := .BoardTypes}}
|
{{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}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -43,12 +43,12 @@
|
|||||||
{{range $element := .CardTypes}}
|
{{range $element := .CardTypes}}
|
||||||
{{if or (eq $.card_type $element.CardType) (and (not $.PageIsEditProjects) (eq $element.CardType 1))}}
|
{{if or (eq $.card_type $element.CardType) (and (not $.PageIsEditProjects) (eq $element.CardType 1))}}
|
||||||
<input type="hidden" name="card_type" value="{{$element.CardType}}">
|
<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}}
|
||||||
{{end}}
|
{{end}}
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
{{range $element := .CardTypes}}
|
{{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}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<div class="flex-item">
|
<div class="flex-item">
|
||||||
{{$providerData := index $.OAuth2Providers $loginSource.Name}}
|
{{$providerData := index $.OAuth2Providers $loginSource.Name}}
|
||||||
<div class="flex-item-leading">
|
<div class="flex-item-leading">
|
||||||
{{$providerData.IconHTML}}
|
{{$providerData.IconHTML 20}}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-item-main">
|
<div class="flex-item-main">
|
||||||
<span class="flex-item-title" data-tooltip-content="{{$provider}}">
|
<span class="flex-item-title" data-tooltip-content="{{$provider}}">
|
||||||
|
@ -225,7 +225,8 @@ const sfc = {
|
|||||||
this.fetchArtifacts(), // refresh artifacts if upload-artifact step done
|
this.fetchArtifacts(), // refresh artifacts if upload-artifact step done
|
||||||
]);
|
]);
|
||||||
} catch (err) {
|
} 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'] || [];
|
this.artifacts = artifacts['artifacts'] || [];
|
||||||
|
@ -25,41 +25,55 @@ export function initGiteaFomantic() {
|
|||||||
return escape(text, preserveHTML) + svg('octicon-x', 16, `${className.delete} icon`);
|
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
|
// stand-in for removed transition module
|
||||||
$.fn.transition = function (arg) {
|
$.fn.transition = function (arg0, arg1, arg2) {
|
||||||
if (arg === 'is supported') return true;
|
if (arg0 === 'is supported') return true;
|
||||||
if (arg === 'is animating') return false;
|
if (arg0 === 'is animating') return false;
|
||||||
if (arg === 'is inward') return false;
|
if (arg0 === 'is inward') return false;
|
||||||
if (arg === 'is outward') return false;
|
if (arg0 === 'is outward') return false;
|
||||||
if (arg === 'stop all') return;
|
|
||||||
|
|
||||||
const isIn = arg?.animation?.endsWith(' in');
|
let argObj;
|
||||||
const isOut = arg?.animation?.endsWith(' out');
|
if (typeof arg0 === 'string') {
|
||||||
|
// many behaviors are no-op now. https://fomantic-ui.com/modules/transition.html#/usage
|
||||||
let ret;
|
if (transitionNopBehaviors.has(arg0)) return this;
|
||||||
if (arg === 'show' || isIn) {
|
// now, the arg0 is an animation name, the syntax: (animation, duration, complete)
|
||||||
arg?.onStart?.(this);
|
argObj = {animation: arg0, ...(arg1 && {duration: arg1}), ...(arg2 && {onComplete: arg2})};
|
||||||
ret = this.each((_, el) => {
|
} else if (typeof arg0 === 'object') {
|
||||||
el.classList.remove('hidden');
|
argObj = arg0;
|
||||||
el.classList.add('visible');
|
} else {
|
||||||
if (isIn) el.classList.add('transition');
|
throw new Error(`invalid argument: ${arg0}`);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
initFomanticApiPatch();
|
||||||
|
@ -28,11 +28,15 @@ for (const path of glob('web_src/css/themes/*.css')) {
|
|||||||
|
|
||||||
const isProduction = env.NODE_ENV !== 'development';
|
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) {
|
if ('ENABLE_SOURCEMAP' in env) {
|
||||||
sourceMapEnabled = env.ENABLE_SOURCEMAP === 'true';
|
sourceMaps = ['true', 'false'].includes(env.ENABLE_SOURCEMAP) ? env.ENABLE_SOURCEMAP : 'reduced';
|
||||||
} else {
|
} else {
|
||||||
sourceMapEnabled = !isProduction;
|
sourceMaps = isProduction ? 'reduced' : 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterCssImport = (url, ...args) => {
|
const filterCssImport = (url, ...args) => {
|
||||||
@ -105,7 +109,9 @@ export default {
|
|||||||
css: !LightningCssMinifyPlugin,
|
css: !LightningCssMinifyPlugin,
|
||||||
legalComments: 'none',
|
legalComments: 'none',
|
||||||
}),
|
}),
|
||||||
LightningCssMinifyPlugin && new LightningCssMinifyPlugin(),
|
LightningCssMinifyPlugin && new LightningCssMinifyPlugin({
|
||||||
|
sourceMap: sourceMaps === 'true',
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
splitChunks: {
|
splitChunks: {
|
||||||
chunks: 'async',
|
chunks: 'async',
|
||||||
@ -143,7 +149,7 @@ export default {
|
|||||||
{
|
{
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
options: {
|
options: {
|
||||||
sourceMap: sourceMapEnabled,
|
sourceMap: sourceMaps === 'true',
|
||||||
url: {filter: filterCssImport},
|
url: {filter: filterCssImport},
|
||||||
import: {filter: filterCssImport},
|
import: {filter: filterCssImport},
|
||||||
},
|
},
|
||||||
@ -181,9 +187,10 @@ export default {
|
|||||||
filename: 'css/[name].css',
|
filename: 'css/[name].css',
|
||||||
chunkFilename: 'css/[name].[contenthash:8].css',
|
chunkFilename: 'css/[name].[contenthash:8].css',
|
||||||
}),
|
}),
|
||||||
sourceMapEnabled && (new SourceMapDevToolPlugin({
|
sourceMaps !== 'false' && new SourceMapDevToolPlugin({
|
||||||
filename: '[file].[contenthash:8].map',
|
filename: '[file].[contenthash:8].map',
|
||||||
})),
|
...(sourceMaps === 'reduced' && {include: /^js\/index\.js$/}),
|
||||||
|
}),
|
||||||
new MonacoWebpackPlugin({
|
new MonacoWebpackPlugin({
|
||||||
filename: 'js/monaco-[name].[contenthash:8].worker.js',
|
filename: 'js/monaco-[name].[contenthash:8].worker.js',
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user