chore: merge branch from AnYiEE/AwesomeGadgets
这个提交包含在:
当前提交
f9e261a46a
|
@ -9,5 +9,9 @@ end_of_line = lf
|
|||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[src/**.svg]
|
||||
insert_final_newline = false
|
||||
|
|
|
@ -15,11 +15,11 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: latest
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: latest
|
||||
run_install: false
|
||||
|
@ -28,7 +28,7 @@ jobs:
|
|||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
|
|
|
@ -32,7 +32,7 @@ jobs:
|
|||
echo "[Error] 同步失败,可能是由于本地仓库 pnpm-lock.yaml 文件和上游冲突,正尝试自动合并更改。"
|
||||
- name: Install pnpm
|
||||
if: ${{ steps.sync.conclusion == 'failure' }}
|
||||
uses: pnpm/action-setup@v2
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: latest
|
||||
run_install: false
|
||||
|
@ -43,7 +43,7 @@ jobs:
|
|||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
- name: Setup pnpm cache
|
||||
if: ${{ steps.sync.conclusion == 'failure' }}
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"extends": ["stylelint-config-wikimedia/mediawiki", "stylelint-config-wikimedia/support-modern"],
|
||||
"extends": ["stylelint-config-wikimedia/mediawiki", "stylelint-config-wikimedia/support-basic"],
|
||||
"rules": {
|
||||
"at-rule-disallowed-list": null,
|
||||
"declaration-no-important": null,
|
||||
|
@ -10,6 +10,7 @@
|
|||
"selector-max-id": null,
|
||||
"selector-not-notation": "complex",
|
||||
"selector-type-no-unknown": null,
|
||||
"plugin/no-unsupported-browser-features": null,
|
||||
"wikimedia/no-at-import-css": null,
|
||||
"stylistic/declaration-colon-newline-after": null,
|
||||
"stylistic/declaration-colon-space-after": "always-single-line",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"properties": {
|
||||
"enable": {
|
||||
"type": "boolean",
|
||||
"title": "是否启用当前小工具 / Enable current gadget or not",
|
||||
"title": "是否启用当前小工具 / Enable the current gadget or not",
|
||||
"default": true
|
||||
},
|
||||
"excludeSites": {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"properties": {
|
||||
"enable": {
|
||||
"type": "boolean",
|
||||
"title": "是否部署当前页面 / Deploy current page or not",
|
||||
"title": "是否部署当前页面 / Deploy the current page or not",
|
||||
"default": true
|
||||
},
|
||||
"sourceCode": {
|
||||
|
@ -21,7 +21,7 @@
|
|||
},
|
||||
"licenseText": {
|
||||
"type": "string",
|
||||
"title": "页面内容的许可声明 / License declaration of the page content",
|
||||
"title": "页面内容的许可声明 / License of the page content",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
# _Qiuwen_ Gadgets
|
||||
|
||||
## 简介 / Introduction
|
||||
## 简介<br>Introduction
|
||||
|
||||
本代码库为[求闻百科][qiuwenbaike]的[界面样式][styles]、[界面脚本][scripts]和[小工具代码库][gadgets]。相关样式表及 JavaScript 优化了求闻百科访客及编者的用户体验,并且为求闻百科用户提供了大量执行常见维护任务的方法。
|
||||
|
||||
## 致谢 / Acknowledgement
|
||||
## 致谢<br>Acknowledgement
|
||||
|
||||
求闻百科小工具库是基于 [Awesome Gadgets][awesome] 打造的。
|
||||
|
||||
|
@ -27,11 +27,11 @@ Awesome Gadgets 是面向 MediaWiki 网站,用以统一存储、管理并编
|
|||
- `MediaWiki:*.{js, css}`
|
||||
- 自动从网站内删除曾经部署过但现在不再需要的页面<br>Automatically delete pages that have been deployed on the website but are no longer needed
|
||||
|
||||
## 用法 / Usage
|
||||
## 用法<br>Usage
|
||||
|
||||
见[文档](docs/how-to-build-or-deploy.md)。<br>See [documentation](docs/how-to-build-or-deploy.md).
|
||||
|
||||
## 最佳实践 / Best practices
|
||||
## 最佳实践<br>Best practices
|
||||
|
||||
- [QiuwenGadgets](https://github.com/qiuwenbaike/QiuwenGadgets) ([@qiuwenbaike](https://github.com/qiuwenbaike))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
### 用法 / Usage
|
||||
|
||||
**对于小工具开发者:**<br>**For gadget developers:**
|
||||
#### 对于小工具开发者:<br>For gadget developers:
|
||||
|
||||
1. Fork 由目标 MediaWiki 网站所维护的仓库<br>Fork the repository maintained by the target MediaWiki website
|
||||
|
||||
|
@ -14,13 +14,13 @@
|
|||
2. `*.{tsx, ts}` > `*.{jsx, js}`
|
||||
3. `*.{jsx, tsx}` > `*.{js, ts}`
|
||||
4. `*.less` > `*.css`
|
||||
5. `.vue`仅供被其他脚本导入 / The `.vue` file is only allowed import by other script files
|
||||
5. `.vue`仅供被其他脚本导入 / `.vue` files are only allowed import by other script files
|
||||
|
||||
- 如果小工具包含脚本,且使用单独的样式表,则其所使用到的样式表应在脚本中导入<br>If the gadget has script files and style sheets, the style sheets used should be imported in the script file
|
||||
- 如果小工具包含脚本,且使用单独的样式表,则其所使用到的样式表应在脚本中导入<br>If the gadget has script files and style sheets, the style sheets used should be imported in script files
|
||||
|
||||
- 如果样式表名形如`*.module.{css, less}`,则其将被视为 [CSS/Less 模块](https://github.com/css-modules/css-modules)。注意,如需在 VS Code 中获得代码自动补全功能,应[切换到当前工作区中的 TypeScript 版本](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript),如果在切换后未有效果,可尝试重新加载当前工作区<br> If the style sheet name is like `*.module.{css, less}`, it will be considered as [CSS/Less modules](https://github.com/css-modules/css-modules). Note that if you want to get code autocompletion in VS Code, you should [switch to the TypeScript version in the current workspace](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript). If it doesn't work after switching, try reloading the current workspace.
|
||||
|
||||
- 如果小工具仅包含样式表,则不需要在脚本中导入(无需新建一个脚本文件)<br>If the gadget only has style sheets, there is no need to import style sheets in the script file. (no need to create a script file)
|
||||
- 如果小工具仅包含样式表,则不需要在脚本中导入(无需新建一个脚本文件)<br>If the gadget only has style sheets, there is no need to import style sheets in any script files. (no need to create a script file)
|
||||
|
||||
4. 目录下可以创建`definition.json`以手动指定小工具定义(可选)<br>In the directory, you have the option to create a `definition.json` file to manually specify the gadget definition
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
}
|
||||
```
|
||||
|
||||
5. 目录下可以创建`LICENSE`以标注小工具的版权信息(可选),文件中的内容会在部署时自动添加到对应小工具文件的顶部<br>In the directory, you have the option to create a `LICENSE` file to indicate the copyright information of your gadget. The content in this file will be automatically added to the top of the gadget file when it is deployed
|
||||
5. 目录下可以创建`LICENSE`以标注小工具的版权信息(可选),文件中的内容会在编译后自动添加到对应小工具文件的顶部<br>In the directory, you have the option to create a `LICENSE` file to indicate the copyright information of your gadget. The content of this file will be automatically added to the top of the gadget file when it is compiled
|
||||
|
||||
6. 运行`pnpm run build`以格式化代码、检查语法、测试编译<br>Run `pnpm run build` to format the code, check syntax, and test the compilation
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
>
|
||||
> 样式可以是 Less 或 CSS,支持`@import`语法。<br>The styles can be written in either Less or CSS and support the `@import` syntax.
|
||||
|
||||
**对于网站维护者:**<br>**For website maintainers:**
|
||||
#### 对于网站维护者:<br>For website maintainers:
|
||||
|
||||
1. Fork 本仓库<br>Fork this repository
|
||||
|
||||
|
@ -94,9 +94,7 @@
|
|||
|
||||
5. 运行`pnpm run deploy`以检查语法、格式化代码、编译源码、并向网站部署<br>Run `pnpm run deploy` to check syntax, format code, compile the source code, and deploy to the website
|
||||
|
||||
> 请网站维护者注意:在 Fork 本仓库后,本仓库的 Actions 将自动同步上游变更。这意味着在一般情况下,不需要改动除了`src`文件夹和`scripts/constant.ts`之外的东西,以免发生合并冲突。<br>Please note that the Actions of this repository will automatically sync upstream changes. This means that in general, there is no need to modify anything except the `src` directory and `scripts/constant.ts` to avoid merge conflicts.
|
||||
|
||||
#### 直接部署 MediaWiki:Common.js 等 MediaWiki 命名空间下的脚本或样式
|
||||
##### 直接部署 MediaWiki:Common.js 等 MediaWiki 命名空间下的脚本或样式
|
||||
|
||||
1. 在`src`文件夹下新建`global.json`文件,如下所示<br>Create a `global.json` file in the `src` directory, as shown below:
|
||||
|
||||
|
|
|
@ -106,4 +106,4 @@ console.log(moment.utc());
|
|||
```
|
||||
|
||||
- `@wikimedia/codex`、`vue`和`pinia`等 Vue 相关的包<br>Vue-related packages such as `@wikimedia/codex`, `vue` and `pinia`
|
||||
- 见[文档](how-to-use-vue.md)。<br>See [documentation](how-to-use-vue.md)
|
||||
- 见[文档](how-to-use-vue.md)<br>See [documentation](how-to-use-vue.md)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
### 如何使用 Vue?<br>How to use Vue?
|
||||
|
||||
#### 准备依赖 / Prepare dependencies
|
||||
#### 准备依赖<br>Prepare dependencies
|
||||
|
||||
在本仓库中使用 Vue,有两种方式<br>To use Vue in this repository, there are two ways
|
||||
在本仓库中使用 Vue,有以下两种方式:<br>To use Vue in this repository, there are two ways:
|
||||
|
||||
- 使用 MediaWiki 内置的`vue`、`pinia`和`@wikimedia/codex`等 Vue 相关的包<br>Use Vue-related packages such as `vue`, `pinia` and `@wikimedia/codex` built into MediaWiki
|
||||
- 确保目标 MediaWiki 的版本至少为 1.41<br>Ensure that the target MediaWiki version is at least 1.41
|
||||
|
@ -19,7 +19,7 @@
|
|||
- 目标 MediaWiki 版本过低,尚未包含 Vue 相关的包,但依然需要使用 Vue<br>The target MediaWiki version is too low and does not yet built-in the Vue-related packages, but still needs to use Vue
|
||||
- 安装所需的包,直接使用即可<br>Install the required packages directly
|
||||
|
||||
#### 示例 / Example
|
||||
#### 示例<br>Example
|
||||
|
||||
```vue
|
||||
<!-- App.vue -->
|
||||
|
@ -53,7 +53,7 @@ document.body.append(root);
|
|||
createMwApp(App).mount(root);
|
||||
```
|
||||
|
||||
#### 特别说明 / Notes
|
||||
#### 特别说明<br>Notes
|
||||
|
||||
- `vue`和`pinia`已经内置在仓库中,无需额外安装<br>`vue` and `pinia` are already built into the repository, no need to install
|
||||
- `@wikimedia/codex`等其他 Vue 相关的组件包需要额外按需安装<br>Other Vue-related components need to be installed separately
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "awesome-gadgets",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"description": "Storage, management, compilation, and automatic deployment of MediaWiki gadgets.",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
|
正在加载...
在新工单中引用