From 9dd55a063d274a35182face4a36aba58f3c3b3f1 Mon Sep 17 00:00:00 2001 From: SuperMonster003 Date: Fri, 3 Oct 2025 16:15:21 +0800 Subject: [PATCH] =?UTF-8?q?6.7.0=20-=20Alpha6=20-=20Scrapers=20=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E7=AA=97=E5=8F=A3=E5=AE=BD=E5=BA=A6=E4=B8=8D?= =?UTF-8?q?=E8=B6=B3=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .utils/package-lock.json | 161 ++++++++++++++++-- .utils/package.json | 6 +- .utils/run-scrapers.bat | 19 ++- .utils/run-scrapers.mjs | 67 +++++--- .utils/utils/print.mjs | 2 +- gradle/data/agp-releases.list | 4 +- .../android-studio-build-version.properties | 3 +- 7 files changed, 217 insertions(+), 45 deletions(-) diff --git a/.utils/package-lock.json b/.utils/package-lock.json index a7738a38..62ccc59c 100644 --- a/.utils/package-lock.json +++ b/.utils/package-lock.json @@ -9,7 +9,9 @@ "domhandler": "^5.0.3", "dotenv": "^17.2.2", "node-fetch": "^3.3.2", - "puppeteer": "^24.17.1" + "puppeteer": "^24.17.1", + "string-width": "^8.1.0", + "strip-ansi": "^7.1.2" }, "devDependencies": { "@octokit/types": "^14.1.0" @@ -112,12 +114,15 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, "node_modules/ansi-styles": { @@ -333,6 +338,41 @@ "node": ">=12" } }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -716,6 +756,18 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-east-asian-width": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", + "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -1285,29 +1337,34 @@ } }, "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.1.0.tgz", + "integrity": "sha512-Kxl3KJGb/gxkaUMOjRsQ8IrXiGW75O4E3RPjFIINOVH8AMl2SQ/yWdTzWwF3FevIX9LcMAjJW+GRwAlAbTSXdg==", "license": "MIT", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "get-east-asian-width": "^1.3.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">=8" + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", "license": "MIT", "dependencies": { - "ansi-regex": "^5.0.1" + "ansi-regex": "^6.0.1" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, "node_modules/tar-fs": { @@ -1419,6 +1476,41 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1482,6 +1574,41 @@ "node": ">=12" } }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", diff --git a/.utils/package.json b/.utils/package.json index 307853e6..46468383 100644 --- a/.utils/package.json +++ b/.utils/package.json @@ -2,10 +2,12 @@ "type": "module", "dependencies": { "cheerio": "^1.1.2", + "domhandler": "^5.0.3", + "dotenv": "^17.2.2", "node-fetch": "^3.3.2", "puppeteer": "^24.17.1", - "domhandler": "^5.0.3", - "dotenv": "^17.2.2" + "string-width": "^8.1.0", + "strip-ansi": "^7.1.2" }, "devDependencies": { "@octokit/types": "^14.1.0" diff --git a/.utils/run-scrapers.bat b/.utils/run-scrapers.bat index 6d75ef7d..efa4f666 100644 --- a/.utils/run-scrapers.bat +++ b/.utils/run-scrapers.bat @@ -3,14 +3,29 @@ node "run-scrapers.mjs" ECHO. -ECHO Press [R] to rerun the scrapers, or [ESC]/[Enter]/[Space] to exit... -powershell -NoLogo -NoProfile -Command "$ErrorActionPreference='Stop'; while($true){ $k=$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); if($k.VirtualKeyCode -eq 27 -or $k.VirtualKeyCode -eq 13 -or $k.Character -eq ' '){ exit 1 } elseif($k.Character -match '^[Rr]$'){ exit 0 } }" +ECHO Press [R] to rerun, [Shift+R] to clear screen then rerun, or [ESC]/[Enter]/[Space] to exit... +powershell -NoLogo -NoProfile -Command ^ + "$ErrorActionPreference='Stop';" ^ + "while($true){" ^ + " $k=$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');" ^ + " if($k.VirtualKeyCode -eq 27 -or $k.VirtualKeyCode -eq 13 -or $k.Character -eq ' '){ exit 1 }" ^ + " elseif($k.VirtualKeyCode -eq 82){" ^ + " $isShift = ($k.ControlKeyState -band 0x0010) -ne 0 -or ($k.ControlKeyState -band 0x0080) -ne 0;" ^ + " if($isShift){ exit 2 } else { exit 0 }" ^ + " }" ^ + "}" +IF ERRORLEVEL 2 GOTO SHIFT_R IF ERRORLEVEL 1 GOTO EXIT ECHO. GOTO RUN +:SHIFT_R +CLS +ECHO. +GOTO RUN + :EXIT ECHO. EXIT /B \ No newline at end of file diff --git a/.utils/run-scrapers.mjs b/.utils/run-scrapers.mjs index c85b626c..1f9a623a 100644 --- a/.utils/run-scrapers.mjs +++ b/.utils/run-scrapers.mjs @@ -2,13 +2,14 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; +import * as process from 'node:process'; import * as readline from 'node:readline'; +import stringWidth from 'string-width'; +import stripAnsi from 'strip-ansi'; import { fileURLToPath } from 'node:url'; import { spawn } from 'node:child_process'; const SCRIPT_LIST = [ - 'scrape-and-update-readme-template-contributors-table.mjs', - 'scrape-and-update-foojay-resolver-version.mjs', 'scrape-and-inject-rhino-engine-data.mjs', 'scrape-and-inject-latest-gradle-wrapper.mjs', 'scrape-and-inject-gradle-kotlin-compatibility-map.mjs', @@ -18,19 +19,13 @@ const SCRIPT_LIST = [ 'scrape-and-inject-agp-gradle-compatibility-map.mjs', 'scrape-and-inject-agp-releases-list.mjs', 'scrape-and-inject-ksp-releases-map.mjs', + 'scrape-and-update-foojay-resolver-version.mjs', + 'scrape-and-update-readme-template-contributors-table.mjs', ]; const childProcessOutput = []; -/** - * @param {ScriptItem[]} scripts - * @param {number} idx - * @returns {string} - */ -function getScriptProgressMessage(scripts, idx) { - const order = `${idx + 1}`.padStart(`${scripts.length}`.length, '0'); - return `[${order}/${scripts.length}] ${scripts[idx].name}`; -} +const cols = () => process.stdout.columns || 80; /** * Parse CLI arguments.
@@ -77,6 +72,36 @@ function ensureExists(filePath) { } } +/** + * @param {ScriptItem[]} scripts + * @param {number} idx + * @param {string} [extra=''] + * @returns {string} + */ +function oneLineHeader(scripts, idx, extra = '') { + const total = scripts.length; + const order = `${idx + 1}`.padStart(`${total}`.length, '0'); + const base = scripts[idx].name; + const suffix = extra ? ` (${extra})` : ''; + const core = `[${order}/${total}] ${base}${suffix}`; + const width = cols(); + if (core.length <= width) return core; + const ellipsis = ' ... '; + const keep = Math.max(4, width - ellipsis.length); + const left = Math.ceil(keep / 2); + const right = Math.floor(keep / 2); + return core.slice(0, left) + ellipsis + core.slice(core.length - right); +} + +/** + * @param {string} text + * @returns {number} + */ +function visualRowsOf(text) { + const width = stringWidth(stripAnsi(text).replace(/\r?\n$/, '')); + return Math.max(1, Math.ceil(width / Math.max(1, cols()))); +} + /** * @param {Object} options * @param {string} options.nodePath @@ -141,7 +166,7 @@ async function main() { const lineLength = Math.min(Math.max( title.length, ...exhibitionItems.map(s => s.length - 1), - ) + 2, process.stdout.columns || 80); + ) + 2, cols()); const lineDouble = '='.repeat(lineLength); const lineSingle = '-'.repeat(lineLength); @@ -161,14 +186,16 @@ async function main() { const results = []; for (let i = 0; i < scripts.length; i++) { const script = scripts[i]; - const startLine = getScriptProgressMessage(scripts, i); + const startLine = oneLineHeader(scripts, i); process.stdout.write(`\r${startLine}\n`); const res = await runOne({ nodePath: opts.nodePath, scriptPath: script.abs, cwd: utilsDir }); - const endLine = `${startLine} (${formatDuration(res.ms)})`; + const endLine = oneLineHeader(scripts, i, formatDuration(res.ms)); - const lineCountToMove = childProcessOutput.map(chunk => `${chunk}`).join('').split('\n').length; + const lineCountToMove = childProcessOutput.map(chunk => `${chunk}`).join('').split('\n').reduce((acc, line) => { + return acc + visualRowsOf(line) + }, 0); if (res.code === 0) { childProcessOutput.forEach((chunk) => { @@ -177,10 +204,10 @@ async function main() { readline.moveCursor(process.stdout, 0, -lineCountToMove); readline.clearLine(process.stdout, 0); process.stdout.write(`\r${endLine}`); - readline.moveCursor(process.stdout, 0, lineCountToMove + 1); - process.stdout.write('\r'); + readline.moveCursor(process.stdout, 0, lineCountToMove); + process.stdout.write('\n'); results.push({ ...res, name: script.name }); - childProcessOutput.splice(0, childProcessOutput.length); + childProcessOutput.splice(0); } else { // readline.moveCursor(process.stdout, 0, -childProcessOutput.length - 1); // process.stdout.write(`\r${endLine} [code: ${res.code}]`); @@ -195,7 +222,7 @@ async function main() { const failed = results.filter(r => r.code !== 0); if (failed.length === 0) { const title = 'All tasks completed successfully'; - const lineLength = Math.min(Math.max(title.length) + 1, process.stdout.columns || 80); + const lineLength = Math.min(Math.max(title.length) + 1, cols()); const line = '='.repeat(lineLength); console.log(line); console.log(` ${title}`); @@ -210,7 +237,7 @@ async function main() { const lineLength = Math.min(Math.max( title.length, ...messages.map(s => s.length - 1), - ) + 2, process.stdout.columns || 80); + ) + 2, cols()); const lineDouble = '='.repeat(lineLength); const lineSingle = '-'.repeat(lineLength); console.log(lineDouble); diff --git a/.utils/utils/print.mjs b/.utils/utils/print.mjs index 2961e540..7de678bf 100644 --- a/.utils/utils/print.mjs +++ b/.utils/utils/print.mjs @@ -157,4 +157,4 @@ export function printListDiffs(src, other) { */ function mapToLines(map) { return Array.from(map.entries()).map(([ k, v ]) => `"${k}" to "${v}"`).join('\n'); -} \ No newline at end of file +} diff --git a/gradle/data/agp-releases.list b/gradle/data/agp-releases.list index b63eb342..dd18b729 100644 --- a/gradle/data/agp-releases.list +++ b/gradle/data/agp-releases.list @@ -1,5 +1,5 @@ -#Thu Oct 02 00:55:28 GMT+8 2025 -9.0.0-alpha08 +#Fri Oct 03 16:08:59 GMT+8 2025 +9.0.0-alpha09 8.13.0 8.12.3 8.11.2 diff --git a/gradle/data/android-studio-build-version.properties b/gradle/data/android-studio-build-version.properties index 931ae287..d47605f3 100644 --- a/gradle/data/android-studio-build-version.properties +++ b/gradle/data/android-studio-build-version.properties @@ -1,4 +1,5 @@ -#Wed Oct 01 18:32:59 GMT+8 2025 +#Fri Oct 03 16:10:34 GMT+8 2025 +252.25557.131.2521.14204915=2025.2.1.4 252.25557.131.2521.14170811=2025.2.1.3 252.25557.131.2521.14165931=2025.2.1.2 252.25557.131.2521.14126747=2025.2.1.1