feat(build): report the old files of the output folder, add -clean
All checks were successful
check / check (pull_request) Successful in 29s

A build never emptied the output folder, so the pages of a list that got shorter stayed
behind. The build now returns the files it did not write and the command prints a
warning that names them. -clean empties the folder first, only when it is new, empty or
holds the .motorino-out file that an earlier -clean left, and never the folder of the site
or one that holds it. The default is unchanged: no extra file in a folder built without it,
so the deploy (a new folder published with rsync --delete) is not affected.

Refs #9
This commit is contained in:
tgiachi 2026-11-16 12:49:17 +01:00
commit 52edb15b64

View file

@ -9,12 +9,15 @@ Licence: GPL-3.0-or-later, see `LICENSE`.
```
motorino build -site DIR -out DIR build the site in DIR into the output folder (defaults: . and public)
motorino build -drafts ... the same, with the drafts and the posts dated in the future, for a preview
motorino build -clean ... empty the output folder first, if it is new, empty or holds .motorino-out
motorino new -site DIR "A title" write news/a-title.md, a draft with the header ready, and print its path
motorino version print the version
```
The binary is a single static Go program. The version comes from semantic-release.
A build writes the files it makes and leaves the others in the output folder, so the pages of a list that got shorter (`news/page/3/`) stay behind. When that happens the command prints a warning that names the old files. The deploy never has them: it builds into a new folder and publishes it with `rsync --delete`. For a folder you reuse, `-clean` empties it first. It does that only for a folder that is new, empty or holds the `.motorino-out` file that an earlier `-clean` left, never for any other folder with files in it and never for the folder of the site or one that holds it. A build without `-clean` writes no extra file.
## What a site looks like
```