Skip to content

Commit

Permalink
Merge branch 'AnYiEE:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoruaFox authored Jun 12, 2024
2 parents 552e2bb + 079ff42 commit 4994d4f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 0 additions & 4 deletions docs/how-to-use-exports-and-require-in-mediawiki.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ console.log({

- `moment`

- 目标 MediaWiki 的版本低于 1.38<br>The target MediaWiki version is lower than 1.38
- 运行`pnpm remove moment``pnpm add @types/moment`<br>Run `pnpm remove moment` and `pnpm add @types/moment`
- 在小工具对应的`definition.json`中,将`moment`添加为依赖项(`dependencies`)<br>In the corresponding `definition.json` of the gadget, add the `moment` package as a dependency
- 无需导入,`moment`应该全局可用<br>No need to import, `moment` should be globally available
- 目标 MediaWiki 的版本不低于 1.38<br>The target MediaWiki version is at least 1.38
- 在小工具对应的`definition.json`中,将`moment`添加为依赖项(`dependencies`)<br>In the corresponding `definition.json` of the gadget, add the `moment` package as a dependency
- 使用`import`来导入,如:<br> Use `import`. For example:
Expand Down
20 changes: 20 additions & 0 deletions scripts/modules/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {Mwn} from 'mwn';
import PQueue from 'p-queue';
import chalk from 'chalk';
import {exit} from 'node:process';
import moment from 'moment';
import path from 'node:path';

/**
Expand Down Expand Up @@ -138,6 +139,12 @@ const deploy = async (isSkipAsk: boolean = false, isTest: boolean = false): Prom
const {site} = api;
const enabledGadgets: string[] = [];

const timeFormat: string = 'YYYY-MM-DD HH:mm:ss';

const startTime = moment();
const startTimeFormatted: string = startTime.format(timeFormat);
console.log(chalk.blue(`--- [${chalk.bold(site)}] all starting at ${startTimeFormatted} ---`));

console.log(chalk.yellow(`--- [${chalk.bold(site)}] starting deployment ---`));

for (const [gadgetName, {description, excludeSites, files}] of Object.entries(targets)) {
Expand Down Expand Up @@ -199,6 +206,19 @@ const deploy = async (isSkipAsk: boolean = false, isTest: boolean = false): Prom
await apiQueue.onIdle();

console.log(chalk.yellow(`--- [${chalk.bold(site)}] end of delete unused pages ---`));

const endTime = moment();
const endTimeFormatted: string = endTime.format(timeFormat);
const totalSeconds: number = endTime.diff(startTime, 'seconds');
const calcMinutes: number = Math.floor(totalSeconds / 60);
const calcSeconds: number = totalSeconds % 60;
console.log(chalk.blue(`--- [${chalk.bold(site)}] all succeeded at ${endTimeFormatted} ---`));

const timeTaken: string =
calcMinutes > 0
? `${calcMinutes} minutes and ${Math.floor(calcSeconds)} seconds`
: `${Math.floor(calcSeconds)} seconds`;
console.log(chalk.blue(`--- [${chalk.bold(site)}] took ${timeTaken} ---`));
}
};

Expand Down

0 comments on commit 4994d4f

Please sign in to comment.