fix(deploy): fail to generate deployment targets

这个提交包含在:
安忆 2024-01-13 23:12:20 +08:00
父节点 6236639063
当前提交 f073a67172
签署人:: AnYi
GPG 密钥 ID: 190DF37D01FFE4BC
共有 4 个文件被更改,包括 34 次插入7 次删除

2
.gitignore vendored
查看文件

@ -1,5 +1,3 @@
dist/*
!dist/store.txt
node_modules
scripts/credentials.json
.*cache

21
dist/React/React.js vendored 普通文件
查看文件

@ -0,0 +1,21 @@
/**
* +------------------------------------------------------------+
* | === WARNING: GLOBAL GADGET FILE === |
* +------------------------------------------------------------+
* | All changes should be made in the repository, |
* | otherwise they will be lost. |
* +------------------------------------------------------------+
* | Changes to this page may affect many users. |
* | Please discuss changes by opening an issue before editing. |
* +------------------------------------------------------------+
*/
/* <nowiki> */
(function () {
"use strict";
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K
})();
/* </nowiki> */

8
dist/definition.txt vendored 普通文件
查看文件

@ -0,0 +1,8 @@
<div class="mw-message-box mw-message-box-notice">
<big>本页面内容由脚本自动生成,维护于Git仓库内。对本页面内容的变更,应通知技术团队,以免在代码部署时被误覆盖。</big>
* 若需要查看本地小工具使用情况,请前往[[Special:GadgetUsage|“小工具使用统计”界面]]。
* 若需要设置您所需启用或关闭的小工具,请前往[[Special:参数设置#mw-prefsection-gadgets|参数设置]]。
</div>
== appear ==
* React[ResourceLoader]|React.js

查看文件

@ -53,17 +53,17 @@ const generateTargets = (): DeploymentTargets => {
const definitionText: string = readDefinition();
const definitions: string[] = definitionText.split('\n').filter((lineContent: string): boolean => {
return /^\*\s\S+?\[ResourceLoader]/.test(lineContent);
return /^\*\s\S+?\[ResourceLoader[|\]]/.test(lineContent);
});
const gadgetNames: string[] = definitions.map((definition: string): string => {
const regExpMatchArray = definition.match(/^\*\s(\S+?)\[\S+?]/) as [string, string];
const regExpMatchArray = definition.match(/^\*\s(\S+?)\[\S+?[|\]]/) as [string, string];
return regExpMatchArray[1];
});
type Target = DeploymentTargets[keyof DeploymentTargets];
for (const gadgetName of gadgetNames) {
for (const gadgetName of gadgetNames.sort()) {
const definition: DefaultDefinition = generateDefinition(gadgetName, false);
const {description, enable, excludeSites} = definition;
@ -434,7 +434,7 @@ const saveDefinition = (definitionText: string, enabledGadgets: string[], api: A
definitionText = definitionText
.split('\n')
.filter((lineContent: string): boolean => {
const regex: RegExp = /^\*\s(\S+?)\[ResourceLoader]/;
const regex: RegExp = /^\*\s(\S+?)\[ResourceLoader[|\]]/;
const regExpMatchArray: RegExpMatchArray | null = lineContent.match(regex);
if (regExpMatchArray && regExpMatchArray[1]) {
return enabledGadgets.includes(regExpMatchArray[1]);
@ -663,7 +663,7 @@ const deleteUnusedPages = async (api: Api, editSummary: string): Promise<void> =
console.error(err);
return;
}
writeFileSync(fd, `${JSON.stringify(deployPages)}\n`);
writeFileSync(fd, `${JSON.stringify(deployPages, null, '\t')}\n`);
fdatasyncSync(fd);
closeSync(fd);
});