@dogsbay/ssg-cli 0.2.0-beta.186 → 0.2.0-beta.188
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/AGENTS.md +168 -0
- package/README.md +3 -1
- package/THIRD-PARTY-NOTICES.txt +23 -17
- package/chunks/{build-command-X76EICE4.mjs → build-command-NJATVOUY.mjs} +34 -25
- package/chunks/check-command-FL5O3AXB.mjs +577 -0
- package/chunks/chunk-2EM7IEQT.mjs +95 -0
- package/chunks/{chunk-JABACD5T.mjs → chunk-5A2QPRCV.mjs} +1 -30
- package/chunks/chunk-5NQOUB5I.mjs +4534 -0
- package/chunks/{chunk-YQ2K646L.mjs → chunk-CYJ6GFVM.mjs} +32 -3
- package/chunks/{chunk-XQORVEL6.mjs → chunk-FFIXBXHD.mjs} +60 -233
- package/chunks/chunk-GFG5I7WI.mjs +807 -0
- package/chunks/{chunk-AOHGXC4D.mjs → chunk-GZ3E45TE.mjs} +518 -240
- package/chunks/chunk-IAAKV7V2.mjs +37 -0
- package/chunks/{chunk-YA6TJOAM.mjs → chunk-VJ6AESSJ.mjs} +216 -24
- package/chunks/chunk-X3UPCLX5.mjs +503 -0
- package/chunks/{chunk-TRECVC6H.mjs → chunk-ZDH4JRVX.mjs} +1041 -4051
- package/chunks/{chunk-FNP5PNJW.mjs → chunk-ZRGJHNES.mjs} +6 -0
- package/chunks/compare-W4DJYVHT.mjs +239 -0
- package/chunks/compare-command-U36H55IE.mjs +144 -0
- package/chunks/{css-build-VKKTSP6P.mjs → css-build-MKIHYHCX.mjs} +2 -1
- package/chunks/{dev-DXMZPST7.mjs → dev-X3PKN4G3.mjs} +77 -26
- package/chunks/{menu-W7ZXME4A.mjs → menu-J3CLVADF.mjs} +5 -3
- package/chunks/{publish-command-AVMRM4UZ.mjs → publish-command-SAPICGGM.mjs} +15 -8
- package/chunks/{release-diff-3OZOYBXR.mjs → release-diff-Y7X63MT3.mjs} +13 -7
- package/chunks/{serve-U2YV7AQH.mjs → serve-7DR4WSYA.mjs} +2 -2
- package/cli.mjs +17 -10
- package/package.json +4 -3
- package/chunks/check-command-SXDUKSAZ.mjs +0 -256
package/AGENTS.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# dogsbay-ssg for AI assistants
|
|
2
|
+
|
|
3
|
+
How to write, check and build a Dogsbay documentation site with `dogsbay-ssg`. This file ships in the
|
|
4
|
+
`@dogsbay/ssg-cli` npm package and matches its version: `dogsbay-ssg --version` prints it. The
|
|
5
|
+
`dogsbay` package's AGENTS.md says the same for the Dogsbay CLI and its Astro build; the project
|
|
6
|
+
files are the same for both.
|
|
7
|
+
|
|
8
|
+
## Run the right command
|
|
9
|
+
|
|
10
|
+
| Task | Command |
|
|
11
|
+
|---|---|
|
|
12
|
+
| Build a project into a static site | `npx @dogsbay/ssg-cli@beta build <project> -o <out>` |
|
|
13
|
+
| Check the project and the built pages | `npx @dogsbay/ssg-cli@beta check <project>` |
|
|
14
|
+
| Preview a built site | `npx @dogsbay/ssg-cli@beta serve <out>` |
|
|
15
|
+
| Preview while editing (live reload) | `npx @dogsbay/ssg-cli@beta dev <project>` |
|
|
16
|
+
| Print the generator's version | `npx @dogsbay/ssg-cli@beta --version` |
|
|
17
|
+
|
|
18
|
+
- The command is named `dogsbay-ssg`, but the package is **`@dogsbay/ssg-cli`**. `npx dogsbay-ssg`
|
|
19
|
+
works only where that package is installed (`npm install --save-dev @dogsbay/ssg-cli@beta`).
|
|
20
|
+
`@dogsbay/ssg` is a library for browsers, not the command.
|
|
21
|
+
- Use `@beta` or an exact version (`@dogsbay/ssg-cli@0.2.0-beta.N`). If a build misreads a project,
|
|
22
|
+
check the version first: suspect an old generator before changing the project.
|
|
23
|
+
- `<command> --help` lists a command's options.
|
|
24
|
+
- The output works from a web server and from disk (`file://`). It needs no CDN. (With
|
|
25
|
+
`ssg.search: pagefind`, search works only from a web server.)
|
|
26
|
+
|
|
27
|
+
## Project layout
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
my-docs/
|
|
31
|
+
dogsbay.config.yml site settings (optional, but it is where the site's name goes)
|
|
32
|
+
content/
|
|
33
|
+
nav.yml the menu (sidebar); optional: without it the folders give the menu
|
|
34
|
+
index.md the home page
|
|
35
|
+
guides/
|
|
36
|
+
install.md
|
|
37
|
+
data/ optional: YAML, JSON or CSV that pages show with ::data-table
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Without `dogsbay.config.yml`, `content/` is the content folder if there is one, otherwise the project
|
|
41
|
+
folder is.
|
|
42
|
+
|
|
43
|
+
## dogsbay.config.yml
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
schemaVersion: 1
|
|
47
|
+
site:
|
|
48
|
+
name: Acme Docs # the site's name: site.name, never title:
|
|
49
|
+
description: Install and run Acme.
|
|
50
|
+
url: https://docs.acme.com # optional: canonical links, sitemap
|
|
51
|
+
content:
|
|
52
|
+
sources:
|
|
53
|
+
- path: ./content
|
|
54
|
+
redirects: # top level, not under site:
|
|
55
|
+
/old-page/: /guides/install/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- The site's name is `site.name`. `site.title`, a top-level `title:` and `site.redirects` are not
|
|
59
|
+
read; the build warns about them. The Dogsbay CLI refuses a config without `site.name`, so always set it.
|
|
60
|
+
- `site.url` is a full `https://` address. Without it the build makes no sitemap or canonical links,
|
|
61
|
+
and `check` fails with `seo/sitemap-present`. Set `site.url` if the site has an address; if it has
|
|
62
|
+
none (a local or artifact build), run `check <project> --skip seo/sitemap-present`.
|
|
63
|
+
- `basePath` (under `site:`) defaults to `""`, served from the root. Set it only when asked.
|
|
64
|
+
- Write `true` and `false`, not `yes` and `no`.
|
|
65
|
+
- Unknown keys are ignored. If a setting seems to do nothing, check its spelling and its section.
|
|
66
|
+
|
|
67
|
+
## content/nav.yml
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
- label: Overview
|
|
71
|
+
file: index.md
|
|
72
|
+
- label: Guides
|
|
73
|
+
children:
|
|
74
|
+
- label: Install
|
|
75
|
+
file: guides/install.md
|
|
76
|
+
- file: guides/configure.md # no label: the page's title
|
|
77
|
+
- label: GitHub
|
|
78
|
+
href: https://github.com/acme/acme
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- Fields: `label`, `file` (a path from this menu file's folder, with `.md`), `href` (a URL or a
|
|
82
|
+
site path), `children`, `include` (another menu file), `toc: false` (built, not in the menu),
|
|
83
|
+
`unlisted: true` (built, listed nowhere).
|
|
84
|
+
- The short form `- Install: guides/install.md` is read too, and the two forms mix.
|
|
85
|
+
- **Keep the menu file the project has.** Never convert `nav.yml` to `nav.json`, or one form into
|
|
86
|
+
the other, to make a build accept it. Both are read; with both present, `nav.yml` wins.
|
|
87
|
+
- A problem in the menu fails the build and names the file and line. Fix that entry; do not rewrite
|
|
88
|
+
the file.
|
|
89
|
+
|
|
90
|
+
## Pages
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
---
|
|
94
|
+
title: Install Acme
|
|
95
|
+
description: Install Acme on Linux, macOS or Windows.
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
Start the body here. The title is the page's heading, so the body starts at `##`.
|
|
99
|
+
|
|
100
|
+
## Requirements
|
|
101
|
+
|
|
102
|
+
- Linux, macOS or Windows.
|
|
103
|
+
- See [Configure](configure.md) next.
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
- `title` and `description` in front matter. `status: draft` keeps a page out of `build`; `dev`
|
|
107
|
+
still shows it.
|
|
108
|
+
- Link to other pages by their file: `[Configure](configure.md)` from the same folder, or
|
|
109
|
+
`[Configure](/guides/configure.md)` from the content folder's root. The build writes the site
|
|
110
|
+
address. Do not hand-write `/docs/guides/configure/`.
|
|
111
|
+
- Images go beside the page or in a folder under the content folder: ``.
|
|
112
|
+
- Files and folders whose names start with `_` are not pages: use them for includes.
|
|
113
|
+
|
|
114
|
+
## Markdown syntax
|
|
115
|
+
|
|
116
|
+
CommonMark and GitHub Flavored Markdown, plus `:::` directives:
|
|
117
|
+
|
|
118
|
+
````markdown
|
|
119
|
+
> [!WARNING]
|
|
120
|
+
> Back up first.
|
|
121
|
+
|
|
122
|
+
:::steps
|
|
123
|
+
1. **Download**
|
|
124
|
+
|
|
125
|
+
Get the archive.
|
|
126
|
+
|
|
127
|
+
2. **Install**
|
|
128
|
+
|
|
129
|
+
Run `./install.sh`.
|
|
130
|
+
:::
|
|
131
|
+
|
|
132
|
+
:::tabs
|
|
133
|
+
Linux
|
|
134
|
+
: ```bash
|
|
135
|
+
curl -fsSL https://get.acme.dev | sh
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
macOS
|
|
139
|
+
: ```bash
|
|
140
|
+
brew install acme
|
|
141
|
+
```
|
|
142
|
+
:::
|
|
143
|
+
|
|
144
|
+
Press :kbd[Ctrl+C] to stop.
|
|
145
|
+
````
|
|
146
|
+
|
|
147
|
+
- Callouts: `> [!NOTE]`, `> [!TIP]`, `> [!IMPORTANT]`, `> [!WARNING]`, `> [!CAUTION]`.
|
|
148
|
+
- Tabs are a definition list inside `:::tabs`: the tab's label on its own line, then `:` and the
|
|
149
|
+
content indented four spaces.
|
|
150
|
+
- Each `:::` block closes with its own `:::`. Inline directives take one colon (`:kbd[...]`).
|
|
151
|
+
- Give every code block its language.
|
|
152
|
+
- `dogsbay-ssg check <project>` reports Markdown it cannot read (`markdown/syntax`), with the file
|
|
153
|
+
and line.
|
|
154
|
+
|
|
155
|
+
## Publishing elsewhere
|
|
156
|
+
|
|
157
|
+
To publish the site as a claude.ai artifact, run `npx @dogsbay/ssg-cli@beta check <project> --artifact`
|
|
158
|
+
first: each message says what to change. Two of its errors are expected: `_headers` and `_redirects`
|
|
159
|
+
are files for Cloudflare and Netlify, so leave them out of the upload. Fix `_dogsbay/` with
|
|
160
|
+
`ssg.assetsFolder` and build again, not by renaming it in the output.
|
|
161
|
+
|
|
162
|
+
## Mistakes to avoid
|
|
163
|
+
|
|
164
|
+
- `title:` for the site's name (it is `site.name`), or `redirects` under `site:`.
|
|
165
|
+
- `npx dogsbay-ssg` without installing `@dogsbay/ssg-cli`.
|
|
166
|
+
- Rewriting a menu file, or changing its format, instead of fixing the entry the build names.
|
|
167
|
+
- Absolute `/docs/...` links to the site's own pages (link the `.md` file).
|
|
168
|
+
- Raw HTML for layout: use the directives.
|
package/README.md
CHANGED
|
@@ -15,7 +15,9 @@ npm install --save-dev @dogsbay/ssg-cli@beta
|
|
|
15
15
|
npx dogsbay-ssg dev # live reload while you edit
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Node 20 or later.
|
|
18
|
+
Node 20 or later. `dogsbay-ssg --version` prints the version.
|
|
19
|
+
|
|
20
|
+
AI assistants: read `AGENTS.md` in this package before writing or building a project. It matches this version.
|
|
19
21
|
|
|
20
22
|
## Commands
|
|
21
23
|
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
Third-party software in dist/cli.mjs and its chunks
|
|
2
2
|
|
|
3
3
|
========================================================================
|
|
4
|
-
@dogsbay/corpus@0.2.0-beta.
|
|
4
|
+
@dogsbay/corpus@0.2.0-beta.188 (MIT)
|
|
5
5
|
https://github.com/dogsbay/dogsbay.git
|
|
6
6
|
|
|
7
7
|
Licensed under MIT; the package ships no licence file.
|
|
8
8
|
|
|
9
9
|
========================================================================
|
|
10
|
-
@dogsbay/detect@0.2.0-beta.
|
|
10
|
+
@dogsbay/detect@0.2.0-beta.188 (MIT)
|
|
11
11
|
https://github.com/dogsbay/dogsbay.git
|
|
12
12
|
|
|
13
13
|
Licensed under MIT; the package ships no licence file.
|
|
14
14
|
|
|
15
15
|
========================================================================
|
|
16
|
-
@dogsbay/elements@0.2.0-beta.
|
|
16
|
+
@dogsbay/elements@0.2.0-beta.188 (MIT)
|
|
17
17
|
https://github.com/dogsbay/dogsbay.git
|
|
18
18
|
|
|
19
19
|
Licensed under MIT; the package ships no licence file.
|
|
20
20
|
|
|
21
21
|
========================================================================
|
|
22
|
-
@dogsbay/format-dogsbay-md@0.2.0-beta.
|
|
22
|
+
@dogsbay/format-dogsbay-md@0.2.0-beta.188 (MIT)
|
|
23
23
|
https://github.com/dogsbay/dogsbay.git
|
|
24
24
|
|
|
25
25
|
Licensed under MIT; the package ships no licence file.
|
|
26
26
|
|
|
27
27
|
========================================================================
|
|
28
|
-
@dogsbay/format-openapi@0.2.0-beta.
|
|
28
|
+
@dogsbay/format-openapi@0.2.0-beta.188 (MIT)
|
|
29
29
|
https://github.com/dogsbay/dogsbay.git
|
|
30
30
|
|
|
31
31
|
Licensed under MIT; the package ships no licence file.
|
|
32
32
|
|
|
33
33
|
========================================================================
|
|
34
|
-
@dogsbay/format-topicmap@0.2.0-beta.
|
|
34
|
+
@dogsbay/format-topicmap@0.2.0-beta.188 (MIT)
|
|
35
35
|
https://github.com/dogsbay/dogsbay.git
|
|
36
36
|
|
|
37
37
|
Licensed under MIT; the package ships no licence file.
|
|
38
38
|
|
|
39
39
|
========================================================================
|
|
40
|
-
@dogsbay/highlight@0.2.0-beta.
|
|
40
|
+
@dogsbay/highlight@0.2.0-beta.188 (MIT)
|
|
41
41
|
https://github.com/dogsbay/dogsbay.git
|
|
42
42
|
|
|
43
43
|
Licensed under MIT; the package ships no licence file.
|
|
44
44
|
|
|
45
45
|
========================================================================
|
|
46
|
-
@dogsbay/icons@0.2.0-beta.
|
|
46
|
+
@dogsbay/icons@0.2.0-beta.188 (MIT)
|
|
47
47
|
https://github.com/dogsbay/dogsbay.git
|
|
48
48
|
|
|
49
49
|
Licensed under MIT; the package ships no licence file.
|
|
50
50
|
|
|
51
51
|
========================================================================
|
|
52
|
-
@dogsbay/minja@0.2.0-beta.
|
|
52
|
+
@dogsbay/minja@0.2.0-beta.188 (MIT)
|
|
53
53
|
|
|
54
54
|
MIT License
|
|
55
55
|
|
|
@@ -74,49 +74,55 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
74
74
|
SOFTWARE.
|
|
75
75
|
|
|
76
76
|
========================================================================
|
|
77
|
-
@dogsbay/primitives@0.2.0-beta.
|
|
77
|
+
@dogsbay/primitives@0.2.0-beta.188 (MIT)
|
|
78
78
|
https://github.com/dogsbay/dogsbay.git
|
|
79
79
|
|
|
80
80
|
Licensed under MIT; the package ships no licence file.
|
|
81
81
|
|
|
82
82
|
========================================================================
|
|
83
|
-
@dogsbay/render-html@0.2.0-beta.
|
|
83
|
+
@dogsbay/render-html@0.2.0-beta.188 (MIT)
|
|
84
84
|
https://github.com/dogsbay/dogsbay.git
|
|
85
85
|
|
|
86
86
|
Licensed under MIT; the package ships no licence file.
|
|
87
87
|
|
|
88
88
|
========================================================================
|
|
89
|
-
@dogsbay/search@0.2.0-beta.
|
|
89
|
+
@dogsbay/search@0.2.0-beta.188 (MIT)
|
|
90
90
|
https://github.com/dogsbay/dogsbay.git
|
|
91
91
|
|
|
92
92
|
Licensed under MIT; the package ships no licence file.
|
|
93
93
|
|
|
94
94
|
========================================================================
|
|
95
|
-
@dogsbay/serialize-core@0.2.0-beta.
|
|
95
|
+
@dogsbay/serialize-core@0.2.0-beta.188 (MIT)
|
|
96
96
|
https://github.com/dogsbay/dogsbay.git
|
|
97
97
|
|
|
98
98
|
Licensed under MIT; the package ships no licence file.
|
|
99
99
|
|
|
100
100
|
========================================================================
|
|
101
|
-
@dogsbay/site-check@0.2.0-beta.
|
|
101
|
+
@dogsbay/site-check@0.2.0-beta.188 (MIT)
|
|
102
102
|
https://github.com/dogsbay/dogsbay.git
|
|
103
103
|
|
|
104
104
|
Licensed under MIT; the package ships no licence file.
|
|
105
105
|
|
|
106
106
|
========================================================================
|
|
107
|
-
@dogsbay/site-files@0.2.0-beta.
|
|
107
|
+
@dogsbay/site-files@0.2.0-beta.188 (MIT)
|
|
108
108
|
https://github.com/dogsbay/dogsbay.git
|
|
109
109
|
|
|
110
110
|
Licensed under MIT; the package ships no licence file.
|
|
111
111
|
|
|
112
112
|
========================================================================
|
|
113
|
-
@dogsbay/
|
|
113
|
+
@dogsbay/tree-diff@0.2.0-beta.188 (MIT)
|
|
114
114
|
https://github.com/dogsbay/dogsbay.git
|
|
115
115
|
|
|
116
116
|
Licensed under MIT; the package ships no licence file.
|
|
117
117
|
|
|
118
118
|
========================================================================
|
|
119
|
-
@dogsbay/
|
|
119
|
+
@dogsbay/types@0.2.0-beta.188 (MIT)
|
|
120
|
+
https://github.com/dogsbay/dogsbay.git
|
|
121
|
+
|
|
122
|
+
Licensed under MIT; the package ships no licence file.
|
|
123
|
+
|
|
124
|
+
========================================================================
|
|
125
|
+
@dogsbay/ui@0.2.0-beta.188 (MIT)
|
|
120
126
|
https://github.com/dogsbay/dogsbay.git
|
|
121
127
|
|
|
122
128
|
Licensed under MIT; the package ships no licence file.
|
|
@@ -7,40 +7,47 @@ import {
|
|
|
7
7
|
} from "./chunk-OBUK53NJ.mjs";
|
|
8
8
|
import {
|
|
9
9
|
build,
|
|
10
|
-
|
|
10
|
+
selectUnits
|
|
11
|
+
} from "./chunk-ZDH4JRVX.mjs";
|
|
12
|
+
import "./chunk-CYJ6GFVM.mjs";
|
|
13
|
+
import "./chunk-2EM7IEQT.mjs";
|
|
14
|
+
import {
|
|
11
15
|
fileSink,
|
|
12
|
-
parseConfig,
|
|
13
16
|
prepareOut,
|
|
14
|
-
projectRoots,
|
|
15
17
|
readBuildFiles,
|
|
16
18
|
readManifests,
|
|
17
19
|
removeStaleUnitFiles,
|
|
18
|
-
selectUnits,
|
|
19
20
|
unitFilesOf
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import
|
|
21
|
+
} from "./chunk-X3UPCLX5.mjs";
|
|
22
|
+
import "./chunk-GFG5I7WI.mjs";
|
|
23
|
+
import {
|
|
24
|
+
buildUnits,
|
|
25
|
+
parseConfig,
|
|
26
|
+
projectRoots
|
|
27
|
+
} from "./chunk-5NQOUB5I.mjs";
|
|
28
|
+
import "./chunk-GZ3E45TE.mjs";
|
|
23
29
|
import {
|
|
24
30
|
UNTRUSTED_DATA_LIMITS
|
|
25
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-VJ6AESSJ.mjs";
|
|
26
32
|
import {
|
|
27
|
-
FAILING_CODES,
|
|
28
33
|
UsageError,
|
|
29
34
|
dataProblemLines,
|
|
30
35
|
flag,
|
|
31
36
|
option,
|
|
32
|
-
positional
|
|
33
|
-
|
|
37
|
+
positional,
|
|
38
|
+
warningsToShow
|
|
39
|
+
} from "./chunk-ZRGJHNES.mjs";
|
|
34
40
|
import "./chunk-YVSP26OS.mjs";
|
|
35
41
|
import "./chunk-O3R3MASP.mjs";
|
|
36
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-IAAKV7V2.mjs";
|
|
43
|
+
import "./chunk-5A2QPRCV.mjs";
|
|
37
44
|
import "./chunk-G6OTOD3B.mjs";
|
|
38
45
|
import {
|
|
39
46
|
__require
|
|
40
47
|
} from "./chunk-STRHO6SY.mjs";
|
|
41
48
|
|
|
42
49
|
// src/node/build-command.ts
|
|
43
|
-
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
50
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, statSync } from "node:fs";
|
|
44
51
|
import { join as join3, resolve as resolve2, sep } from "node:path";
|
|
45
52
|
|
|
46
53
|
// src/node/highlight-pool.ts
|
|
@@ -305,21 +312,23 @@ async function runBuild(args, highlightWorker, mode = {}) {
|
|
|
305
312
|
if (asWorker && flag(args, "--low-memory")) throw new UsageError("--as-worker uses the Worker's memory settings: drop --low-memory");
|
|
306
313
|
const untrusted = flag(args, "--untrusted") || asWorker;
|
|
307
314
|
const memory = asWorker ? { ...WORKER_BUILD_SETTINGS, templateMs: PUBLISHED_TEMPLATE_MS } : cliMemorySettings(flag(args, "--low-memory"));
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
315
|
+
if (mode.prepared && (units.length || update || cacheOpt.length)) throw new UsageError("--unit, --update and --cache build a project folder");
|
|
316
|
+
const project = mode.prepared ? mode.prepared.root : resolve2(positional(args, "."));
|
|
317
|
+
if (!mode.prepared && !(existsSync2(project) && statSync(project).isDirectory())) throw new UsageError(`${project} is not a folder`);
|
|
318
|
+
const cfgPath = mode.prepared ? void 0 : ["dogsbay.config.yml", "dogsbay.config.yaml"].map((f) => join3(project, f)).find(existsSync2);
|
|
319
|
+
const cfgText = mode.prepared ? mode.prepared.config : cfgPath ? readFileSync2(cfgPath, "utf8") : void 0;
|
|
311
320
|
const cfg = parseConfig(cfgText, {
|
|
312
321
|
...pretty ? { linkStyle: "pretty" } : {},
|
|
313
322
|
...noSearch ? { search: false } : {},
|
|
314
323
|
// --search turns search on with that engine, whatever the config says (--no-search still wins).
|
|
315
324
|
...engine && !noSearch ? { search: true, searchEngine: engine } : {}
|
|
316
325
|
});
|
|
317
|
-
if (!cfgPath && !existsSync2(join3(project, "content"))) cfg.sources = [{ path: "." }];
|
|
326
|
+
if (!mode.prepared && !cfgPath && !existsSync2(join3(project, "content"))) cfg.sources = [{ path: "." }];
|
|
318
327
|
const t0 = performance.now();
|
|
319
328
|
const out = resolve2(outOpt ?? join3(project, "out"));
|
|
320
329
|
const cacheDir = cacheOpt[0] ? resolve2(cacheOpt[0]) : void 0;
|
|
321
330
|
if (cacheDir) checkCacheDir(cacheDir, out, project, cfg, untrusted);
|
|
322
|
-
const { files } = await readBuildFiles(project, cfg, cacheDir ? [out, cacheDir] : [out], untrusted);
|
|
331
|
+
const { files } = mode.prepared ? { files: mode.prepared.files } : await readBuildFiles(project, cfg, cacheDir ? [out, cacheDir] : [out], untrusted);
|
|
323
332
|
const tRead = performance.now() - t0;
|
|
324
333
|
if (process.env.DOGSBAY_MEM) {
|
|
325
334
|
globalThis.gc?.();
|
|
@@ -331,10 +340,10 @@ async function runBuild(args, highlightWorker, mode = {}) {
|
|
|
331
340
|
}
|
|
332
341
|
let previous;
|
|
333
342
|
if (update) {
|
|
334
|
-
if (!existsSync2(join3(out,
|
|
335
|
-
previous = readManifests(out);
|
|
336
|
-
if (!previous.length) throw new Error(`${out} has no unit manifests (
|
|
337
|
-
} else prepareOut(out, force);
|
|
343
|
+
if (!existsSync2(join3(out, cfg.assetsFolder))) throw new Error(`${out} is not a dogsbay-ssg build to update; build the whole site there first`);
|
|
344
|
+
previous = readManifests(out, cfg.assetsFolder);
|
|
345
|
+
if (!previous.length) throw new Error(`${out} has no unit manifests (${cfg.assetsFolder}/units/): a site of two or more units writes them when it is built whole; build it there first (a site of one unit needs no --update)`);
|
|
346
|
+
} else prepareOut(out, force, cfg.assetsFolder);
|
|
338
347
|
const previousFiles = previous && new Map(previous.map((m) => [m.path, unitFilesOf(m.text)]));
|
|
339
348
|
const written = /* @__PURE__ */ new Set();
|
|
340
349
|
const sink = fileSink(out);
|
|
@@ -376,11 +385,11 @@ async function runBuild(args, highlightWorker, mode = {}) {
|
|
|
376
385
|
await pool?.close();
|
|
377
386
|
if (pool && threadsDead) console.warn(`warn ${threadsDead} of ${pool.threads} highlight threads failed; their blocks were highlighted on the main thread`);
|
|
378
387
|
const pfStats = await pf?.finish(out);
|
|
379
|
-
const removed = previousFiles ? removeStaleUnitFiles(out, previousFiles, written) : 0;
|
|
388
|
+
const removed = previousFiles ? removeStaleUnitFiles(out, previousFiles, written, cfg.assetsFolder) : 0;
|
|
380
389
|
const treesRemoved = trees && !units.length && !mode.assemble ? trees.removeUnused() : 0;
|
|
381
390
|
const errors = dataProblemLines(result.problems);
|
|
382
|
-
const warnings = result.warnings.
|
|
383
|
-
const shown = quiet ? 0 : allWarnings ? warnings.length : 50;
|
|
391
|
+
const { warnings, siteWide } = warningsToShow(result.warnings, result.problems.map((p) => p.code));
|
|
392
|
+
const shown = quiet ? 0 : allWarnings ? warnings.length : Math.max(50, siteWide);
|
|
384
393
|
for (const w of warnings.slice(0, shown)) console.warn(`warn ${w}`);
|
|
385
394
|
if (warnings.length > shown && !quiet) console.warn(`\u2026 ${warnings.length - shown} more warnings (--all-warnings to list them)`);
|
|
386
395
|
for (const e of errors) console.error(`error ${e}`);
|