primo-cli 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 +111 -39
- package/dist/commands/build.js +488 -272
- package/dist/commands/deploy.d.ts +1 -1
- package/dist/commands/deploy.js +293 -141
- package/dist/commands/dev.d.ts +2 -0
- package/dist/commands/dev.js +2007 -150
- package/dist/commands/init.d.ts +2 -2
- package/dist/commands/init.js +65 -43
- package/dist/commands/login.d.ts +1 -2
- package/dist/commands/login.js +24 -6
- package/dist/commands/new.js +161 -274
- package/dist/commands/pull-library.d.ts +7 -0
- package/dist/commands/pull-library.js +92 -0
- package/dist/commands/pull.d.ts +0 -1
- package/dist/commands/pull.js +160 -165
- package/dist/commands/push-library.d.ts +7 -0
- package/dist/commands/push-library.js +88 -0
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.js +358 -51
- package/dist/commands/validate.d.ts +1 -1
- package/dist/commands/validate.js +379 -161
- package/dist/index.js +110 -20
- package/dist/utils/binary.js +1 -1
- package/dist/utils/format.d.ts +12 -0
- package/dist/utils/format.js +98 -0
- package/dist/utils/head-svelte.d.ts +2 -0
- package/dist/utils/head-svelte.js +53 -0
- package/dist/utils/server-config.d.ts +19 -0
- package/dist/utils/server-config.js +49 -0
- package/dist/utils/site-config.d.ts +11 -0
- package/dist/utils/site-config.js +14 -0
- package/package.json +8 -4
- package/dist/commands/export.d.ts +0 -8
- package/dist/commands/export.js +0 -163
- package/dist/commands/import.d.ts +0 -9
- package/dist/commands/import.js +0 -118
- package/dist/commands/publish.d.ts +0 -6
- package/dist/commands/publish.js +0 -239
package/README.md
CHANGED
|
@@ -15,19 +15,30 @@ npm install -g primo-cli
|
|
|
15
15
|
primo new my-site
|
|
16
16
|
|
|
17
17
|
# This starts the local CMS automatically
|
|
18
|
-
#
|
|
19
|
-
#
|
|
18
|
+
# It scaffolds a workspace like:
|
|
19
|
+
# ./server.yaml
|
|
20
|
+
# ./library/
|
|
21
|
+
# ./sites/my-site/
|
|
20
22
|
```
|
|
21
23
|
|
|
22
24
|
## Commands
|
|
23
25
|
|
|
26
|
+
### `primo init [name]`
|
|
27
|
+
|
|
28
|
+
Initialize a new Primo workspace (server) in a new folder or the current directory.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
primo init # Initialize in the current directory
|
|
32
|
+
primo init my-workspace # Create and initialize "my-workspace"
|
|
33
|
+
```
|
|
34
|
+
|
|
24
35
|
### `primo new [name]`
|
|
25
36
|
|
|
26
37
|
Create a new site with starter files.
|
|
27
38
|
|
|
28
39
|
```bash
|
|
29
40
|
primo new # Interactive prompt for name
|
|
30
|
-
primo new my-site # Create "my-site"
|
|
41
|
+
primo new my-site # Create "sites/my-site" in the current workspace
|
|
31
42
|
primo new --skip-dev # Create files without starting CMS
|
|
32
43
|
```
|
|
33
44
|
|
|
@@ -38,37 +49,73 @@ Start the local CMS server. Watches for file changes and syncs edits from the CM
|
|
|
38
49
|
```bash
|
|
39
50
|
primo dev # Start in current directory
|
|
40
51
|
primo dev -p 8080 # Use custom port
|
|
52
|
+
primo dev --author files # Push file edits to the CMS; CMS UI is read-only (default)
|
|
53
|
+
primo dev --author cms # CMS edits write to files; file edits revert
|
|
54
|
+
primo dev --author both # Bidirectional sync (beta; CMS edits often lost on conflict)
|
|
41
55
|
```
|
|
42
56
|
|
|
43
57
|
### `primo push`
|
|
44
58
|
|
|
45
|
-
|
|
59
|
+
Sync local changes to an existing hosted Primo server. Requires a server you've
|
|
60
|
+
already deployed (run `primo deploy` first) and authenticated against (`primo
|
|
61
|
+
login -s <server-url>`).
|
|
46
62
|
|
|
47
63
|
```bash
|
|
48
|
-
primo push
|
|
64
|
+
primo push https://cms.example.com --site abc123
|
|
65
|
+
primo push --only my-site # Push just one site folder (workspace root)
|
|
49
66
|
primo push --preview # Preview changes without applying
|
|
67
|
+
primo push --dry-run # Show what would be sent without making requests
|
|
50
68
|
```
|
|
51
69
|
|
|
52
70
|
Options:
|
|
53
71
|
- `-s, --server <url>` - Server URL
|
|
54
72
|
- `--site <id>` - Site ID
|
|
73
|
+
- `--only <slug>` - Push only the named site folder under `sites/` (skips library)
|
|
55
74
|
- `-d, --dir <dir>` - Directory (default: `.`)
|
|
56
75
|
- `-t, --token <token>` - Auth token
|
|
57
76
|
- `--preview` - Preview only
|
|
77
|
+
- `--dry-run` - Show what would be pushed without sending requests
|
|
58
78
|
|
|
59
79
|
### `primo pull`
|
|
60
80
|
|
|
61
|
-
Pull
|
|
81
|
+
Pull an entire hosted Primo server — all sites plus the shared library — to local files.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
primo pull https://cms.example.com
|
|
85
|
+
primo pull https://cms.example.com -o ./my-workspace
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Options:
|
|
89
|
+
- `-s, --server <url>` - Server URL (auto-detects local)
|
|
90
|
+
- `-o, --output <dir>` - Output directory (defaults to `./<server-hostname>`)
|
|
91
|
+
- `-t, --token <token>` - Auth token
|
|
92
|
+
|
|
93
|
+
### `primo library pull`
|
|
94
|
+
|
|
95
|
+
Pull the shared block library into a workspace root.
|
|
62
96
|
|
|
63
97
|
```bash
|
|
64
|
-
primo pull
|
|
65
|
-
primo pull
|
|
98
|
+
primo library pull https://cms.example.com
|
|
99
|
+
primo library pull -o ./my-workspace
|
|
66
100
|
```
|
|
67
101
|
|
|
68
102
|
Options:
|
|
69
103
|
- `-s, --server <url>` - Server URL (auto-detects local)
|
|
70
|
-
-
|
|
71
|
-
- `-
|
|
104
|
+
- `-o, --output <dir>` - Workspace output directory (default: `.`)
|
|
105
|
+
- `-t, --token <token>` - Auth token
|
|
106
|
+
|
|
107
|
+
### `primo library push`
|
|
108
|
+
|
|
109
|
+
Push the local shared block library back to a hosted Primo instance.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
primo library push https://cms.example.com
|
|
113
|
+
primo library push https://cms.example.com -d ./my-workspace
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Options:
|
|
117
|
+
- `-s, --server <url>` - Server URL
|
|
118
|
+
- `-d, --dir <dir>` - Workspace directory containing `library/` (default: `.`)
|
|
72
119
|
- `-t, --token <token>` - Auth token
|
|
73
120
|
|
|
74
121
|
### `primo login`
|
|
@@ -80,16 +127,30 @@ primo login https://cms.example.com
|
|
|
80
127
|
primo login https://cms.example.com -e user@example.com
|
|
81
128
|
```
|
|
82
129
|
|
|
83
|
-
### `primo
|
|
130
|
+
### `primo deploy`
|
|
84
131
|
|
|
85
|
-
Deploy
|
|
132
|
+
Deploy the entire workspace — all sites under `sites/`, plus `library/` and
|
|
133
|
+
`server.yaml` — as one editable-CMS unit, to Railway or Fly.io. Must be run
|
|
134
|
+
from the workspace root (the directory containing `server.yaml`).
|
|
86
135
|
|
|
87
136
|
```bash
|
|
88
|
-
primo
|
|
89
|
-
primo
|
|
90
|
-
primo
|
|
137
|
+
primo deploy # Interactive provider selection
|
|
138
|
+
primo deploy -p railway # Deploy to Railway
|
|
139
|
+
primo deploy -p fly # Deploy to Fly.io
|
|
140
|
+
primo deploy --dry-run # Show what would be deployed without doing anything
|
|
91
141
|
```
|
|
92
142
|
|
|
143
|
+
For other hosts (Netlify, Vercel, Cloudflare, GitHub Pages), use `primo build`
|
|
144
|
+
on a single site and deploy the output folder with that host's CLI.
|
|
145
|
+
|
|
146
|
+
#### Picking the right "going-live" command
|
|
147
|
+
|
|
148
|
+
| You want to… | Use |
|
|
149
|
+
| --------------------------------------------- | -------------- |
|
|
150
|
+
| Let collaborators edit content from a CMS UI | `primo deploy` |
|
|
151
|
+
| Ship a static site to any static host | `primo build` |
|
|
152
|
+
| Sync local edits to an existing hosted server | `primo push` |
|
|
153
|
+
|
|
93
154
|
### `primo validate`
|
|
94
155
|
|
|
95
156
|
Check site structure for errors.
|
|
@@ -125,40 +186,51 @@ npx wrangler pages deploy dist
|
|
|
125
186
|
## Site Structure
|
|
126
187
|
|
|
127
188
|
```
|
|
128
|
-
|
|
129
|
-
├──
|
|
130
|
-
├──
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
├── pages/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
│ └── default/
|
|
139
|
-
│ └── config.json
|
|
140
|
-
├── site/ # Site-wide settings
|
|
141
|
-
│ ├── fields.json
|
|
142
|
-
│ ├── content.yaml
|
|
143
|
-
│ └── head.svelte
|
|
144
|
-
└── uploads/ # Media files
|
|
189
|
+
workspace/
|
|
190
|
+
├── server.yaml
|
|
191
|
+
├── library/
|
|
192
|
+
└── sites/
|
|
193
|
+
└── my-site/
|
|
194
|
+
├── site.yaml
|
|
195
|
+
├── blocks/
|
|
196
|
+
├── pages/
|
|
197
|
+
├── page-types/
|
|
198
|
+
└── site/
|
|
145
199
|
```
|
|
146
200
|
|
|
147
201
|
## Multiple Sites
|
|
148
202
|
|
|
149
|
-
Run `primo dev` from a
|
|
203
|
+
Run `primo dev` from a workspace folder to work on multiple sites at once:
|
|
150
204
|
|
|
151
205
|
```
|
|
152
206
|
workspace/
|
|
153
|
-
├── server.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
└── site
|
|
157
|
-
└──
|
|
207
|
+
├── server.yaml # Optional: port + site_groups
|
|
208
|
+
└── sites/
|
|
209
|
+
├── site-one/
|
|
210
|
+
│ └── site.yaml # includes group: default
|
|
211
|
+
└── site-two/
|
|
212
|
+
└── site.yaml # includes group: default
|
|
158
213
|
```
|
|
159
214
|
|
|
160
215
|
Each site gets its own subdomain: `site-one.localhost:3000`, `site-two.localhost:3000`
|
|
161
216
|
|
|
217
|
+
## Shared Library Workspace
|
|
218
|
+
|
|
219
|
+
The shared block library can live at the workspace root alongside the `sites/` folder:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
workspace/
|
|
223
|
+
├── server.yaml
|
|
224
|
+
├── library/
|
|
225
|
+
│ ├── marketing/
|
|
226
|
+
│ │ └── hero/
|
|
227
|
+
│ └── shared/
|
|
228
|
+
│ └── footer/
|
|
229
|
+
└── sites/
|
|
230
|
+
├── site-one/
|
|
231
|
+
└── site-two/
|
|
232
|
+
```
|
|
233
|
+
|
|
162
234
|
## Documentation
|
|
163
235
|
|
|
164
236
|
Full documentation: [primo.page/docs](https://primo.page/docs)
|
|
@@ -166,4 +238,4 @@ Full documentation: [primo.page/docs](https://primo.page/docs)
|
|
|
166
238
|
## Requirements
|
|
167
239
|
|
|
168
240
|
- Node.js 18+
|
|
169
|
-
- For `primo
|
|
241
|
+
- For `primo deploy`: Railway CLI or Fly.io CLI
|