Refactor: use TransformStream

This commit is contained in:
SukkaW
2023-11-23 17:38:04 +08:00
parent 7a6107761f
commit 265df07893
5 changed files with 143 additions and 49 deletions

View File

@@ -17,8 +17,7 @@ const outputSurgeDir = path.resolve(__dirname, '../List');
const outputClashDir = path.resolve(__dirname, '../Clash');
export const buildCommon = task(__filename, async () => {
/** @type {Promise<unknown>[]} */
const promises = [];
const promises: Promise<unknown>[] = [];
const pw = new PathScurry(sourceDir);
for await (const entry of pw) {
@@ -50,12 +49,10 @@ if (import.meta.main) {
}
const processFile = async (sourcePath: string) => {
/** @type {string[]} */
const lines = [];
const lines: string[] = [];
let title = '';
/** @type {string[]} */
const descriptions = [];
const descriptions: string[] = [];
for await (const line of readFileByLine(sourcePath)) {
if (line === MAGIC_COMMAND_SKIP) {