creght-cli 0.1.16 → 0.1.18
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 +143 -33
- package/bin/creght.js +1 -1
- package/package.json +2 -2
- package/scripts/install.js +2 -2
- package/vendor/darwin-arm64/creght +0 -0
- package/vendor/darwin-x64/creght +0 -0
- package/vendor/linux-arm64/creght +0 -0
- package/vendor/linux-x64/creght +0 -0
- package/vendor/win32-arm64/creght.exe +0 -0
- package/vendor/win32-x64/creght.exe +0 -0
- package/vite/index.d.ts +4 -4
- package/vite/index.js +9 -9
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Creght CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Creght CLI is a thin local bridge for syncing site code between a local directory and Creght.
|
|
4
4
|
|
|
5
|
-
The CLI can also run a local Vite preview for pulled
|
|
5
|
+
The CLI can also run a local Vite preview for pulled Creght projects. Creght remains responsible for cloud rendering, CMS, assets, and the realtime preview environment.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -45,20 +45,20 @@ The command opens a browser authorization page. After authorization succeeds, th
|
|
|
45
45
|
~/Library/Application Support/creght/config.json
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
The config file contains the API host and CLI
|
|
48
|
+
The config file contains the current API host and CLI tokens. Tokens are stored per API host, so logging in to `https://creght.cn`, `https://creght.com`, or a local backend does not overwrite the other hosts' login state.
|
|
49
49
|
|
|
50
50
|
When `--web` is omitted, the CLI uses `CREGHT_WEB_HOST` if set. For local API hosts such as `localhost` or `127.0.0.1`, it defaults to `http://localhost:5173`.
|
|
51
51
|
For production, the default API host and default web host are both `https://creght.cn`.
|
|
52
52
|
|
|
53
53
|
## Logout
|
|
54
54
|
|
|
55
|
-
Remove the saved CLI
|
|
55
|
+
Remove the saved CLI login for the current API host:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
58
|
creght logout
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
When `CREGHT_API_HOST` is set, `logout` removes only that host's token. Other saved hosts remain logged in. If the last saved token is removed, the config file is deleted.
|
|
62
62
|
|
|
63
63
|
## List Projects
|
|
64
64
|
|
|
@@ -102,9 +102,9 @@ creght project create --name="My Project" --from_id=<project_id>
|
|
|
102
102
|
creght project create --name="My Project" --tpl_id=<template_id>
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
## Pull Site
|
|
105
|
+
## Pull Site Workspace
|
|
106
106
|
|
|
107
|
-
Download the current remote site
|
|
107
|
+
Download the current remote site workspace into a local directory:
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
110
|
creght pull --site_id=<project_id>/<site_id> --dir=./mysite
|
|
@@ -116,16 +116,36 @@ For local development:
|
|
|
116
116
|
CREGHT_API_HOST=http://localhost:8433 creght pull --site_id=<project_id>/<site_id> --dir=./mysite
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
The command writes
|
|
119
|
+
The command writes a file-based workspace:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
mysite/
|
|
123
|
+
AGENTS.md
|
|
124
|
+
frontend/
|
|
125
|
+
page/...
|
|
126
|
+
component/...
|
|
127
|
+
talizen.config.ts
|
|
128
|
+
backend/
|
|
129
|
+
func/
|
|
130
|
+
booking.ts
|
|
131
|
+
profile/settings.ts
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Remote frontend files such as `/page/...`, `/component/...`, and
|
|
135
|
+
`talizen.config.ts` are written under `frontend/`. Project Func code is written
|
|
136
|
+
under `backend/func/`; for example Func key `booking` maps to
|
|
137
|
+
`backend/func/booking.ts`, and `profile/settings` maps to
|
|
138
|
+
`backend/func/profile/settings.ts`.
|
|
120
139
|
|
|
121
140
|
## Local Vite Preview
|
|
122
141
|
|
|
123
|
-
|
|
142
|
+
Creght projects pulled by the CLI usually do not have their own `package.json`
|
|
124
143
|
or `node_modules`. The local preview plugin therefore uses Vite only for local
|
|
125
144
|
file serving and TSX transpilation; third-party packages continue to resolve
|
|
126
|
-
through the
|
|
127
|
-
`creght dev`, the CLI
|
|
128
|
-
|
|
145
|
+
through the Creght import map, matching the Web editor preview model. In
|
|
146
|
+
`creght dev`, the CLI serves the `frontend/` directory when present, loads the
|
|
147
|
+
platform import map from server system info, and passes it to the Vite plugin;
|
|
148
|
+
the plugin's local map is only a fallback.
|
|
129
149
|
|
|
130
150
|
Install Vite in the local project folder:
|
|
131
151
|
|
|
@@ -167,7 +187,7 @@ module after local file changes without a full page reload.
|
|
|
167
187
|
|
|
168
188
|
## Push Local Changes
|
|
169
189
|
|
|
170
|
-
Push the current local directory snapshot to
|
|
190
|
+
Push the current local directory snapshot to Creght and exit:
|
|
171
191
|
|
|
172
192
|
```bash
|
|
173
193
|
creght push --site_id=<project_id>/<site_id> --dir=./mysite
|
|
@@ -179,8 +199,15 @@ For local development:
|
|
|
179
199
|
CREGHT_API_HOST=http://localhost:8433 creght push --site_id=<project_id>/<site_id> --dir=./mysite
|
|
180
200
|
```
|
|
181
201
|
|
|
182
|
-
The CLI scans the local
|
|
183
|
-
|
|
202
|
+
The CLI scans the local workspace and diffs both frontend files and Func files:
|
|
203
|
+
|
|
204
|
+
- `frontend/**` is synced to Creght site files.
|
|
205
|
+
- `backend/func/**/*.ts` is synced to project Func records.
|
|
206
|
+
|
|
207
|
+
Creating, editing, renaming, or deleting files under `backend/func/` creates,
|
|
208
|
+
updates, renames, or deletes Func records through the backend API. Func CRUD is
|
|
209
|
+
intentionally file-based; the CLI does not expose manual Func management
|
|
210
|
+
commands.
|
|
184
211
|
|
|
185
212
|
## Sync Local Changes
|
|
186
213
|
|
|
@@ -197,13 +224,13 @@ CREGHT_API_HOST=http://localhost:8433 creght sync --site_id=<project_id>/<site_i
|
|
|
197
224
|
```
|
|
198
225
|
|
|
199
226
|
`sync` first pushes the current local snapshot, then keeps running and
|
|
200
|
-
automatically listens for local file changes. When a file is
|
|
201
|
-
the CLI
|
|
202
|
-
|
|
227
|
+
automatically listens for local file changes. When a frontend or Func file is
|
|
228
|
+
changed locally, the CLI updates the corresponding remote resource in realtime.
|
|
229
|
+
The command also prints the remote preview URL when available.
|
|
203
230
|
|
|
204
231
|
## Local Web Editor Bidirectional Sync
|
|
205
232
|
|
|
206
|
-
Run local files and the online
|
|
233
|
+
Run local files and the online Creght editor against the same cloud realtime
|
|
207
234
|
files:
|
|
208
235
|
|
|
209
236
|
```bash
|
|
@@ -217,7 +244,7 @@ CREGHT_API_HOST=http://localhost:8433 creght dev --web=http://localhost:5173 --s
|
|
|
217
244
|
```
|
|
218
245
|
|
|
219
246
|
The command prints the online Web editor URL, pushes local file changes to
|
|
220
|
-
|
|
247
|
+
Creght, and listens to the existing WebSocket collaboration channel so editor
|
|
221
248
|
changes are written back to the local directory. MVP conflict handling is last
|
|
222
249
|
write wins.
|
|
223
250
|
|
|
@@ -317,6 +344,7 @@ List, get, create, update, and delete content entries:
|
|
|
317
344
|
```bash
|
|
318
345
|
creght content list --site_id=<project_id>/<site_id> --collection=blogs
|
|
319
346
|
creght content get --site_id=<project_id>/<site_id> --collection=blogs --slug=hello-world
|
|
347
|
+
creght content get --site_id=<project_id>/<site_id> --collection=blogs --slug=hello-world --out=./content.json
|
|
320
348
|
creght content create --site_id=<project_id>/<site_id> --collection=blogs --data=./content.json --slug=hello-world
|
|
321
349
|
creght content update --site_id=<project_id>/<site_id> --collection=blogs --id=<content_id> --data=./content.json
|
|
322
350
|
creght content delete --site_id=<project_id>/<site_id> --collection=blogs --id=<content_id>
|
|
@@ -371,9 +399,86 @@ creght form submit --site_id=<project_id>/<site_id> --key=contact-form --data=./
|
|
|
371
399
|
|
|
372
400
|
After creating or changing CMS collections or forms, run `creght pull` again to refresh generated files such as `/types/cms.d.ts` and `/types/form.d.ts` before writing code that imports those types.
|
|
373
401
|
|
|
402
|
+
## Manage Backend Tables
|
|
403
|
+
|
|
404
|
+
Project JSON tables provide persistent data for Creght/Talizen Func code through
|
|
405
|
+
`ctx.db.*`.
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
creght table list --site_id=<project_id>/<site_id>
|
|
409
|
+
creght table create --site_id=<project_id>/<site_id> --key=appointments --name="Appointments" --schema=./appointments.schema.json
|
|
410
|
+
creght table get --site_id=<project_id>/<site_id> --key=appointments
|
|
411
|
+
creght table update --site_id=<project_id>/<site_id> --key=appointments --schema=./appointments.schema.json
|
|
412
|
+
creght table delete --site_id=<project_id>/<site_id> --key=appointments
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Manage seed or operational records:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
creght table record list --site_id=<project_id>/<site_id> --table=appointments
|
|
419
|
+
creght table record list --site_id=<project_id>/<site_id> --table=appointments --where=./where.json
|
|
420
|
+
creght table record get --site_id=<project_id>/<site_id> --table=appointments --id=<record_id> --out=./record.json
|
|
421
|
+
creght table record create --site_id=<project_id>/<site_id> --table=appointments --data=./record.json
|
|
422
|
+
creght table record update --site_id=<project_id>/<site_id> --table=appointments --id=<record_id> --data=./patch.json
|
|
423
|
+
creght table record delete --site_id=<project_id>/<site_id> --table=appointments --id=<record_id>
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
`record update` sends a patch body to the backend. Existing fields are merged,
|
|
427
|
+
and a `null` field value removes that field.
|
|
428
|
+
|
|
429
|
+
## Func Backend Code As Files
|
|
430
|
+
|
|
431
|
+
Func is for small project-level backend workflows such as bookings, RSVP,
|
|
432
|
+
availability checks, protected status updates, and JSON-table reads/writes.
|
|
433
|
+
Func keys are extensionless project paths like `booking` or
|
|
434
|
+
`profile/settings`.
|
|
435
|
+
|
|
436
|
+
The normal workflow is file-based:
|
|
437
|
+
|
|
438
|
+
1. Run `creght pull --site_id=<project_id>/<site_id> --dir=./mysite`.
|
|
439
|
+
2. Edit or create files under `./mysite/backend/func/`.
|
|
440
|
+
3. Run `creght push --site_id=<project_id>/<site_id> --dir=./mysite`, or keep
|
|
441
|
+
`creght sync` / `creght dev` running.
|
|
442
|
+
|
|
443
|
+
Examples:
|
|
444
|
+
|
|
445
|
+
- `backend/func/booking.ts` -> Func key `booking`
|
|
446
|
+
- `backend/func/profile/settings.ts` -> Func key `profile/settings`
|
|
447
|
+
|
|
448
|
+
Deleting a local Func file deletes the remote Func on the next push/sync.
|
|
449
|
+
Renaming a local Func file is treated as delete old key + create new key.
|
|
450
|
+
|
|
451
|
+
Func files should use ESM exports and the `(input, ctx)` signature:
|
|
452
|
+
|
|
453
|
+
```ts
|
|
454
|
+
export function create(input, ctx) {
|
|
455
|
+
return ctx.db.insert("appointments", input)
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Page and component code should call Func through the `talizen/func` SDK:
|
|
460
|
+
|
|
461
|
+
```ts
|
|
462
|
+
import { invoke } from "talizen/func"
|
|
463
|
+
|
|
464
|
+
await invoke("booking.create", input)
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Use `talizen/auth` for login, registration, logout, current-user state, and
|
|
468
|
+
OAuth. Do not implement passwords, sessions, or OAuth callbacks in Func.
|
|
469
|
+
|
|
470
|
+
Use `creght func run` to self-test a Func method with sample input:
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
creght func run --site_id=<project_id>/<site_id> --key=booking.create --input=./input.json
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
The CLI intentionally does not expose `creght func list/get/create/update/delete`.
|
|
477
|
+
Use `backend/func` files for Func CRUD, and `creght func run` only for self-tests.
|
|
478
|
+
|
|
374
479
|
## Upload Assets
|
|
375
480
|
|
|
376
|
-
Upload a local file through the
|
|
481
|
+
Upload a local file through the Creght site asset flow:
|
|
377
482
|
|
|
378
483
|
```bash
|
|
379
484
|
creght upload --site_id=<project_id>/<site_id> --file=./image.png
|
|
@@ -381,7 +486,7 @@ creght upload --site_id=<project_id>/<site_id> --file=./image.png
|
|
|
381
486
|
|
|
382
487
|
The command prints the public file URL by default. Use `--json` to inspect the
|
|
383
488
|
full upload metadata, including `site_path`, a stable `/_assets/...` path that
|
|
384
|
-
can be used from
|
|
489
|
+
can be used from Creght site code:
|
|
385
490
|
|
|
386
491
|
```bash
|
|
387
492
|
creght upload --site_id=<project_id>/<site_id> --file=./image.png --json
|
|
@@ -398,7 +503,7 @@ creght upload --site_id=<project_id>/<site_id> --file=./image.png --name=hero.pn
|
|
|
398
503
|
The current MVP push/sync mode is one-way:
|
|
399
504
|
|
|
400
505
|
```text
|
|
401
|
-
local directory ->
|
|
506
|
+
local directory -> Creght remote site
|
|
402
507
|
```
|
|
403
508
|
|
|
404
509
|
`push` fetches the remote file list to build the local path to remote file id
|
|
@@ -418,12 +523,12 @@ source of truth.
|
|
|
418
523
|
|
|
419
524
|
## Commands
|
|
420
525
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
push local files back to
|
|
526
|
+
Creght CLI is a local bridge for Creght site code. It can authenticate with
|
|
527
|
+
Creght, list projects and sites, pull remote site files into a local directory,
|
|
528
|
+
push local files back to Creght, watch local files for realtime sync, open the
|
|
424
529
|
remote preview, and publish a site.
|
|
425
530
|
|
|
426
|
-
The CLI commands still use the
|
|
531
|
+
The CLI commands still use the Creght backend and web app for the canonical
|
|
427
532
|
preview. The Vite plugin is a local development helper and intentionally does
|
|
428
533
|
not implement full production SSR.
|
|
429
534
|
|
|
@@ -443,17 +548,20 @@ creght content list --site_id=<project_id>/<site_id> --collection=<key>
|
|
|
443
548
|
creght content create --site_id=<project_id>/<site_id> --collection=<key> --data=./content.json
|
|
444
549
|
creght form list --site_id=<project_id>/<site_id>
|
|
445
550
|
creght form create --site_id=<project_id>/<site_id> --key=<key> --name=<name> --schema=./schema.json
|
|
551
|
+
creght table list --site_id=<project_id>/<site_id>
|
|
552
|
+
creght table record create --site_id=<project_id>/<site_id> --table=<key> --data=./record.json
|
|
553
|
+
creght func run --site_id=<project_id>/<site_id> --key=<key.method> --input=./input.json
|
|
446
554
|
creght upload --site_id=<project_id>/<site_id> --file=./image.png
|
|
447
555
|
creght version
|
|
448
556
|
```
|
|
449
557
|
|
|
450
558
|
Command meanings:
|
|
451
559
|
|
|
452
|
-
- `login`: Authenticate this machine with
|
|
453
|
-
- `logout`: Remove the saved CLI
|
|
560
|
+
- `login`: Authenticate this machine with Creght and save a CLI token for the current API host.
|
|
561
|
+
- `logout`: Remove the saved CLI login for the current API host.
|
|
454
562
|
- `project`: List available projects and sites. Use `project_id/site_id` with site commands. Also supports `project create`.
|
|
455
|
-
- `pull`: Download
|
|
456
|
-
- `push`: Push the current local
|
|
563
|
+
- `pull`: Download frontend files and Func files into a local workspace.
|
|
564
|
+
- `push`: Push the current local workspace snapshot to the remote site/project.
|
|
457
565
|
- `sync`: Watch mode; push the current snapshot, then keep listening for local changes.
|
|
458
566
|
- `dev`: Bidirectionally sync local files with cloud realtime files and the online Web editor.
|
|
459
567
|
- `preview`: Open the remote preview URL for a site in the browser.
|
|
@@ -461,7 +569,9 @@ Command meanings:
|
|
|
461
569
|
- `cms`: Manage CMS collections.
|
|
462
570
|
- `content`: Manage CMS content entries.
|
|
463
571
|
- `form`: Manage forms and form submissions.
|
|
464
|
-
- `
|
|
572
|
+
- `table`: Manage project JSON tables and records used by Func.
|
|
573
|
+
- `func`: Run project Func backend code with sample input. Func CRUD is handled through `backend/func` file sync.
|
|
574
|
+
- `upload`: Upload a local file as a Creght site asset and print its URL.
|
|
465
575
|
- `version`: Print the installed CLI version.
|
|
466
576
|
|
|
467
577
|
## Release
|
package/bin/creght.js
CHANGED
|
@@ -15,7 +15,7 @@ const result = spawnSync(binary, process.argv.slice(2), {
|
|
|
15
15
|
if (result.error) {
|
|
16
16
|
if (result.error.code === "ENOENT") {
|
|
17
17
|
console.error(
|
|
18
|
-
"
|
|
18
|
+
"Creght CLI binary is missing. Reinstall creght-cli and try again.",
|
|
19
19
|
);
|
|
20
20
|
} else {
|
|
21
21
|
console.error(result.error.message);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "creght-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"description": "Creght CLI for syncing local site code with Creght.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/creght-dev/creght-cli#readme",
|
|
7
7
|
"repository": {
|
package/scripts/install.js
CHANGED
|
@@ -12,7 +12,7 @@ const checkOnly = process.argv.includes("--check");
|
|
|
12
12
|
|
|
13
13
|
if (checkOnly) {
|
|
14
14
|
const exists = fs.existsSync(binary);
|
|
15
|
-
console.log(`
|
|
15
|
+
console.log(`Creght CLI binary path for this platform: ${binary}`);
|
|
16
16
|
if (!exists) {
|
|
17
17
|
console.log("Binary is not present in this local checkout. CI adds release binaries before npm publish.");
|
|
18
18
|
}
|
|
@@ -21,7 +21,7 @@ if (checkOnly) {
|
|
|
21
21
|
|
|
22
22
|
if (!fs.existsSync(binary)) {
|
|
23
23
|
console.error(
|
|
24
|
-
`
|
|
24
|
+
`Creght CLI binary is missing for ${platform}-${arch}. Reinstall creght-cli and try again.`,
|
|
25
25
|
);
|
|
26
26
|
process.exit(1);
|
|
27
27
|
}
|
|
Binary file
|
package/vendor/darwin-x64/creght
CHANGED
|
Binary file
|
|
Binary file
|
package/vendor/linux-x64/creght
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/vite/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Plugin } from 'vite'
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type CreghtVitePluginOptions = {
|
|
4
4
|
/**
|
|
5
|
-
* Local
|
|
5
|
+
* Local Creght project root. Defaults to Vite's root.
|
|
6
6
|
*/
|
|
7
7
|
root?: string
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Creght API host used by the local /api proxy at runtime.
|
|
10
10
|
*/
|
|
11
11
|
apiHost?: string
|
|
12
12
|
/**
|
|
@@ -24,5 +24,5 @@ export type CreghVitePluginOptions = {
|
|
|
24
24
|
importMap?: Record<string, string>
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export declare function creght(options?:
|
|
27
|
+
export declare function creght(options?: CreghtVitePluginOptions): Plugin
|
|
28
28
|
export default creght
|
package/vite/index.js
CHANGED
|
@@ -77,7 +77,7 @@ const contentTypeForPath = (file) => {
|
|
|
77
77
|
const normalizeProjectPath = (value) => {
|
|
78
78
|
const out = path.posix.normalize('/' + value.replaceAll(path.sep, '/').replace(/^\/+/, ''))
|
|
79
79
|
if (out.startsWith('/../')) {
|
|
80
|
-
throw new Error(`unsafe
|
|
80
|
+
throw new Error(`unsafe Creght path: ${value}`)
|
|
81
81
|
}
|
|
82
82
|
return out
|
|
83
83
|
}
|
|
@@ -109,7 +109,7 @@ async function resolveFile(projectRoot, projectPath) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
throw new Error(`
|
|
112
|
+
throw new Error(`Creght module not found: ${projectPath}`)
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
async function readSiteConfig(projectRoot) {
|
|
@@ -338,7 +338,7 @@ async function renderPage() {
|
|
|
338
338
|
let props = {};
|
|
339
339
|
|
|
340
340
|
if (!Page) {
|
|
341
|
-
throw new Error('
|
|
341
|
+
throw new Error('Creght page has no default export: ${entryFile}');
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
if (typeof pageModule.getServerSideProps === 'function') {
|
|
@@ -367,7 +367,7 @@ hot.on('creght:update', () => {
|
|
|
367
367
|
async function renderHtml(projectRoot, pathname, options) {
|
|
368
368
|
const routes = await listPages(projectRoot)
|
|
369
369
|
if (routes.length === 0) {
|
|
370
|
-
return `<!doctype html><div style="font:14px system-ui;padding:24px">No
|
|
370
|
+
return `<!doctype html><div style="font:14px system-ui;padding:24px">No Creght pages found in <code>/page</code>.</div>`
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
const matched = matchRoute(routes, pathname)
|
|
@@ -380,7 +380,7 @@ async function renderHtml(projectRoot, pathname, options) {
|
|
|
380
380
|
<head>
|
|
381
381
|
<meta charset="UTF-8">
|
|
382
382
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
383
|
-
<title>${escapeHtml(matched.route === '/' ? '
|
|
383
|
+
<title>${escapeHtml(matched.route === '/' ? 'Creght' : matched.route)}</title>
|
|
384
384
|
<script type="importmap">${jsonScript({ imports })}</script>
|
|
385
385
|
<script type="module" src="/@vite/client"></script>
|
|
386
386
|
<style type="text/tailwindcss">${indexCss}</style>
|
|
@@ -408,7 +408,7 @@ export function creght(options = {}) {
|
|
|
408
408
|
},
|
|
409
409
|
configureServer(server) {
|
|
410
410
|
const hmrTimers = new Map()
|
|
411
|
-
const
|
|
411
|
+
const sendCreghtUpdate = (file) => {
|
|
412
412
|
if (!file.startsWith(projectRoot)) return
|
|
413
413
|
|
|
414
414
|
const projectPath = normalizeProjectPath(path.relative(projectRoot, file))
|
|
@@ -429,9 +429,9 @@ export function creght(options = {}) {
|
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
server.watcher.add(path.join(projectRoot, '**/*'))
|
|
432
|
-
server.watcher.on('change',
|
|
433
|
-
server.watcher.on('add',
|
|
434
|
-
server.watcher.on('unlink',
|
|
432
|
+
server.watcher.on('change', sendCreghtUpdate)
|
|
433
|
+
server.watcher.on('add', sendCreghtUpdate)
|
|
434
|
+
server.watcher.on('unlink', sendCreghtUpdate)
|
|
435
435
|
|
|
436
436
|
server.middlewares.use(async (req, res, next) => {
|
|
437
437
|
try {
|