fix(deploy): fail to generate deployment targets
这个提交包含在:
父节点
6236639063
当前提交
f073a67172
|
@ -1,5 +1,3 @@
|
|||
dist/*
|
||||
!dist/store.txt
|
||||
node_modules
|
||||
scripts/credentials.json
|
||||
.*cache
|
||||
|
|
|
@ -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> */
|
|
@ -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);
|
||||
});
|
||||
|
|
正在加载...
在新工单中引用