vanspod 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/classroomApp.js +2 -1
- package/dist/environmentIcons.js +3 -1
- package/dist/officialDownloads.js +15 -4
- package/dist/start.js +8 -8
- package/dist/version.js +1 -1
- package/dist/windowsEnvironment.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ npm run dist
|
|
|
38
38
|
npm pack --pack-destination dist
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
exe 產物為 `dist/VansPod.exe`,本機套件為 `dist/vanspod-0.5.
|
|
41
|
+
exe 產物為 `dist/VansPod.exe`,本機套件為 `dist/vanspod-0.5.7.tgz`;可在 Windows 用 `npm install -g <套件路徑>` 安裝測試。圖片、favicon、系統匣與移除腳本均包含在發佈產物中。更新 logo 後執行 `powershell.exe -NoProfile -File scripts/build-icon.ps1` 重建多尺寸 Windows icon。
|
|
42
42
|
|
|
43
43
|
exe 發佈管道為本專案 GitHub Releases,npm 為公開 registry 的 [`vanspod`](https://www.npmjs.com/package/vanspod) 套件。更新時不要執行完整移除,否則會清除課堂資料。
|
|
44
44
|
|
|
@@ -46,12 +46,12 @@ exe 發佈管道為本專案 GitHub Releases,npm 為公開 registry 的 [`vans
|
|
|
46
46
|
|
|
47
47
|
一般 push 不發佈;推送 `v*` tag 會在 Windows runner 安裝 Node.js 24、檢查型別、執行測試、打包並驗證 exe/npm 生命週期,全部通過後才建立 GitHub Release,最後發佈 npm 套件。學生從 Release 下載 `VansPod.exe`,同頁提供 `SHA256SUMS.txt`。Release 另附 brotli 壓縮的 `VansPod.exe.br`(約三分之一大小),程式內更新只下載這份,解壓後再比對 `VansPod.exe` 的 SHA-256;SHA256SUMS 沒列出它的舊版 Release 則下載完整 exe。
|
|
48
48
|
|
|
49
|
-
發版前同步 `package.json`、`package-lock.json` 與 `src/version.ts` 的版本;tag 必須等於 `v` 加版本號,否則流程失敗。以 `0.5.
|
|
49
|
+
發版前同步 `package.json`、`package-lock.json` 與 `src/version.ts` 的版本;tag 必須等於 `v` 加版本號,否則流程失敗。以 `0.5.7` 為例:
|
|
50
50
|
|
|
51
51
|
```powershell
|
|
52
52
|
git push origin master
|
|
53
|
-
git tag -a v0.5.
|
|
54
|
-
git push origin v0.5.
|
|
53
|
+
git tag -a v0.5.7 -m "VansPod 0.5.7"
|
|
54
|
+
git push origin v0.5.7
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
新版本使用新的版本號與 tag。相同 tag 的 Actions 重跑會更新該 Release 的產物。
|
package/dist/classroomApp.js
CHANGED
|
@@ -19,13 +19,14 @@ exports.CONNECTION_CANCELLED = "連線已取消";
|
|
|
19
19
|
const CONNECTION_FAILED = "連線失敗,請再按一次「連線」。";
|
|
20
20
|
const CLIENT_ROUTE_OF = { codex: "codex", claude: "claudeCode", vscode: "vsCodeChat" };
|
|
21
21
|
// 新工具加在最後,不改既有 id。
|
|
22
|
-
exports.ENVIRONMENT_TOOLS = ["uv", "git", "node", "pwsh", "vscode"];
|
|
22
|
+
exports.ENVIRONMENT_TOOLS = ["uv", "git", "node", "pwsh", "vscode", "gh"];
|
|
23
23
|
exports.ENVIRONMENT_LABEL = {
|
|
24
24
|
uv: "uv",
|
|
25
25
|
git: "git",
|
|
26
26
|
node: "Node.js",
|
|
27
27
|
pwsh: "PowerShell 7",
|
|
28
28
|
vscode: "VS Code",
|
|
29
|
+
gh: "GitHub CLI",
|
|
29
30
|
};
|
|
30
31
|
exports.AUTO_APPROVAL_DURATIONS = {
|
|
31
32
|
"10": { label: "10 分鐘", ms: 10 * 60_000 },
|
package/dist/environmentIcons.js
CHANGED
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.environmentIcons = void 0;
|
|
4
4
|
// Brand icons from https://github.com/simple-icons/simple-icons (CC0-1.0).
|
|
5
5
|
// PowerShell from 11.15.0; VS Code (visualstudiocode) from 7.21.0, before it was removed; other icons from develop.
|
|
6
|
+
// GitHub CLI uses the github icon.
|
|
6
7
|
exports.environmentIcons = {
|
|
7
8
|
"uv": "<svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m0 .1058.0504 11.9496.0403 9.5597c.0055 1.3199 1.08 2.3854 2.4 2.3798l9.5596-.0403 5.9749-.0252.6075-.0026c1.316-.0056 2.3799-1.0963 2.3799-2.4123h1.0946v2.3894L24 23.9042 23.8992.005 12.9056.0513l.0463 9.5245v5.9637h-1.9583L11.04 9.584 10.9936.0594Z\"/></svg>",
|
|
8
9
|
"git": "<svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M13.09 23.549a1.54 1.54 0 0 1-2.18 0L.451 13.089a1.54 1.54 0 0 1 0-2.179l7.191-7.19 2.733 2.733a1.85 1.85 0 0 0 .964 2.326v6.66a1.849 1.849 0 1 0 1.54 0V8.957l2.508 2.508a1.85 1.85 0 1 0 1.09-1.09l-2.634-2.634a1.85 1.85 0 0 0-2.378-2.377L8.73 2.63 10.91.451a1.54 1.54 0 0 1 2.179 0l10.459 10.46a1.54 1.54 0 0 1 0 2.179z\"/></svg>",
|
|
9
10
|
"node": "<svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z\"/></svg>",
|
|
10
11
|
"pwsh": "<svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M23.181 2.974c.568 0 .923.463.792 1.035l-3.659 15.982c-.13.572-.697 1.035-1.265 1.035H.819c-.568 0-.923-.463-.792-1.035L3.686 4.009c.13-.572.697-1.035 1.265-1.035zm-8.375 9.346c.251-.394.227-.905-.09-1.243L9.122 5.125c-.38-.404-1.037-.407-1.466-.003-.429.402-.468 1.056-.088 1.46l4.662 4.96v.11l-7.42 5.374c-.45.327-.533.977-.187 1.453.346.476.991.597 1.44.27l8.229-5.91c.28-.196.438-.365.514-.52zm-2.796 4.399a.928.928 0 00-.934.923c0 .51.418.923.934.923h4.433a.928.928 0 00.934-.923.928.928 0 00-.934-.923z\"/></svg>",
|
|
11
|
-
"vscode": "<svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z\"/></svg>"
|
|
12
|
+
"vscode": "<svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z\"/></svg>",
|
|
13
|
+
"gh": "<svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\"/></svg>"
|
|
12
14
|
};
|
|
@@ -4,13 +4,19 @@ exports.vsCodeInstaller = vsCodeInstaller;
|
|
|
4
4
|
exports.lookupDownload = lookupDownload;
|
|
5
5
|
exports.wingetToolInstaller = wingetToolInstaller;
|
|
6
6
|
const classroomApp_1 = require("./classroomApp");
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Authenticode 簽署者憑證主體裡的組織(O=)必須完全是這個名字。
|
|
9
|
+
* 名字含逗號等特殊字元時,Windows 把它加上引號,例如 O="GitHub, Inc."。
|
|
10
|
+
*/
|
|
8
11
|
function signedBy(organization) {
|
|
9
|
-
|
|
12
|
+
// 引號內的 " 寫成 ""。
|
|
13
|
+
const value = /[,+"\\<>;=]/.test(organization) ? `"${organization.replace(/"/g, '""')}"` : organization;
|
|
14
|
+
const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10
15
|
return new RegExp(`(?:^|,\\s*)O=${escaped}(?:,|$)`);
|
|
11
16
|
}
|
|
12
17
|
const MICROSOFT_SIGNER = signedBy("Microsoft Corporation");
|
|
13
18
|
const OPENJS_SIGNER = signedBy("OpenJS Foundation");
|
|
19
|
+
const GITHUB_SIGNER = signedBy("GitHub, Inc.");
|
|
14
20
|
// Git for Windows 由維護者 Johannes Schindelin 個人簽署,不是「Git for Windows」。
|
|
15
21
|
const GIT_FOR_WINDOWS_SIGNER = signedBy("Johannes Schindelin");
|
|
16
22
|
/** VS Code User 版:裝在學生自己的帳號下,不需要系統管理員;不自動啟動,等驗證完由學生開啟。 */
|
|
@@ -43,6 +49,10 @@ const GITHUB_LATEST = {
|
|
|
43
49
|
url: "https://api.github.com/repos/PowerShell/PowerShell/releases/latest",
|
|
44
50
|
asset: { x64: /^PowerShell-\d[\d.]*-win-x64\.msi$/, arm64: /^PowerShell-\d[\d.]*-win-arm64\.msi$/ },
|
|
45
51
|
},
|
|
52
|
+
gh: {
|
|
53
|
+
url: "https://api.github.com/repos/cli/cli/releases/latest",
|
|
54
|
+
asset: { x64: /^gh_\d[\d.]*_windows_amd64\.msi$/, arm64: /^gh_\d[\d.]*_windows_arm64\.msi$/ },
|
|
55
|
+
},
|
|
46
56
|
};
|
|
47
57
|
/** 查詢官方來源的 JSON;失敗時回傳學生看得懂、可以重試的原因。 */
|
|
48
58
|
async function fetchLatest(system, label, url, signal) {
|
|
@@ -91,7 +101,8 @@ async function lookupDownload(system, tool, architecture, signal) {
|
|
|
91
101
|
return missing;
|
|
92
102
|
return { download: { url: asset.browser_download_url, fileName: asset.name } };
|
|
93
103
|
}
|
|
94
|
-
|
|
104
|
+
const MSI_SIGNER = { node: OPENJS_SIGNER, pwsh: MICROSOFT_SIGNER, gh: GITHUB_SIGNER };
|
|
105
|
+
/** 官方安裝檔:Git 是 Inno Setup,Node.js、PowerShell 與 GitHub CLI 是 MSI;全部靜默、不自動重新開機,並寫安裝器自己的 log。 */
|
|
95
106
|
function wingetToolInstaller(tool, download, setupLog) {
|
|
96
107
|
const base = { label: classroomApp_1.ENVIRONMENT_LABEL[tool], url: download.url, fileName: download.fileName };
|
|
97
108
|
if (tool === "git") {
|
|
@@ -106,7 +117,7 @@ function wingetToolInstaller(tool, download, setupLog) {
|
|
|
106
117
|
}
|
|
107
118
|
return {
|
|
108
119
|
...base,
|
|
109
|
-
signer: tool
|
|
120
|
+
signer: MSI_SIGNER[tool],
|
|
110
121
|
launch: (installer) => ({
|
|
111
122
|
command: "msiexec",
|
|
112
123
|
args: ["/i", installer, "/qn", "/norestart", ...(tool === "pwsh" ? ["ADD_PATH=1"] : []), "/L*v", setupLog],
|
package/dist/start.js
CHANGED
|
@@ -143,9 +143,12 @@ async function exchangeCode(body) {
|
|
|
143
143
|
function isEnvironmentTool(value) {
|
|
144
144
|
return classroomApp_1.ENVIRONMENT_TOOLS.includes(value);
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
// 直接下載安裝只做 Windows;這些工具在 macOS 開啟官方安裝頁,由學生自己安裝。
|
|
147
|
+
const MAC_INSTALL_PAGE = {
|
|
148
|
+
pwsh: "https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-macos",
|
|
149
|
+
vscode: "https://code.visualstudio.com/download",
|
|
150
|
+
gh: "https://cli.github.com/",
|
|
151
|
+
};
|
|
149
152
|
/** 首頁最多等啟動這麼久;涵蓋 Course Catalog 重試與 Session Model Allowlist 的抓取。 */
|
|
150
153
|
const PAGE_STARTUP_WAIT_MS = 30_000;
|
|
151
154
|
/** macOS 維持原本的偵測:找得到且有輸出版本就算已就緒(ADR-0008:第一版只完整支援 Windows)。 */
|
|
@@ -160,11 +163,8 @@ function probeMacEnvironment(tool) {
|
|
|
160
163
|
/** 開發工具與 Project Folder 無關,安裝一律在使用者家目錄執行。 */
|
|
161
164
|
function installMacEnvironment(tool, signal, onProgress) {
|
|
162
165
|
onProgress?.({ stage: "installing" });
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
: tool === "vscode"
|
|
166
|
-
? { command: "open", args: [MAC_VSCODE_PAGE] }
|
|
167
|
-
: (0, commandRunner_1.shellLaunch)(macEnvironmentInstallCommand(tool));
|
|
166
|
+
const page = MAC_INSTALL_PAGE[tool];
|
|
167
|
+
const launch = page ? { command: "open", args: [page] } : (0, commandRunner_1.shellLaunch)(macEnvironmentInstallCommand(tool));
|
|
168
168
|
return (0, commandRunner_1.collectOutput)(launch.command, launch.args, node_os_1.default.homedir(), undefined, signal).then((result) => {
|
|
169
169
|
if (result.aborted)
|
|
170
170
|
return { exitCode: result.exitCode, output: result.output, aborted: true };
|
package/dist/version.js
CHANGED
|
@@ -20,6 +20,8 @@ const VERSION_CHECK = {
|
|
|
20
20
|
pwsh: { command: "pwsh", pattern: /^PowerShell 7\.\d+\.\d+/ },
|
|
21
21
|
// code --version 印出版本、commit 與架構三行;只看第一行。
|
|
22
22
|
vscode: { command: "code", pattern: /^\d+\.\d+\.\d+(?:[-+]\S+)?(?:\r?\n|$)/ },
|
|
23
|
+
// gh --version 第二行是 release 網址。只檢查指令,不檢查 GitHub 登入:登入是學生自己的身分。
|
|
24
|
+
gh: { command: "gh", pattern: /^gh version \d+\.\d+\.\d+/ },
|
|
23
25
|
};
|
|
24
26
|
const CHECK_TIMEOUT_MS = 15_000;
|
|
25
27
|
const NODE_LTS_REASON = "需要 Node.js LTS,且 npm 必須可正常執行";
|
|
@@ -43,6 +45,7 @@ const WINGET_ID = {
|
|
|
43
45
|
git: "Git.Git",
|
|
44
46
|
node: "OpenJS.NodeJS.LTS",
|
|
45
47
|
pwsh: "Microsoft.PowerShell",
|
|
48
|
+
gh: "GitHub.cli",
|
|
46
49
|
};
|
|
47
50
|
function isWingetTool(tool) {
|
|
48
51
|
return tool in WINGET_ID;
|