costaff-workspace 0.1.3 → 0.1.5
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 +77 -130
- package/README.zh-TW.md +69 -123
- package/dist/cli-pull.js +12 -4
- package/dist/cli-pull.js.map +1 -1
- package/dist/cli-theme.js +278 -0
- package/dist/cli-theme.js.map +1 -0
- package/dist/cli-whoami.js +68 -0
- package/dist/cli-whoami.js.map +1 -0
- package/dist/cli.js +24 -4
- package/dist/cli.js.map +1 -1
- package/dist/integration.js +9 -2
- package/dist/integration.js.map +1 -1
- package/dist/main.js +20 -2
- package/dist/main.js.map +1 -1
- package/dist/project.js +8 -2
- package/dist/project.js.map +1 -1
- package/dist/protocol.js.map +1 -1
- package/dist/push.js +12 -0
- package/dist/push.js.map +1 -1
- package/dist/report.js +35 -0
- package/dist/report.js.map +1 -0
- package/dist/stage.js +34 -0
- package/dist/stage.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,182 +1,129 @@
|
|
|
1
1
|
# costaff-workspace
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/costaff-workspace)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
3
6
|
**English** · [繁體中文](README.zh-TW.md)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
**The command-line tool for [CoStaff Workspace](https://workspace.costaffs.app).**
|
|
9
|
+
Publish a document you built locally and get back a link you can send. Fetch it
|
|
10
|
+
onto another machine, edit, publish again — the link never changes.
|
|
6
11
|
|
|
7
12
|
Works with projects made using [open-doc](https://github.com/simonliu-ai-product/open-doc)
|
|
8
13
|
(documents), open-slide (decks) and open-sheet (workbooks).
|
|
9
14
|
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## 1. Install it
|
|
13
|
-
|
|
14
|
-
You need [Node.js](https://nodejs.org) 20 or newer. Check with `node -v`.
|
|
15
|
-
|
|
16
15
|
```bash
|
|
17
16
|
npm i -g costaff-workspace
|
|
18
17
|
```
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
costaff-workspace --help
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
<details>
|
|
27
|
-
<summary>If the command is not found</summary>
|
|
28
|
-
|
|
29
|
-
Your shell cannot see where npm puts global commands. `npm prefix -g` prints
|
|
30
|
-
that folder; add its `bin` to your `PATH`. With pnpm, run `pnpm setup` once.
|
|
31
|
-
</details>
|
|
32
|
-
|
|
33
|
-
## 2. Build your project
|
|
34
|
-
|
|
35
|
-
Publishing sends the **built** files, so build first.
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
cd my-doc
|
|
39
|
-
pnpm install
|
|
40
|
-
pnpm build
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
You should now have a `dist/` folder. If your project builds somewhere else,
|
|
44
|
-
remember the name — you will pass it in step 3.
|
|
45
|
-
|
|
46
|
-
## 3. Push
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
costaff-workspace push
|
|
50
|
-
```
|
|
19
|
+
## Why
|
|
51
20
|
|
|
52
|
-
|
|
21
|
+
A built document is a folder of files, and sending someone a folder is not
|
|
22
|
+
sending them a document. Static hosting solves the delivery and loses everything
|
|
23
|
+
around it: who may read the file, what it is called, which version they are
|
|
24
|
+
looking at, and the source it was built from.
|
|
53
25
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
open https://workspace.costaffs.app/activate?code=WXYZ-1234
|
|
57
|
-
code WXYZ-1234
|
|
58
|
-
```
|
|
26
|
+
`costaff-workspace push` closes that gap in one command. What comes back is an
|
|
27
|
+
address, not a deployment.
|
|
59
28
|
|
|
60
|
-
|
|
61
|
-
have to approve it. The command waits, then carries on by itself.
|
|
29
|
+
## Highlights
|
|
62
30
|
|
|
63
|
-
|
|
31
|
+
### 📤 One command, no configuration
|
|
64
32
|
|
|
65
|
-
|
|
33
|
+
Run it in a project folder. The slug comes from the folder name, the kind from
|
|
34
|
+
what `package.json` depends on, the bundle from `dist/`, the title from the
|
|
35
|
+
package description. **Every guess is printed**, and a guess it cannot make stops
|
|
36
|
+
the push rather than inventing something.
|
|
66
37
|
|
|
67
38
|
```
|
|
68
|
-
|
|
69
|
-
getting-started → https://workspace.costaffs.app/dcuk0lmf875ctrgxfppa
|
|
70
|
-
q3-numbers → https://workspace.costaffs.app/8fjq2ldk3nx7yrpv0aet
|
|
71
|
-
team-offsite → https://workspace.costaffs.app/pv0aet8fjq2ldk3nx7yr
|
|
72
|
-
budget-2027 → https://workspace.costaffs.app/3nx7yrpv0aet8fjq2ldk
|
|
39
|
+
guessed --slug q3-report --kind deck --source-dir .
|
|
73
40
|
```
|
|
74
41
|
|
|
75
|
-
|
|
42
|
+
### 🔗 Links that survive edits
|
|
76
43
|
|
|
77
|
-
|
|
44
|
+
The address is settled before the build rather than assigned afterwards, and it
|
|
45
|
+
is remembered per file. Publish the same folder a year later and everyone holding
|
|
46
|
+
the old link sees the new version.
|
|
78
47
|
|
|
79
|
-
|
|
80
|
-
and decide who may read each one.
|
|
48
|
+
### ↩️ Editable from anywhere
|
|
81
49
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
50
|
+
A push carries the source. `costaff-workspace pull <token>` hands back a complete
|
|
51
|
+
project on any machine — install, edit, publish, same link. Nothing is tied to
|
|
52
|
+
the computer that published it first.
|
|
85
53
|
|
|
86
|
-
|
|
54
|
+
### 🔒 Private until you say otherwise
|
|
87
55
|
|
|
88
|
-
|
|
56
|
+
A newly published file opens for its owner and nobody else. Readers are invited,
|
|
57
|
+
or the file is made a public link, in the file manager. Sending someone the
|
|
58
|
+
address is not enough on its own.
|
|
89
59
|
|
|
90
|
-
|
|
91
|
-
whoever you sent it to sees the new version.
|
|
60
|
+
### 📦 One bundle per document
|
|
92
61
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
62
|
+
A project holding several documents is built once per document. The alternative —
|
|
63
|
+
a single shared build — lets anyone sent one document reach every other
|
|
64
|
+
document's assets. Isolation is the reason; the extra builds are the price.
|
|
96
65
|
|
|
97
|
-
|
|
98
|
-
last part of the link:
|
|
66
|
+
## Get started
|
|
99
67
|
|
|
100
68
|
```bash
|
|
101
|
-
costaff-workspace pull dcuk0lmf875ctrgxfppa my-doc
|
|
102
69
|
cd my-doc
|
|
103
|
-
pnpm
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
What comes back is a complete project. Edit it, build it, push it, and the same
|
|
107
|
-
link updates.
|
|
108
|
-
|
|
109
|
-
**You want to check before publishing.** This packages everything and reports
|
|
110
|
-
what it would send, without uploading and without needing a network:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
costaff-workspace push --dry-run
|
|
70
|
+
pnpm build # publishing sends the built files
|
|
71
|
+
costaff-workspace push
|
|
114
72
|
```
|
|
115
73
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## You usually pass no options at all
|
|
119
|
-
|
|
120
|
-
Run in a project folder, `push` works out the rest and **prints every guess**:
|
|
74
|
+
The first push prints a sign-in link with the code already in it. Approve it in a
|
|
75
|
+
browser: the command continues on its own, and the machine stays signed in.
|
|
121
76
|
|
|
122
77
|
```
|
|
123
|
-
|
|
78
|
+
4 documents — one bundle each
|
|
79
|
+
getting-started → https://workspace.costaffs.app/dcuk0lmf875ctrgxfppa
|
|
80
|
+
q3-numbers → https://workspace.costaffs.app/8fjq2ldk3nx7yrpv0aet
|
|
124
81
|
```
|
|
125
82
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
| the file's identity (`--slug`) | the folder's name |
|
|
129
|
-
| document, deck or workbook (`--kind`) | what your `package.json` depends on |
|
|
130
|
-
| the built files (`--site-dir`) | `dist` |
|
|
131
|
-
| the title | your `package.json` description, else the slug |
|
|
83
|
+
Names, folders, and who may read each file are managed at
|
|
84
|
+
[workspace.costaffs.app](https://workspace.costaffs.app).
|
|
132
85
|
|
|
133
|
-
|
|
134
|
-
|
|
86
|
+
> The project's source is uploaded alongside the build, which is what makes
|
|
87
|
+
> `pull` possible later. `node_modules` and dotfiles are never collected, so
|
|
88
|
+
> **`.env` does not travel**. `--no-source` publishes the built files alone.
|
|
135
89
|
|
|
136
|
-
|
|
90
|
+
## Commands
|
|
137
91
|
|
|
138
|
-
|
|
|
92
|
+
| | |
|
|
139
93
|
| --- | --- |
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
147
|
-
`costaff-workspace push --help` lists all of them.
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## Worth knowing
|
|
152
|
-
|
|
153
|
-
**Your source goes up too, and that is on purpose.** It is what lets `pull` hand
|
|
154
|
-
you a working project back later, on any machine. `node_modules` and dotfiles are
|
|
155
|
-
never collected — **your `.env` does not travel**. `--no-source` opts out, and
|
|
156
|
-
then nothing can be pulled back out of that file afterwards.
|
|
94
|
+
| `costaff-workspace push` | publish this folder |
|
|
95
|
+
| `costaff-workspace pull <token> [dir]` | fetch a published file's source |
|
|
96
|
+
| `costaff-workspace theme push\|list\|pull\|rm` | keep the project's `themes/` folder in the workspace |
|
|
97
|
+
| `costaff-workspace whoami` | what this machine is signed in as |
|
|
98
|
+
| `costaff-workspace login` | sign this machine in |
|
|
99
|
+
| `costaff-workspace logout` | forget this machine's sign-in |
|
|
157
100
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
101
|
+
`--json` on any of them prints one line of JSON instead of prose — the same
|
|
102
|
+
shape for success and failure, and a command that would need an interactive
|
|
103
|
+
sign-in stops rather than waiting for a browser.
|
|
161
104
|
|
|
162
|
-
|
|
163
|
-
|
|
105
|
+
A theme is a house style — `themes/<id>.md` and an optional
|
|
106
|
+
`themes/<id>.demo.tsx`. It belongs to the account rather than to one file, so
|
|
107
|
+
the next document can start from the last one's look. The framework comes from
|
|
108
|
+
`package.json`; `--kind document|deck|workbook` overrides it, and `--no-demo`
|
|
109
|
+
sends the specs without building each demo.
|
|
110
|
+
`costaff-workspace theme --help` lists the rest.
|
|
164
111
|
|
|
165
|
-
|
|
112
|
+
## Options
|
|
166
113
|
|
|
167
|
-
|
|
114
|
+
A normal project needs none of these. Pass one when a guess is wrong.
|
|
168
115
|
|
|
169
|
-
|
|
|
116
|
+
| | |
|
|
170
117
|
| --- | --- |
|
|
171
|
-
|
|
|
172
|
-
| `
|
|
173
|
-
|
|
|
174
|
-
| `
|
|
175
|
-
|
|
|
176
|
-
|
|
|
177
|
-
| `No file at that token.` | Wrong token, or the file is not yours and was not shared with you. |
|
|
118
|
+
| `--title "Q3 report"` | the name shown in the file manager |
|
|
119
|
+
| `--slug q3-report` | the file's identity, and what a re-push updates |
|
|
120
|
+
| `--kind document\|deck\|workbook` | when the kind is guessed wrong |
|
|
121
|
+
| `--site-dir build` | when the build output is not `dist` |
|
|
122
|
+
| `--dry-run` | package and report; uploads nothing, needs no network |
|
|
123
|
+
| `--no-source` | publish the built files without the source |
|
|
178
124
|
|
|
125
|
+
`costaff-workspace push --help` lists every option.
|
|
179
126
|
|
|
180
|
-
##
|
|
127
|
+
## License
|
|
181
128
|
|
|
182
129
|
MIT
|
package/README.zh-TW.md
CHANGED
|
@@ -1,172 +1,118 @@
|
|
|
1
1
|
# costaff-workspace
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
|
|
5
|
-
把你在自己電腦上做好的文件,變成一條可以傳給別人的連結。
|
|
6
|
-
|
|
7
|
-
適用於用 [open-doc](https://github.com/simonliu-ai-product/open-doc)(文件)、
|
|
8
|
-
open-slide(簡報)、open-sheet(試算表)做的專案。
|
|
3
|
+
[](https://www.npmjs.com/package/costaff-workspace)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
5
|
|
|
10
|
-
|
|
6
|
+
[English](README.md) · **繁體中文**
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
**[CoStaff Workspace](https://workspace.costaffs.app) 的命令列工具。**
|
|
9
|
+
把在本機做好的文件發佈出去,拿回一條可以傳的連結。換一台機器取回、修改、再發佈,
|
|
10
|
+
連結始終不變。
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
適用於用 [open-doc](https://github.com/simonliu-ai-product/open-doc)(文件)、
|
|
13
|
+
open-slide(簡報)、open-sheet(試算表)做的專案。
|
|
15
14
|
|
|
16
15
|
```bash
|
|
17
16
|
npm i -g costaff-workspace
|
|
18
17
|
```
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
costaff-workspace --help
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
<details>
|
|
27
|
-
<summary>如果顯示「找不到指令」</summary>
|
|
28
|
-
|
|
29
|
-
你的 shell 看不到 npm 放全域指令的地方。`npm prefix -g` 會印出那個資料夾,把它底下的
|
|
30
|
-
`bin` 加進 `PATH`。如果你用 pnpm,跑一次 `pnpm setup` 就好。
|
|
31
|
-
</details>
|
|
32
|
-
|
|
33
|
-
## 2. 先建置你的專案
|
|
19
|
+
## 為什麼
|
|
34
20
|
|
|
35
|
-
|
|
21
|
+
建置好的文件是一整包檔案,而把一整包檔案傳給別人,不等於把文件交給他。靜態託管解決了
|
|
22
|
+
傳遞,卻丟掉了周邊的一切:誰可以讀、它叫什麼名字、對方看到的是哪一版,以及它是從什麼
|
|
23
|
+
原始碼建出來的。
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
cd my-doc
|
|
39
|
-
pnpm install
|
|
40
|
-
pnpm build
|
|
41
|
-
```
|
|
25
|
+
`costaff-workspace push` 用一個指令補上這段落差。拿回來的是一個位址,不是一次部署。
|
|
42
26
|
|
|
43
|
-
|
|
44
|
-
第 3 步會用到。
|
|
27
|
+
## 特色
|
|
45
28
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
costaff-workspace push
|
|
50
|
-
```
|
|
29
|
+
### 📤 一個指令,不用設定
|
|
51
30
|
|
|
52
|
-
|
|
31
|
+
在專案資料夾裡執行。slug 取自資料夾名稱、種類取自 `package.json` 的相依套件、
|
|
32
|
+
產物取自 `dist/`、標題取自套件描述。**每一個推斷都會印出來**,而推斷不出來的時候
|
|
33
|
+
它會停下,不會憑空編一個。
|
|
53
34
|
|
|
54
35
|
```
|
|
55
|
-
|
|
56
|
-
open https://workspace.costaffs.app/activate?code=WXYZ-1234
|
|
57
|
-
code WXYZ-1234
|
|
36
|
+
guessed --slug q3-report --kind deck --source-dir .
|
|
58
37
|
```
|
|
59
38
|
|
|
60
|
-
|
|
61
|
-
授權完就繼續。
|
|
62
|
-
|
|
63
|
-
這台機器之後就記住登入了,不會再問。
|
|
39
|
+
### 🔗 改了內容,連結不變
|
|
64
40
|
|
|
65
|
-
|
|
41
|
+
位址在建置之前就決定,不是事後才配發的,而且逐一記在檔案上。一年後重新發佈同一個
|
|
42
|
+
資料夾,所有拿著舊連結的人看到的就是新版本。
|
|
66
43
|
|
|
67
|
-
|
|
68
|
-
4 documents — one bundle each
|
|
69
|
-
getting-started → https://workspace.costaffs.app/dcuk0lmf875ctrgxfppa
|
|
70
|
-
q3-numbers → https://workspace.costaffs.app/8fjq2ldk3nx7yrpv0aet
|
|
71
|
-
team-offsite → https://workspace.costaffs.app/pv0aet8fjq2ldk3nx7yr
|
|
72
|
-
budget-2027 → https://workspace.costaffs.app/3nx7yrpv0aet8fjq2ldk
|
|
73
|
-
```
|
|
44
|
+
### ↩️ 換台機器就能接手
|
|
74
45
|
|
|
75
|
-
|
|
46
|
+
推送會帶著原始碼。`costaff-workspace pull <token>` 會在任何機器上還你一個完整的
|
|
47
|
+
專案——安裝、修改、發佈,同一條連結。沒有任何東西綁在最初發佈的那台電腦上。
|
|
76
48
|
|
|
77
|
-
|
|
49
|
+
### 🔒 預設私人,由你決定開放
|
|
78
50
|
|
|
79
|
-
|
|
51
|
+
剛發佈的檔案只有擁有者打得開。要讓誰讀,是在檔案管理員裡邀請,或把它改成公開連結。
|
|
52
|
+
**光是把位址傳給別人並不夠。**
|
|
80
53
|
|
|
81
|
-
|
|
82
|
-
> **光是把連結傳給別人是不夠的**——你要在那裡邀請他,或是把檔案改成公開連結。
|
|
54
|
+
### 📦 一份文件一個 bundle
|
|
83
55
|
|
|
84
|
-
|
|
56
|
+
含多份文件的專案會逐份建置。另一種做法——共用一次建置——會讓你只傳一份文件給別人時,
|
|
57
|
+
他就能取得其他每一份的資產。隔離是理由,多出來的建置次數是代價。
|
|
85
58
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
**你改了內容。** 重新建置再推一次。**連結不會變**——你傳出去的那條會直接看到新版本。
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
pnpm build && costaff-workspace push
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
**你換了一台電腦。** 用 token(連結的最後一段)把專案取回來:
|
|
59
|
+
## 開始使用
|
|
95
60
|
|
|
96
61
|
```bash
|
|
97
|
-
costaff-workspace pull dcuk0lmf875ctrgxfppa my-doc
|
|
98
62
|
cd my-doc
|
|
99
|
-
pnpm
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
拿回來的是一個完整的專案。改完、建置、推上去,同一條連結就更新了。
|
|
103
|
-
|
|
104
|
-
**你想在發佈前先確認。** 這會把東西打包好並回報要送出什麼,但不上傳,也不需要網路:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
costaff-workspace push --dry-run
|
|
63
|
+
pnpm build # 發佈送出去的是建置後的檔案
|
|
64
|
+
costaff-workspace push
|
|
108
65
|
```
|
|
109
66
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
## 你通常一個參數都不用打
|
|
113
|
-
|
|
114
|
-
在專案資料夾裡執行,`push` 會自己推斷,而且**每一個猜測都會印出來**:
|
|
67
|
+
第一次推送會印出一條登入連結,驗證碼已經在網址裡。在瀏覽器按下同意,指令會自己繼續,
|
|
68
|
+
之後這台機器就保持登入。
|
|
115
69
|
|
|
116
70
|
```
|
|
117
|
-
|
|
71
|
+
4 documents — one bundle each
|
|
72
|
+
getting-started → https://workspace.costaffs.app/dcuk0lmf875ctrgxfppa
|
|
73
|
+
q3-numbers → https://workspace.costaffs.app/8fjq2ldk3nx7yrpv0aet
|
|
118
74
|
```
|
|
119
75
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
| 檔案的身分(`--slug`) | 資料夾的名字 |
|
|
123
|
-
| 是文件、簡報還是試算表(`--kind`) | 你 `package.json` 裡的相依套件 |
|
|
124
|
-
| 建置產物在哪(`--site-dir`) | `dist` |
|
|
125
|
-
| 標題 | `package.json` 的 description,沒有就用 slug |
|
|
76
|
+
名稱、資料夾,以及每一份誰可以讀,都在
|
|
77
|
+
[workspace.costaffs.app](https://workspace.costaffs.app) 管理。
|
|
126
78
|
|
|
127
|
-
|
|
79
|
+
> 專案的原始碼會和建置產物一起上傳,那正是之後 `pull` 得以成立的原因。
|
|
80
|
+
> `node_modules` 和點開頭的檔案永遠不會被收進去,所以 **`.env` 不會跟著走**。
|
|
81
|
+
> `--no-source` 則只發佈建置後的檔案。
|
|
128
82
|
|
|
129
|
-
|
|
83
|
+
## 指令
|
|
130
84
|
|
|
131
|
-
|
|
|
85
|
+
| | |
|
|
132
86
|
| --- | --- |
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
140
|
-
`costaff-workspace push --help` 會列出全部。
|
|
87
|
+
| `costaff-workspace push` | 發佈這個資料夾 |
|
|
88
|
+
| `costaff-workspace pull <token> [dir]` | 取回某份已發佈檔案的原始碼 |
|
|
89
|
+
| `costaff-workspace theme push\|list\|pull\|rm` | 把專案的 `themes/` 資料夾留在工作區 |
|
|
90
|
+
| `costaff-workspace whoami` | 這台機器登入的是誰 |
|
|
91
|
+
| `costaff-workspace login` | 讓這台機器登入 |
|
|
92
|
+
| `costaff-workspace logout` | 忘掉這台機器的登入 |
|
|
141
93
|
|
|
142
|
-
|
|
94
|
+
任何一個加上 `--json` 就會印一行 JSON 而不是散文——成功和失敗同一種形狀;需要
|
|
95
|
+
互動登入的指令會直接停下來,而不是等瀏覽器。
|
|
143
96
|
|
|
144
|
-
|
|
97
|
+
主題就是一套版面風格——`themes/<id>.md` 加上可選的 `themes/<id>.demo.tsx`。它屬於帳號
|
|
98
|
+
而不屬於某一份檔案,所以下一份文件可以從上一份的樣子開始。框架從 `package.json` 判斷,
|
|
99
|
+
`--kind document|deck|workbook` 可以指定,`--no-demo` 則只送規格、不建置示範。
|
|
100
|
+
其餘看 `costaff-workspace theme --help`。
|
|
145
101
|
|
|
146
|
-
|
|
147
|
-
可以直接跑的專案的原因。`node_modules` 和點開頭的檔案永遠不會被收進去——
|
|
148
|
-
**你的 `.env` 不會跟著走**。`--no-source` 可以不送,但那之後這份檔案就拉不回來了。
|
|
102
|
+
## 參數
|
|
149
103
|
|
|
150
|
-
|
|
151
|
-
在一份共用的建置產物裡,你只傳一份給別人,他就能拿到其他全部。
|
|
104
|
+
一般的專案一個都不需要。推斷錯了才補上那一個。
|
|
152
105
|
|
|
153
|
-
|
|
154
|
-
帳號底下,原件不受影響。
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## 出問題的時候
|
|
159
|
-
|
|
160
|
-
| 它說 | 意思,以及怎麼辦 |
|
|
106
|
+
| | |
|
|
161
107
|
| --- | --- |
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
|
|
|
165
|
-
| `
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
169
|
-
|
|
108
|
+
| `--title "第三季報告"` | 檔案管理員裡顯示的名稱 |
|
|
109
|
+
| `--slug q3-report` | 檔案的身分,也決定重推會更新哪一份 |
|
|
110
|
+
| `--kind document\|deck\|workbook` | 種類推斷錯誤時 |
|
|
111
|
+
| `--site-dir build` | 建置產物不在 `dist` 時 |
|
|
112
|
+
| `--dry-run` | 打包並回報;不上傳,也不需要網路 |
|
|
113
|
+
| `--no-source` | 只發佈建置後的檔案,不帶原始碼 |
|
|
114
|
+
|
|
115
|
+
`costaff-workspace push --help` 會列出全部參數。
|
|
170
116
|
|
|
171
117
|
## 授權
|
|
172
118
|
|
package/dist/cli-pull.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PublishError, discover } from "./client.js";
|
|
2
2
|
import { DEFAULT_ENDPOINT } from "./defaults.js";
|
|
3
3
|
import { pull } from "./pull.js";
|
|
4
|
+
import { done, jsonMode, line } from "./report.js";
|
|
4
5
|
import { login } from "./push.js";
|
|
5
6
|
const USAGE = `costaff-workspace pull — fetch a published file's source back out
|
|
6
7
|
|
|
@@ -44,17 +45,24 @@ export async function runPull(argv) {
|
|
|
44
45
|
const token = positional[0];
|
|
45
46
|
if (token === undefined)
|
|
46
47
|
throw new PublishError('missing <token>');
|
|
47
|
-
const out = (
|
|
48
|
-
|
|
48
|
+
const out = (text) => {
|
|
49
|
+
line(text);
|
|
49
50
|
};
|
|
50
|
-
await pull({
|
|
51
|
+
const result = await pull({
|
|
51
52
|
endpoint,
|
|
52
53
|
token,
|
|
53
54
|
dir: positional[1],
|
|
54
55
|
force: flags.force === true,
|
|
55
56
|
bearer: str('bearer'),
|
|
56
57
|
out,
|
|
57
|
-
signIn: async () =>
|
|
58
|
+
signIn: async () => {
|
|
59
|
+
/* 同 push:`--json` 的讀者按不了瀏覽器裡的核准,卡住比報錯更難查。 */
|
|
60
|
+
if (jsonMode()) {
|
|
61
|
+
throw new PublishError('not signed in — run `costaff-workspace login` once, or set COSTAFF_WORKSPACE_TOKEN');
|
|
62
|
+
}
|
|
63
|
+
return login({ endpoint, out }, (await discover(endpoint)).name);
|
|
64
|
+
},
|
|
58
65
|
});
|
|
66
|
+
done({ command: 'pull', endpoint, token, ...result });
|
|
59
67
|
}
|
|
60
68
|
//# sourceMappingURL=cli-pull.js.map
|
package/dist/cli-pull.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli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