@willh/now 0.1.0 → 0.1.2
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/CHANGELOG.md +75 -0
- package/README.md +62 -5
- package/package.json +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# 變更記錄
|
|
2
|
+
|
|
3
|
+
本文件記錄 `now` 各版本的重要變更。
|
|
4
|
+
|
|
5
|
+
格式參考 [Keep a Changelog](https://keepachangelog.com/zh-TW/1.1.0/),版本編號遵循 [Semantic Versioning](https://semver.org/lang/zh-TW/)。
|
|
6
|
+
|
|
7
|
+
* * *
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
* * *
|
|
12
|
+
|
|
13
|
+
## [0.1.2] - 2026-07-19
|
|
14
|
+
|
|
15
|
+
### 新增
|
|
16
|
+
|
|
17
|
+
- 部署命令新增 `--source`、`--prefix` 與 `--remote_dir` 具名旗標,可在單次部署覆寫來源目錄、Azure Storage Blob 前綴與 FTP 遠端目錄,且不會改寫 `.now.json`。
|
|
18
|
+
- `--remote-dir` 可作為 `--remote_dir` 的別名。
|
|
19
|
+
|
|
20
|
+
### 變更
|
|
21
|
+
|
|
22
|
+
- 將 GitHub Actions 的 artifact、Node.js 與 Pages actions 升級至 Node.js 24 版本,消除 Node.js 20 棄用警告。
|
|
23
|
+
|
|
24
|
+
### 修正
|
|
25
|
+
|
|
26
|
+
- Release workflow 在 GitHub Release 資產發布成功後直接呼叫 npm 發布 workflow,不再依賴 `GITHUB_TOKEN` 無法遞迴觸發的 `release.published` 事件。
|
|
27
|
+
- npm 發布 workflow 新增 release tag 格式與 `package.json` 版本一致性驗證,並保留帶入 tag 的手動執行入口。
|
|
28
|
+
|
|
29
|
+
* * *
|
|
30
|
+
|
|
31
|
+
## [0.1.1] - 2026-07-18
|
|
32
|
+
|
|
33
|
+
### 新增
|
|
34
|
+
|
|
35
|
+
- 新增 `--verbose` 詳細偵錯模式,可顯示設定檔、來源選擇、外部命令、工作目錄與環境變數對應等診斷資訊。
|
|
36
|
+
- Azure Storage Blob 新增 `azure_blob.prefix`,可部署到 container 內的指定子目錄,並同步套用於公開 URL 推導。
|
|
37
|
+
- 首次設定明確指定來源路徑時,會驗證目錄並保存到 `.now.json` 的 `source`;專案內保存相對路徑,專案外保存絕對路徑。
|
|
38
|
+
- 首次設定可記住是否將可發布檔案移到 `public/`,後續部署不再重複詢問。
|
|
39
|
+
- 新增 `.env` 讀寫支援,供 Azure Storage Blob SAS URL 與 Azure Static Web App deployment token 安全使用。
|
|
40
|
+
- 新增支援五種語系、響應式版面、淺色與深色主題的公開網站,並加入 SEO、OpenGraph、結構化資料與 GitHub Pages 自動部署。
|
|
41
|
+
|
|
42
|
+
### 變更
|
|
43
|
+
|
|
44
|
+
- 設定初始化入口由 `now config init` 改為頂層 `now init`,並支援重新設定現有專案。
|
|
45
|
+
- Azure Storage Blob onboarding 可沿用既有 `.env` SAS URL,顯示時會遮蔽敏感 query string。
|
|
46
|
+
- Azure Static Web App 部署可從專案 `.env` 載入 deployment token。
|
|
47
|
+
- 部署目前目錄、明確指定目前目錄或設定 `"source": "."` 時,都會排除 `.now.json`、`.env`、`.env.*`、`.git/`、`node_modules/`、`target/` 與暫存檔。
|
|
48
|
+
- GitHub Actions 升級 checkout 與 setup-node,並修正 Release 資產發布流程。
|
|
49
|
+
|
|
50
|
+
### 修正
|
|
51
|
+
|
|
52
|
+
- Azure Storage Blob SAS URL 不再寫入 `.now.json`,改由 `azure_blob.sas_url_env` 指向環境變數或 `.env`。
|
|
53
|
+
- 無效的明確來源路徑會在首次設定前失敗,不會留下不完整的 `.now.json`。
|
|
54
|
+
- 後續明確指定來源路徑只影響當次部署,不會暗中覆寫既有 `source`。
|
|
55
|
+
- 修正公開網站的多語系標題切換、鍵盤操作、標題階層、主題參數優先序與版面配置問題。
|
|
56
|
+
|
|
57
|
+
* * *
|
|
58
|
+
|
|
59
|
+
## [0.1.0] - 2026-07-07
|
|
60
|
+
|
|
61
|
+
### 新增
|
|
62
|
+
|
|
63
|
+
- 首次發布 `now` Rust CLI,可用單一命令部署靜態網站。
|
|
64
|
+
- 支援 Firebase Hosting、Azure Storage Blob、Azure Static Web App 與 Any Website (FTP)。
|
|
65
|
+
- 支援命令列路徑、`dist/`、`build/`、`public/` 與目前目錄的來源選擇規則。
|
|
66
|
+
- 支援本機 `.now.json`、全域設定、命令列 provider 覆寫與設定檔診斷。
|
|
67
|
+
- 支援 dry-run、JSON 部署摘要與預設公開 URL 推導。
|
|
68
|
+
- Azure Storage Blob 使用內建 REST API 上傳,不需要 Azure CLI。
|
|
69
|
+
- 提供 macOS Apple Silicon、macOS Intel、Linux x64 glibc 與 Windows x64 原生執行檔及 SHA-256 checksum。
|
|
70
|
+
- 提供 npm、Unix-like 安裝腳本、Windows PowerShell 安裝腳本與 GitHub Release 發布流程。
|
|
71
|
+
|
|
72
|
+
[Unreleased]: https://github.com/doggy8088/now/compare/v0.1.2...HEAD
|
|
73
|
+
[0.1.2]: https://github.com/doggy8088/now/compare/v0.1.1...v0.1.2
|
|
74
|
+
[0.1.1]: https://github.com/doggy8088/now/compare/v0.1.0...v0.1.1
|
|
75
|
+
[0.1.0]: https://github.com/doggy8088/now/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -77,10 +77,19 @@ now deploy dist
|
|
|
77
77
|
|
|
78
78
|
第一次在互動式終端機執行 `now` 或 `now deploy`,且尚未設定 provider 時,CLI 會啟動首次設定流程,協助選擇 provider 並把非祕密設定寫入 `.now.json`。非互動式環境或 `--json` 模式不會啟動提示流程,會直接輸出缺少 provider 的錯誤。
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
首次設定時若有明確指定 path,now 會先驗證該目錄,再把它保存為 `.now.json` 的 `source`。專案內目錄保存為相對於目前工作目錄的路徑,後續可直接執行 `now` 重複部署;專案外目錄保存為絕對路徑。
|
|
81
|
+
|
|
82
|
+
也可以明確啟動互動式設定精靈:
|
|
81
83
|
|
|
82
84
|
```sh
|
|
83
85
|
now init
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`now init` 只會設定 provider 與相關選項,不會執行發布。若設定檔已存在,CLI 會先詢問是否重新設定並覆寫;拒絕時會保留原檔,接受時則以既有值作為提示預設值。
|
|
89
|
+
|
|
90
|
+
若只需修改單一設定,也可以使用:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
84
93
|
now config set provider firebase-hosting
|
|
85
94
|
```
|
|
86
95
|
|
|
@@ -109,6 +118,7 @@ now 讀取兩種設定檔:
|
|
|
109
118
|
{
|
|
110
119
|
"provider": "firebase-hosting",
|
|
111
120
|
"source": null,
|
|
121
|
+
"move_publishable_files_to_public": null,
|
|
112
122
|
"base_url": "https://example.web.app",
|
|
113
123
|
"default_url": null,
|
|
114
124
|
"firebase": {
|
|
@@ -223,7 +233,9 @@ PUT https://mystorageaccount.blob.core.windows.net/$web/<file>?<sas-query>
|
|
|
223
233
|
npm install -g @azure/static-web-apps-cli
|
|
224
234
|
```
|
|
225
235
|
|
|
226
|
-
|
|
236
|
+
首次設定選擇 `Azure Static Web App` 時,會要求輸入 deployment token。實際權杖只會寫入 `.env`,`.now.json` 只保存環境變數名稱。部署時會優先讀取程序環境變數,未設定時再讀取專案的 `.env`。
|
|
237
|
+
|
|
238
|
+
也可以自行把 deployment token 放在環境變數:
|
|
227
239
|
|
|
228
240
|
```sh
|
|
229
241
|
export SWA_CLI_DEPLOYMENT_TOKEN=...
|
|
@@ -275,8 +287,15 @@ now config set ftp.remote_dir /public_html
|
|
|
275
287
|
若三者都不存在:
|
|
276
288
|
|
|
277
289
|
1. 互動式終端機會詢問是否把目前目錄的可發布檔案移到 `public/`。
|
|
278
|
-
2.
|
|
279
|
-
3.
|
|
290
|
+
2. 回答會寫入 `.now.json` 的 `move_publishable_files_to_public`,後續直接套用,不再重複詢問。
|
|
291
|
+
3. 若拒絕或處於非互動式環境且尚無記憶選擇,會部署目前目錄。
|
|
292
|
+
4. 部署目前目錄或移動檔案時,會排除 `.now.json`、`.env`、`.env.*`、`.git/`、`node_modules/`、`target/` 與暫存檔。
|
|
293
|
+
|
|
294
|
+
若要清除記憶並讓 CLI 下次重新詢問:
|
|
295
|
+
|
|
296
|
+
```sh
|
|
297
|
+
now config set move_publishable_files_to_public null
|
|
298
|
+
```
|
|
280
299
|
|
|
281
300
|
指定 path 時會直接使用該目錄:
|
|
282
301
|
|
|
@@ -285,6 +304,23 @@ now deploy dist
|
|
|
285
304
|
now ./public
|
|
286
305
|
```
|
|
287
306
|
|
|
307
|
+
命令列 path 的優先序高於設定檔中的 `source`。除首次設定會保存明確指定的 path 外,後續指定 path 只覆寫當次部署來源,不會暗中改寫 `.now.json`;如需永久變更,請使用:
|
|
308
|
+
|
|
309
|
+
```sh
|
|
310
|
+
now config set source reports/example
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
也可以使用具名旗標,單次覆寫 `.now.json` 內的部署參數:
|
|
314
|
+
|
|
315
|
+
```sh
|
|
316
|
+
now --source dist
|
|
317
|
+
now deploy --source dist
|
|
318
|
+
now deploy --prefix releases/2026-07-18
|
|
319
|
+
now deploy --remote_dir /public_html/releases/2026-07-18
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`--source` 覆寫 `source`,`--prefix` 覆寫 `azure_blob.prefix`,`--remote_dir` 覆寫 `ftp.remote_dir`。這些值只套用於當次部署,不會改寫 `.now.json`。`--remote-dir` 也可作為 `--remote_dir` 的別名。
|
|
323
|
+
|
|
288
324
|
* * *
|
|
289
325
|
|
|
290
326
|
## URL 選擇規則
|
|
@@ -315,6 +351,27 @@ now config get --global
|
|
|
315
351
|
now config doctor
|
|
316
352
|
```
|
|
317
353
|
|
|
354
|
+
### 詳細記錄
|
|
355
|
+
|
|
356
|
+
部署時加入 `--verbose` 可顯示設定檔位置、provider、來源目錄判斷、準備後的部署目錄、外部命令工作目錄、完整命令與參數、環境變數映射名稱、外部命令輸出及結束狀態:
|
|
357
|
+
|
|
358
|
+
```sh
|
|
359
|
+
now --verbose
|
|
360
|
+
now deploy --verbose
|
|
361
|
+
now deploy dist --verbose
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
詳細記錄會輸出到 stderr,因此可與 `--json` 同時使用而不破壞 stdout 的 JSON。權杖、密碼與 SAS URL query 不會顯示。
|
|
365
|
+
|
|
366
|
+
`--verbose` 也會開啟 provider 自身的偵錯模式:
|
|
367
|
+
|
|
368
|
+
| Provider | 偵錯設定 |
|
|
369
|
+
| --- | --- |
|
|
370
|
+
| Firebase Hosting | `firebase --debug` |
|
|
371
|
+
| Azure Static Web App | `swa --verbose silly` |
|
|
372
|
+
| Any Website via FTP | `lftp -d` |
|
|
373
|
+
| Azure Storage Blob | 顯示每個檔案的遮罩後目標 URL、大小與完成狀態 |
|
|
374
|
+
|
|
318
375
|
* * *
|
|
319
376
|
|
|
320
377
|
## 安全性
|
|
@@ -390,7 +447,7 @@ now-x86_64-pc-windows-msvc.zip
|
|
|
390
447
|
now-x86_64-pc-windows-msvc.zip.sha256
|
|
391
448
|
```
|
|
392
449
|
|
|
393
|
-
CI 會執行 Rust format、clippy、Rust 測試與 npm 測試。release workflow 會建立跨平台 binary archive 與 checksum。npm publish workflow
|
|
450
|
+
CI 會執行 Rust format、clippy、Rust 測試與 npm 測試。release workflow 會建立跨平台 binary archive 與 checksum,發布 GitHub Release 資產成功後,再直接呼叫可重用的 npm publish workflow。npm publish workflow 也保留帶入 release tag 的手動執行入口,並使用:
|
|
394
451
|
|
|
395
452
|
```sh
|
|
396
453
|
npm publish --provenance --access public
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willh/now",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Deploy static sites with provider CLIs",
|
|
5
5
|
"bin": {
|
|
6
6
|
"now": "npm/cli.cjs"
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"npm/postinstall.cjs",
|
|
16
16
|
"npm/prepublish-check.cjs",
|
|
17
17
|
"tests/postinstall.test.cjs",
|
|
18
|
+
"CHANGELOG.md",
|
|
18
19
|
"README.md",
|
|
19
20
|
"LICENSE"
|
|
20
21
|
],
|