uniweb 1.24.5 → 1.24.7
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/package.json +4 -4
- package/partials/agents.md +2 -0
- package/partials/start.md +12 -2
- package/src/backend/foundation-bring-along.js +29 -1
- package/src/backend/site-sync.js +26 -4
- package/src/commands/doctor.js +8 -4
- package/src/commands/publish.js +13 -1
- package/src/commands/pull.js +28 -7
- package/src/commands/push.js +5 -3
- package/src/commands/start.js +1 -0
- package/src/framework-index.json +3 -3
- package/src/index.js +138 -1
- package/src/utils/sync-point.js +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.7",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "^7.5.21",
|
|
44
44
|
"@uniweb/core": "~1.5.1",
|
|
45
|
-
"@uniweb/schemas": "~1.6.7",
|
|
46
45
|
"@uniweb/semantic-parser": "~1.13.0",
|
|
47
|
-
"@uniweb/content-writer": "~1.3.1"
|
|
46
|
+
"@uniweb/content-writer": "~1.3.1",
|
|
47
|
+
"@uniweb/schemas": "~1.6.7"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@uniweb/build": "~1.13.
|
|
50
|
+
"@uniweb/build": "~1.13.3",
|
|
51
51
|
"@uniweb/semantic-parser": "~1.13.0",
|
|
52
52
|
"@uniweb/content-reader": "~1.5.7"
|
|
53
53
|
},
|
package/partials/agents.md
CHANGED
|
@@ -43,6 +43,8 @@ uniweb <command> --help # exact flags, always current — no side effects
|
|
|
43
43
|
uniweb doctor # diagnose project configuration (--fix to repair)
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
Commands are written `uniweb <command>` throughout this guide. Without a global install, run them in the project as `npx uniweb <command>`.
|
|
47
|
+
|
|
46
48
|
`uniweb inspect` is the important one for content. Every parse rule in Part 3 is faster to *confirm* than to re-derive, and re-deriving from memory is where agents go wrong. Don't predict the shape — print it.
|
|
47
49
|
|
|
48
50
|
`uniweb status` is the one for a project other people edit. A site in the Uniweb app can change there at any time, teammates push to git, and Uniweb releases often. Run it when you begin, when you come back to the project, before you push, publish or deploy, and after a command refuses: it changes nothing, opens with what the site is — synced where, live where — and ends with the commands to run, in order (`--json` for a script).
|
package/partials/start.md
CHANGED
|
@@ -28,7 +28,9 @@ prints an address to finish something in a browser, open it for them and say wha
|
|
|
28
28
|
for.
|
|
29
29
|
|
|
30
30
|
Uniweb needs Node.js 22.12 or later. If `node --version` shows an older one, install a
|
|
31
|
-
current one yourself.
|
|
31
|
+
current one yourself. Install Git too if `git --version` fails: it keeps the history of
|
|
32
|
+
your work, and it's what lets edits made in the app merge with yours. On a Mac, that
|
|
33
|
+
check can open a window offering the developer tools: tell them to accept it.
|
|
32
34
|
|
|
33
35
|
## Work with them
|
|
34
36
|
|
|
@@ -43,6 +45,8 @@ current one yourself.
|
|
|
43
45
|
- Keep anything they may want to change in markdown or in a param its `meta.js` declares,
|
|
44
46
|
not in a component's code. That is what they can edit in the app.
|
|
45
47
|
- Show them the site on their computer before you ask them to sign in.
|
|
48
|
+
- Commit each time something works, with a message that says what changed, so either of
|
|
49
|
+
you can go back to it.
|
|
46
50
|
{{#unless project}}
|
|
47
51
|
{{#if nearby}}
|
|
48
52
|
|
|
@@ -87,7 +91,7 @@ cd <name>
|
|
|
87
91
|
`<name>` is lowercase letters, digits and hyphens. `create .` takes its name from the
|
|
88
92
|
folder, or from `--name <name>`, replaces a `README.md` or `.gitignore` already there, and
|
|
89
93
|
stops if any other file is in its way. `create` asks no questions when it runs without a
|
|
90
|
-
terminal.
|
|
94
|
+
terminal, and starts the project's git repository.
|
|
91
95
|
{{/if}}
|
|
92
96
|
|
|
93
97
|
{{#if starter}}
|
|
@@ -95,6 +99,12 @@ terminal.
|
|
|
95
99
|
convention, to replace as you build. `--template none` is the same project without them.
|
|
96
100
|
{{else if none}}
|
|
97
101
|
`none` is a project with no section types or pages: you build them all.
|
|
102
|
+
{{else if paste}}
|
|
103
|
+
`paste` runs a React design as it is: replace `src/sections/App.jsx` with theirs, and the
|
|
104
|
+
site shows it. A picture or a web address you rebuild there instead. That is only the
|
|
105
|
+
start, because they can edit in the app only what has left the code. Take it apart as
|
|
106
|
+
[Converting Existing Designs](https://uniweb.io/docs/development/converting-existing.md)
|
|
107
|
+
says: named section types, their text in markdown, its colors in `theme.yml`.
|
|
98
108
|
{{else}}
|
|
99
109
|
`{{template}}` is a working site: its section types are in `src/`, its sample content in
|
|
100
110
|
`site/`. Keep what fits, replace all the sample content with what they asked for, and
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
54
|
import { readFileSync } from 'node:fs'
|
|
55
|
-
import { join } from 'node:path'
|
|
55
|
+
import { join, relative } from 'node:path'
|
|
56
56
|
import { execFileSync } from 'node:child_process'
|
|
57
57
|
|
|
58
58
|
import {
|
|
@@ -65,6 +65,7 @@ import {
|
|
|
65
65
|
import { computeFoundationDigest } from '../utils/code-upload.js'
|
|
66
66
|
import { isNonInteractive } from '../utils/interactive.js'
|
|
67
67
|
import { readOrgFlag } from '../utils/args.js'
|
|
68
|
+
import { repoOf, uncommittedPaths } from '../utils/sync-point.js'
|
|
68
69
|
import { belongsToScope } from '../utils/registry-orgs.js'
|
|
69
70
|
import { writeJsonPreservingStyle } from '../utils/json-file.js'
|
|
70
71
|
import {
|
|
@@ -150,6 +151,33 @@ export function resolveLocalExtensions(siteDir, siteYml) {
|
|
|
150
151
|
return out
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* ⭐ WHAT A RELEASE WRITES, A PUSH COMMITS (`commitWriteBacks`). Bringing local code along writes
|
|
157
|
+
* into it: the scope it registered under into its name (`main.js`), the next version into its
|
|
158
|
+
* `package.json`. These are those files, relative to the site, where git holds them as they
|
|
159
|
+
* stand. Asked before the release, so a file holding the person's own edits stays theirs to commit.
|
|
160
|
+
*
|
|
161
|
+
* ⛔ Until 2026-10-30 they were left out, so a first push, even with `--commit`, left the project
|
|
162
|
+
* with `main.js` changed. Measured from a fresh scaffold, on every template tried.
|
|
163
|
+
*
|
|
164
|
+
* @param {string} siteDir
|
|
165
|
+
* @param {object} siteYml - parsed site.yml
|
|
166
|
+
* @returns {Promise<string[]>}
|
|
167
|
+
*/
|
|
168
|
+
export async function filesAReleaseWrites(siteDir, siteYml) {
|
|
169
|
+
const repo = repoOf(siteDir)
|
|
170
|
+
if (!repo?.head) return []
|
|
171
|
+
const local = [resolveLocalFoundation(siteDir, siteYml), ...resolveLocalExtensions(siteDir, siteYml)].filter(Boolean)
|
|
172
|
+
const files = []
|
|
173
|
+
for (const { dir } of local) {
|
|
174
|
+
const main = await readFoundationName(dir).then((r) => r.mainFile, () => null)
|
|
175
|
+
if (main) files.push(main)
|
|
176
|
+
files.push(join(dir, 'package.json'))
|
|
177
|
+
}
|
|
178
|
+
return files.map((file) => relative(siteDir, file)).filter((file) => uncommittedPaths(repo, [file])?.length === 0)
|
|
179
|
+
}
|
|
180
|
+
|
|
153
181
|
/**
|
|
154
182
|
* The foundation's scoped catalog name (`@org/name`): its name — `main.js`'s
|
|
155
183
|
* `name`, else package.json's, the one rule the build reads for the schema
|
package/src/backend/site-sync.js
CHANGED
|
@@ -160,7 +160,8 @@ async function explainStaleSiteContent({ client, siteDir, localBuffer, uuid }) {
|
|
|
160
160
|
const localDoc = entityDocFromUwx(localBuffer)
|
|
161
161
|
if (!remoteDoc || !localDoc) return []
|
|
162
162
|
return describeSiteDiff(
|
|
163
|
-
diffSiteUnits(localDoc, remoteDoc, readUnitBases(siteDir, client.origin))
|
|
163
|
+
diffSiteUnits(localDoc, remoteDoc, readUnitBases(siteDir, client.origin)),
|
|
164
|
+
{ label: (unit) => unitFilesOf(siteDir, unit)[0] ?? unit }
|
|
164
165
|
)
|
|
165
166
|
} catch {
|
|
166
167
|
return []
|
|
@@ -1062,6 +1063,15 @@ export function uncommittedContent(siteDir, { verb = 'push' } = {}) {
|
|
|
1062
1063
|
}
|
|
1063
1064
|
}
|
|
1064
1065
|
|
|
1066
|
+
/**
|
|
1067
|
+
* Whether a publish may commit its record, `deploy.yml`: git holds it as it stands, or it isn't
|
|
1068
|
+
* there yet. A file holding the person's own edits stays theirs to commit.
|
|
1069
|
+
*/
|
|
1070
|
+
export function deployRecordAtRest(siteDir) {
|
|
1071
|
+
const repo = repoOf(siteDir)
|
|
1072
|
+
return Boolean(repo?.head) && uncommittedPaths(repo, ['deploy.yml'])?.length === 0
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1065
1075
|
/** Says what `commitWriteBacks` committed, or that it could not. */
|
|
1066
1076
|
export function reportWriteBacks(made, { note }) {
|
|
1067
1077
|
if (!made) return
|
|
@@ -1100,9 +1110,16 @@ export function commitSiteContent(siteDir, { message }) {
|
|
|
1100
1110
|
* ⛔ Until 2026-10-18 they were left to the person to commit, and a project pushed once and
|
|
1101
1111
|
* not committed after had no `sync.json` in the history its clones got.
|
|
1102
1112
|
*
|
|
1113
|
+
* @param {string} siteDir
|
|
1114
|
+
* @param {string} backend
|
|
1115
|
+
* @param {object} [o]
|
|
1116
|
+
* @param {boolean} [o.complete] - every lane landed, so the commit is this copy's sync point
|
|
1117
|
+
* @param {string[]} [o.released] - what the release wrote into local code (`filesAReleaseWrites`)
|
|
1118
|
+
* @param {string[]} [o.only] - these files alone, for a pull or a publish's record: what else
|
|
1119
|
+
* differs under the site is the person's, not a push's
|
|
1103
1120
|
* @returns {{ commit: string, paths: string[] } | { error: string } | null}
|
|
1104
1121
|
*/
|
|
1105
|
-
export function commitWriteBacks(siteDir, backend, { complete = false } = {}) {
|
|
1122
|
+
export function commitWriteBacks(siteDir, backend, { complete = false, released = [], only = null } = {}) {
|
|
1106
1123
|
const repo = repoOf(siteDir)
|
|
1107
1124
|
if (!repo?.head || mergeInProgress(repo)) return null
|
|
1108
1125
|
let host = 'backend'
|
|
@@ -1121,7 +1138,7 @@ export function commitWriteBacks(siteDir, backend, { complete = false } = {}) {
|
|
|
1121
1138
|
// ⭐ Marked with the backend and the site, so a pull reads the commit a lane names through
|
|
1122
1139
|
// it (`recordedAfter`, utils/sync-point.js): the ids written back are what the backend holds.
|
|
1123
1140
|
const site = readBackendState(siteDir, backend).site?.uuid
|
|
1124
|
-
const made = commitRoots(repo, [...sentRoots(siteDir), SYNC_STORE_FILE], {
|
|
1141
|
+
const made = commitRoots(repo, only || [...sentRoots(siteDir), SYNC_STORE_FILE, ...released], {
|
|
1125
1142
|
message: `Record what ${backend} gave the site${site ? `\n\n${RECORDED_TRAILER}: ${backend} ${site}` : ''}`,
|
|
1126
1143
|
identity
|
|
1127
1144
|
})
|
|
@@ -1980,12 +1997,17 @@ export async function entityHashes(siteDir, backend = null, { declarations, fiel
|
|
|
1980
1997
|
* @param {Map<string,object>} [opts.declarations] - the Models the pull read, by name — so a
|
|
1981
1998
|
* site whose foundation is not in the project (a clone's) can be re-banked offline
|
|
1982
1999
|
*/
|
|
1983
|
-
export async function rebankSyncHashes(siteDir, backend = null, { recordDocs, declarations, fields = null } = {}) {
|
|
2000
|
+
export async function rebankSyncHashes(siteDir, backend = null, { recordDocs, declarations, fields = null, contentTaken = false } = {}) {
|
|
1984
2001
|
// ⛔ With the keys this deployment's Sections take, when the caller has them (`deploymentFields`):
|
|
1985
2002
|
// they shape the document the next push sends (`typed_by_data_key`, `og_title`), so a hash banked
|
|
1986
2003
|
// without them marks a clone's first push as changed. Until 2026-09-26 a pull banked none.
|
|
1987
2004
|
const pkg = await comparisonEmit(siteDir, { backend, sendAll: true, declarations, fields })
|
|
1988
2005
|
writeSyncCache(siteDir, backend, onlyWhatThePullTook(siteDir, backend, pkg, recordDocs), pkg.applied || {})
|
|
2006
|
+
// ⭐ And the local unit base, from what this copy would send for the content the pull took, so a
|
|
2007
|
+
// refusal after a pull can tell this copy's edits from the backend's. ⛔ Until 2026-10-30 a pull
|
|
2008
|
+
// left it empty, and the next refusal said "No record of your last sync" just after one.
|
|
2009
|
+
const sendsNow = contentTaken && pkg.siteContent ? entityDocFromUwx(pkg.siteContent.buffer) : null
|
|
2010
|
+
if (sendsNow) writeUnitBases(siteDir, backend, { local: computeUnitHashes(sendsNow) })
|
|
1989
2011
|
// ⭐ And the identity of the records' list items, from the documents the pull just took:
|
|
1990
2012
|
// the files it wrote hold the stored items in stored order, so the emit over them pairs
|
|
1991
2013
|
// with each document item for item.
|
package/src/commands/doctor.js
CHANGED
|
@@ -561,9 +561,10 @@ export async function checkFoundationSupports({
|
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
+
// A note, not a warning: nothing is broken (above), and `uniweb status` asks for a read of each warning.
|
|
564
565
|
issues.push({
|
|
565
566
|
id,
|
|
566
|
-
type: '
|
|
567
|
+
type: 'info',
|
|
567
568
|
foundation: foundationName,
|
|
568
569
|
message: hasDeclaration
|
|
569
570
|
? `${foundationName} builds against ${list} but does not declare ${missing.length === 1 ? 'it' : 'them'} in uniweb.supports`
|
|
@@ -572,7 +573,7 @@ export async function checkFoundationSupports({
|
|
|
572
573
|
fixable: true,
|
|
573
574
|
})
|
|
574
575
|
|
|
575
|
-
|
|
576
|
+
info(`[${id}] ${foundationName} builds against ${list}, not in ${folderName}/package.json`)
|
|
576
577
|
log(` The build already publishes ${colors.dim}${derived.join(', ')}${colors.reset}, so nothing is missing on the wire.`)
|
|
577
578
|
log(` Declaring it matters when a service is named by a computed value — the`)
|
|
578
579
|
log(` build cannot see those, and yours is the only place they can be added.`)
|
|
@@ -1083,14 +1084,17 @@ export async function checkSiteAddress({ sitePath, siteName, siteYml, workspaceD
|
|
|
1083
1084
|
}
|
|
1084
1085
|
}
|
|
1085
1086
|
|
|
1087
|
+
// ⭐ A warning once a host is named that does not state it. With none named yet the site may well
|
|
1088
|
+
// go to one that does, so it is a note. ⛔ Until 2026-10-30 every new project got the warning,
|
|
1089
|
+
// and an agent told to read it had no address to give but an invented one.
|
|
1086
1090
|
const id = 'site-address-unknown'
|
|
1087
1091
|
issues.push({
|
|
1088
1092
|
id,
|
|
1089
|
-
type: 'warn',
|
|
1093
|
+
type: host ? 'warn' : 'info',
|
|
1090
1094
|
site: siteName,
|
|
1091
1095
|
message: 'The site states no address: no canonical URLs, no sitemap.xml, a root-relative llms.txt and og:image'
|
|
1092
1096
|
})
|
|
1093
|
-
warn(`[${id}] Nothing states where this site is served`)
|
|
1097
|
+
;(host ? warn : info)(`[${id}] Nothing states where this site is served`)
|
|
1094
1098
|
log(` Set ${colors.green}seo.origin${colors.reset} in site.yml — the origin it is served from, e.g. https://example.com`)
|
|
1095
1099
|
log(` ${colors.dim}A host that states it needs none: the GitHub Pages workflow \`uniweb add ci\` writes, Netlify, Vercel.${colors.reset}`)
|
|
1096
1100
|
log(` ${colors.dim}${without}${colors.reset}`)
|
package/src/commands/publish.js
CHANGED
|
@@ -109,6 +109,7 @@ import {
|
|
|
109
109
|
untakenBase,
|
|
110
110
|
unsettledFiles,
|
|
111
111
|
commitWriteBacks,
|
|
112
|
+
deployRecordAtRest,
|
|
112
113
|
reportWriteBacks,
|
|
113
114
|
pushSyncPackages,
|
|
114
115
|
readSiteWorkspace
|
|
@@ -126,6 +127,7 @@ import {
|
|
|
126
127
|
} from '@uniweb/build/uwx'
|
|
127
128
|
import {
|
|
128
129
|
bringFoundationAlong,
|
|
130
|
+
filesAReleaseWrites,
|
|
129
131
|
bringExtensionsAlong
|
|
130
132
|
} from '../backend/foundation-bring-along.js'
|
|
131
133
|
import {
|
|
@@ -516,6 +518,9 @@ export async function publish(args = []) {
|
|
|
516
518
|
return { exitCode: 0 }
|
|
517
519
|
}
|
|
518
520
|
|
|
521
|
+
// What the release may write into local code, for the push to commit with what it writes.
|
|
522
|
+
const released = await filesAReleaseWrites(siteDir, siteYml)
|
|
523
|
+
|
|
519
524
|
// 1. Bring the foundation along — release the local foundation if its code
|
|
520
525
|
// changed (or isn't registered). Never ship a site pointing at stale code.
|
|
521
526
|
let fnd
|
|
@@ -986,7 +991,7 @@ export async function publish(args = []) {
|
|
|
986
991
|
report
|
|
987
992
|
})
|
|
988
993
|
// What the push wrote into the files is committed, whatever became of the lanes.
|
|
989
|
-
reportWriteBacks(commitWriteBacks(siteDir, client.origin, { complete: pushResult.complete }), { note: say.dim })
|
|
994
|
+
reportWriteBacks(commitWriteBacks(siteDir, client.origin, { complete: pushResult.complete, released }), { note: say.dim })
|
|
990
995
|
if (pushResult.exitCode !== 0) return { exitCode: pushResult.exitCode }
|
|
991
996
|
const siteUuid = pushResult.boundSiteUuid
|
|
992
997
|
if (!siteUuid) {
|
|
@@ -1077,6 +1082,7 @@ export async function publish(args = []) {
|
|
|
1077
1082
|
? siteYml.foundation
|
|
1078
1083
|
: siteYml.foundation?.ref || null
|
|
1079
1084
|
const recordedRef = fnd.ref || siteYmlRef
|
|
1085
|
+
const recordAtRest = deployRecordAtRest(siteDir)
|
|
1080
1086
|
await persistLastDeploy(siteDir, {
|
|
1081
1087
|
targetName: resolved.targetName,
|
|
1082
1088
|
// A target this file does not have yet — the first publish anywhere (the whole
|
|
@@ -1118,6 +1124,12 @@ export async function publish(args = []) {
|
|
|
1118
1124
|
...(Array.isArray(result.locales) ? { locales: result.locales } : {})
|
|
1119
1125
|
}
|
|
1120
1126
|
})
|
|
1127
|
+
// ⭐ The record is committed, as what a push writes is. ⛔ Until 2026-10-30 every publish left
|
|
1128
|
+
// `deploy.yml` changed, so a tree a person had committed was never clean after one.
|
|
1129
|
+
if (recordAtRest && saveDeploys) {
|
|
1130
|
+
const recorded = commitWriteBacks(siteDir, client.origin, { only: ['deploy.yml'] })
|
|
1131
|
+
if (recorded?.error) reportWriteBacks(recorded, { note: say.dim })
|
|
1132
|
+
}
|
|
1121
1133
|
|
|
1122
1134
|
console.log('')
|
|
1123
1135
|
say.ok(
|
package/src/commands/pull.js
CHANGED
|
@@ -104,6 +104,8 @@ import {
|
|
|
104
104
|
writeItemBaseVersions,
|
|
105
105
|
pulledItemVersions,
|
|
106
106
|
writeUnitBases,
|
|
107
|
+
commitWriteBacks,
|
|
108
|
+
reportWriteBacks,
|
|
107
109
|
writeItemUuids,
|
|
108
110
|
writeFolderItemUuids
|
|
109
111
|
} from '../backend/site-sync.js'
|
|
@@ -1115,15 +1117,17 @@ export async function pull(args = [], deps = {}) {
|
|
|
1115
1117
|
let pulledRecordDocs = []
|
|
1116
1118
|
let merge = { conflicted: [], changed: [] }
|
|
1117
1119
|
let notTaken = false
|
|
1120
|
+
// The languages the backend holds text in that the site does not list: not written (`documentLanguages`).
|
|
1121
|
+
let outsideLanguages = []
|
|
1118
1122
|
try {
|
|
1119
1123
|
if (siteDoc) {
|
|
1120
1124
|
// Re-base the page attribution. The pulled document IS the backend's own
|
|
1121
|
-
// representation, so it becomes the remote base directly. We
|
|
1122
|
-
//
|
|
1123
|
-
//
|
|
1124
|
-
//
|
|
1125
|
-
//
|
|
1126
|
-
//
|
|
1125
|
+
// representation, so it becomes the remote base directly. We CLEAR the local
|
|
1126
|
+
// base rather than reuse it: our source files were just rewritten from this
|
|
1127
|
+
// document, and what we would emit from them is not byte-identical to it, so
|
|
1128
|
+
// the old local base no longer describes anything. The re-bank below sets it
|
|
1129
|
+
// from what we would emit; if that fails our side reports as unknown, which is
|
|
1130
|
+
// honest rather than wrong.
|
|
1127
1131
|
writeUnitBases(projDir, client.origin, { remote: computeUnitHashes(siteDoc), local: {} })
|
|
1128
1132
|
pulledVersions = pulledItemVersions(siteDoc, content.itemVersions)
|
|
1129
1133
|
// Per-item identity for the next push. Without it the backend reads our
|
|
@@ -1181,6 +1185,7 @@ export async function pull(args = [], deps = {}) {
|
|
|
1181
1185
|
sections += report.sections.length
|
|
1182
1186
|
deleted += report.deleted.length
|
|
1183
1187
|
leftAlone += report.leftAlone?.length || 0
|
|
1188
|
+
outsideLanguages = report.outsideLanguages || []
|
|
1184
1189
|
}
|
|
1185
1190
|
|
|
1186
1191
|
if (folderTaken) {
|
|
@@ -1309,7 +1314,8 @@ export async function pull(args = [], deps = {}) {
|
|
|
1309
1314
|
await rebankSyncHashes(projDir, client.origin, {
|
|
1310
1315
|
recordDocs: pulledRecordDocs,
|
|
1311
1316
|
...(declarations.size ? { declarations } : {}),
|
|
1312
|
-
fields
|
|
1317
|
+
fields,
|
|
1318
|
+
contentTaken: Boolean(siteDoc)
|
|
1313
1319
|
})
|
|
1314
1320
|
} catch (err) {
|
|
1315
1321
|
note(`! could not re-bank the sync cache: ${err.message}`)
|
|
@@ -1402,6 +1408,12 @@ export async function pull(args = [], deps = {}) {
|
|
|
1402
1408
|
}
|
|
1403
1409
|
standIn.close()
|
|
1404
1410
|
standIn = null
|
|
1411
|
+
// ⭐ And the identity it wrote, `sync.json`, as a push commits it: one new section in the app
|
|
1412
|
+
// changes it. ⛔ Until 2026-10-30 a pull that brought one left the file changed, until the next push.
|
|
1413
|
+
if (!notTaken && !merge.conflicted.length) {
|
|
1414
|
+
const recorded = commitWriteBacks(siteDir, client.origin, { only: ['sync.json'] })
|
|
1415
|
+
if (recorded?.error) reportWriteBacks(recorded, { note })
|
|
1416
|
+
}
|
|
1405
1417
|
}
|
|
1406
1418
|
} finally {
|
|
1407
1419
|
standIn?.close()
|
|
@@ -1450,6 +1462,15 @@ export async function pull(args = [], deps = {}) {
|
|
|
1450
1462
|
'An edit made to one in the app does not come back here, and the next push sends the file.'
|
|
1451
1463
|
)
|
|
1452
1464
|
}
|
|
1465
|
+
// ⭐ Said, because a push of those sections removes the text. A translation file would make the
|
|
1466
|
+
// language the site's, and the next publish would ask to serve it (`uwx/source-locale.js`).
|
|
1467
|
+
if (outsideLanguages.length) {
|
|
1468
|
+
info(
|
|
1469
|
+
`The app holds text in ${outsideLanguages.join(', ')}, which this site does not list among its languages. ` +
|
|
1470
|
+
'It is not in your files, and your next push of those sections removes it.'
|
|
1471
|
+
)
|
|
1472
|
+
note('To keep it, add the language in the app (the language button in the editor), then pull again.')
|
|
1473
|
+
}
|
|
1453
1474
|
if (repo && !notTaken) {
|
|
1454
1475
|
// ⭐ What the pull changed in the files — not the backend's content against the base,
|
|
1455
1476
|
// which also lists what the files already held (`changedInFiles`).
|
package/src/commands/push.js
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
import { confirm, isNonInteractive } from '../utils/interactive.js'
|
|
81
81
|
import { announceServices, foundationSupports } from '../backend/service-request.js'
|
|
82
82
|
import { guardEmptyRecords, noteFolderLeftAlone } from '../utils/records-guard.js'
|
|
83
|
-
import { bringFoundationAlong } from '../backend/foundation-bring-along.js'
|
|
83
|
+
import { bringFoundationAlong, filesAReleaseWrites } from '../backend/foundation-bring-along.js'
|
|
84
84
|
import { repoOf } from '../utils/sync-point.js'
|
|
85
85
|
import {
|
|
86
86
|
makeModelResolver,
|
|
@@ -298,6 +298,8 @@ export async function push(args = [], deps = {}) {
|
|
|
298
298
|
err: error,
|
|
299
299
|
dim: note
|
|
300
300
|
}
|
|
301
|
+
// What the release may write into local code, for the push to commit with what it writes.
|
|
302
|
+
const released = output || dryRun ? [] : await filesAReleaseWrites(siteDir, siteYml)
|
|
301
303
|
let fnd = { ref: null }
|
|
302
304
|
try {
|
|
303
305
|
fnd = await bringFoundationAlong({
|
|
@@ -649,7 +651,7 @@ export async function push(args = [], deps = {}) {
|
|
|
649
651
|
if (!output && !dryRun) {
|
|
650
652
|
holdUnchangedPush(siteDir, client.origin)
|
|
651
653
|
// What it recorded on the way — a media map, an identity recovered — is committed too.
|
|
652
|
-
reportWriteBacks(commitWriteBacks(siteDir, client.origin), { note })
|
|
654
|
+
reportWriteBacks(commitWriteBacks(siteDir, client.origin, { released }), { note })
|
|
653
655
|
}
|
|
654
656
|
return { exitCode: 0 }
|
|
655
657
|
}
|
|
@@ -712,7 +714,7 @@ export async function push(args = [], deps = {}) {
|
|
|
712
714
|
}
|
|
713
715
|
})
|
|
714
716
|
// What the push wrote into the files is committed, whatever became of the lanes.
|
|
715
|
-
const written = commitWriteBacks(siteDir, client.origin, { complete: result.complete })
|
|
717
|
+
const written = commitWriteBacks(siteDir, client.origin, { complete: result.complete, released })
|
|
716
718
|
if (result.exitCode !== 0) {
|
|
717
719
|
reportWriteBacks(written, { note })
|
|
718
720
|
return { exitCode: result.exitCode }
|
package/src/commands/start.js
CHANGED
package/src/framework-index.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-31T04:15:22.597Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
6
|
"version": "1.6.7"
|
|
7
7
|
},
|
|
8
8
|
"@uniweb/build": {
|
|
9
|
-
"version": "1.13.
|
|
9
|
+
"version": "1.13.3"
|
|
10
10
|
},
|
|
11
11
|
"@uniweb/content-reader": {
|
|
12
12
|
"version": "1.5.7"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"version": "1.1.2"
|
|
55
55
|
},
|
|
56
56
|
"@uniweb/templates": {
|
|
57
|
-
"version": "1.1.
|
|
57
|
+
"version": "1.1.10"
|
|
58
58
|
},
|
|
59
59
|
"@uniweb/theming": {
|
|
60
60
|
"version": "1.2.1"
|
package/src/index.js
CHANGED
|
@@ -1400,7 +1400,10 @@ async function main() {
|
|
|
1400
1400
|
)
|
|
1401
1401
|
}
|
|
1402
1402
|
} catch {
|
|
1403
|
-
//
|
|
1403
|
+
// ⛔ Said, not skipped: the project works without git, but it has no history to go back
|
|
1404
|
+
// to and a pull cannot merge, and an agent reading this output has no other way to know.
|
|
1405
|
+
log(` ${colors.yellow}Git is not installed, so this project has no version history.${colors.reset}`)
|
|
1406
|
+
log(` ${colors.dim}Install it, then run: git init && git add -A && git commit -m "Initial commit"${colors.reset}`)
|
|
1404
1407
|
}
|
|
1405
1408
|
}
|
|
1406
1409
|
}
|
|
@@ -1983,6 +1986,139 @@ ${colors.bright}Or skip the login.${colors.reset} With \`UNIWEB_TOKEN\` set —
|
|
|
1983
1986
|
session, and nothing is stored. \`uniweb login\` there only checks the token with the
|
|
1984
1987
|
backend those commands go to — \`UNIWEB_SERVER\`, else the one you are logged in to,
|
|
1985
1988
|
else the default — and says who and where they work as.
|
|
1989
|
+
`,
|
|
1990
|
+
push: `
|
|
1991
|
+
${colors.cyan}${colors.bright}uniweb push${colors.reset} ${colors.dim}— Send this site's content to the app${colors.reset}
|
|
1992
|
+
|
|
1993
|
+
${colors.bright}Usage:${colors.reset}
|
|
1994
|
+
uniweb push [options]
|
|
1995
|
+
|
|
1996
|
+
Sends the site's content to the backend you are logged in to, releasing the local
|
|
1997
|
+
foundation first if its code changed. The site is not live until \`uniweb publish\`.
|
|
1998
|
+
|
|
1999
|
+
In a git repository a push sends what is committed. It is refused, with nothing
|
|
2000
|
+
written, if the site changed in the app since your last pull: run \`uniweb pull\` to
|
|
2001
|
+
merge those changes with yours, then push again.
|
|
2002
|
+
|
|
2003
|
+
${colors.bright}Options:${colors.reset}
|
|
2004
|
+
--commit In a git repository, commit the site's content first (-m <message>)
|
|
2005
|
+
--dry-run Report what would be sent; send nothing
|
|
2006
|
+
-o <file> Write what would be sent to a file; send nothing
|
|
2007
|
+
--all Send everything, not only what changed
|
|
2008
|
+
--force Overwrite what changed in the app since your last pull
|
|
2009
|
+
--no-release Send content against the code already released; release nothing
|
|
2010
|
+
--bump Release above a newer registered foundation version
|
|
2011
|
+
--foundation <dir> Use this local foundation
|
|
2012
|
+
--no-validate Skip the content-conformance check, which stops a push
|
|
2013
|
+
--yes Skip confirmations; never block on a prompt
|
|
2014
|
+
--org @org Work in @org for this push, instead of the workspace chosen at
|
|
2015
|
+
--personal \`uniweb login\` (or your personal workspace)
|
|
2016
|
+
`,
|
|
2017
|
+
pull: `
|
|
2018
|
+
${colors.cyan}${colors.bright}uniweb pull${colors.reset} ${colors.dim}— Bring the site's content from the app into your files${colors.reset}
|
|
2019
|
+
|
|
2020
|
+
${colors.bright}Usage:${colors.reset}
|
|
2021
|
+
uniweb pull [options]
|
|
2022
|
+
|
|
2023
|
+
In a git repository, merges what changed in the app with your commits, and commits
|
|
2024
|
+
the app's side so the next pull can tell the two apart. A section both sides changed
|
|
2025
|
+
is left with conflict markers to settle, then \`git add\` and \`git commit\`.
|
|
2026
|
+
|
|
2027
|
+
Outside a repository there is nothing to merge against: the files are rewritten to
|
|
2028
|
+
what the backend holds, after asking if any of them are yours.
|
|
2029
|
+
|
|
2030
|
+
${colors.bright}Options:${colors.reset}
|
|
2031
|
+
--dry-run Report what it would fetch; write nothing
|
|
2032
|
+
--force Take the backend's version, discarding local changes
|
|
2033
|
+
--no-records Pull pages only; skip records
|
|
2034
|
+
--no-assets Don't download media; the content keeps its URLs
|
|
2035
|
+
--no-delete Outside a repository, keep files with no backend item
|
|
2036
|
+
--org @org Work in @org for this pull, instead of the workspace chosen at
|
|
2037
|
+
--personal \`uniweb login\` (or your personal workspace)
|
|
2038
|
+
|
|
2039
|
+
To catch up with your git remote as well, use \`uniweb refresh\`.
|
|
2040
|
+
`,
|
|
2041
|
+
clone: `
|
|
2042
|
+
${colors.cyan}${colors.bright}uniweb clone${colors.reset} ${colors.dim}— Copy a site from the app into a new local project${colors.reset}
|
|
2043
|
+
|
|
2044
|
+
${colors.bright}Usage:${colors.reset}
|
|
2045
|
+
uniweb clone <site-uuid> [name|.] [options]
|
|
2046
|
+
|
|
2047
|
+
Makes a project from a site you can reach on the backend you are logged in to, with
|
|
2048
|
+
the site's foundation as a pinned reference. It starts a git repository, so the first
|
|
2049
|
+
pull and push have something to merge against. Find the uuid with \`uniweb site list\`.
|
|
2050
|
+
|
|
2051
|
+
With \`.\`, clones into the current folder. Inside a workspace, adds the site to it.
|
|
2052
|
+
|
|
2053
|
+
${colors.bright}Options:${colors.reset}
|
|
2054
|
+
--path <dir> Place the site under this folder (for example, sites)
|
|
2055
|
+
--project <name> Place it as a co-located <name>/site
|
|
2056
|
+
--no-records Pull pages only; skip records
|
|
2057
|
+
--no-assets Don't download media; the content keeps its URLs
|
|
2058
|
+
--no-git Don't start a git repository
|
|
2059
|
+
--org @org Work in @org for this clone, instead of the workspace chosen at
|
|
2060
|
+
--personal \`uniweb login\` (or your personal workspace)
|
|
2061
|
+
`,
|
|
2062
|
+
site: `
|
|
2063
|
+
${colors.cyan}${colors.bright}uniweb site${colors.reset} ${colors.dim}— The sites in a workspace${colors.reset}
|
|
2064
|
+
|
|
2065
|
+
${colors.bright}Usage:${colors.reset}
|
|
2066
|
+
uniweb site list [--json]
|
|
2067
|
+
uniweb site unpublish [<site-uuid>] [--yes]
|
|
2068
|
+
uniweb site delete [<site-uuid>] [--yes]
|
|
2069
|
+
|
|
2070
|
+
${colors.bright}list${colors.reset} gives each site's name, uuid, and whether it is live.
|
|
2071
|
+
${colors.bright}unpublish${colors.reset} takes a site offline, and its content stays.
|
|
2072
|
+
${colors.bright}delete${colors.reset} removes a site for good. A live site must be unpublished first.
|
|
2073
|
+
|
|
2074
|
+
Without a uuid, \`unpublish\` and \`delete\` act on the site this project is synced to.
|
|
2075
|
+
Both ask first, and \`--yes\` is the only way past the question: with no terminal and
|
|
2076
|
+
no \`--yes\` they refuse. Deleting this project's own site also forgets it here, so the
|
|
2077
|
+
next push creates a new one.
|
|
2078
|
+
|
|
2079
|
+
${colors.bright}Options:${colors.reset}
|
|
2080
|
+
--json \`list\`: print JSON
|
|
2081
|
+
--yes Confirm \`unpublish\` or \`delete\`
|
|
2082
|
+
--org @org Work in @org, instead of the workspace chosen at \`uniweb login\`
|
|
2083
|
+
--personal (or your personal workspace)
|
|
2084
|
+
`,
|
|
2085
|
+
org: `
|
|
2086
|
+
${colors.cyan}${colors.bright}uniweb org${colors.reset} ${colors.dim}— The organizations you belong to${colors.reset}
|
|
2087
|
+
|
|
2088
|
+
${colors.bright}Usage:${colors.reset}
|
|
2089
|
+
uniweb org list
|
|
2090
|
+
uniweb org create <handle>
|
|
2091
|
+
|
|
2092
|
+
${colors.bright}list${colors.reset} gives your personal scope and the organizations you are a member of.
|
|
2093
|
+
${colors.bright}create${colors.reset} makes an organization, with you as a member.
|
|
2094
|
+
|
|
2095
|
+
You don't need one to register a foundation: \`@<your handle>\` is your personal scope.
|
|
2096
|
+
An organization is for a scope, and sites, that you share.
|
|
2097
|
+
`,
|
|
2098
|
+
content: `
|
|
2099
|
+
${colors.cyan}${colors.bright}uniweb content${colors.reset} ${colors.dim}— Package a site or foundation as a file${colors.reset}
|
|
2100
|
+
|
|
2101
|
+
${colors.bright}Usage:${colors.reset}
|
|
2102
|
+
uniweb content export [<dir>] [options]
|
|
2103
|
+
|
|
2104
|
+
Writes the content of a site (a folder with \`site.yml\`), or the schema of a built
|
|
2105
|
+
foundation, to one file, with no code in it. To send a site to the app, use
|
|
2106
|
+
\`uniweb push\`.
|
|
2107
|
+
|
|
2108
|
+
${colors.bright}Options:${colors.reset}
|
|
2109
|
+
-o <file> Choose the output filename
|
|
2110
|
+
--dry-run Print a summary; write nothing
|
|
2111
|
+
--no-sidecar Mint fresh ids each time, for a file submitted once
|
|
2112
|
+
--source-locale <lang> Wrap single-language fields under this language (default: en)
|
|
2113
|
+
`,
|
|
2114
|
+
logout: `
|
|
2115
|
+
${colors.cyan}${colors.bright}uniweb logout${colors.reset} ${colors.dim}— Log out of the backend you are logged in to${colors.reset}
|
|
2116
|
+
|
|
2117
|
+
${colors.bright}Usage:${colors.reset}
|
|
2118
|
+
uniweb logout
|
|
2119
|
+
|
|
2120
|
+
Forgets the session on this computer. The next command that needs a backend asks you to
|
|
2121
|
+
log in again, and \`uniweb login\` goes to the default backend unless you name another.
|
|
1986
2122
|
`,
|
|
1987
2123
|
refresh: `
|
|
1988
2124
|
${colors.cyan}${colors.bright}uniweb refresh${colors.reset} ${colors.dim}— Catch up with teammates AND app authors${colors.reset}
|
|
@@ -2217,6 +2353,7 @@ ${colors.bright}Commands:${colors.reset}
|
|
|
2217
2353
|
status What changed in the app, in git and in Uniweb — and what to run
|
|
2218
2354
|
forget Forget a backend, or --all to make a copied project a new one
|
|
2219
2355
|
site <cmd> The sites in a workspace: list, unpublish, delete
|
|
2356
|
+
org <cmd> The organizations you belong to: list, create
|
|
2220
2357
|
inspect <path> Inspect parsed content shape of a markdown file or folder
|
|
2221
2358
|
docs Generate component documentation
|
|
2222
2359
|
families List the standard section families (for meta.js family:)
|
package/src/utils/sync-point.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
writeFileSync
|
|
50
50
|
} from 'node:fs'
|
|
51
51
|
import { tmpdir } from 'node:os'
|
|
52
|
-
import { join, dirname } from 'node:path'
|
|
52
|
+
import { join, dirname, posix } from 'node:path'
|
|
53
53
|
|
|
54
54
|
export const SYNC_TRAILER = 'Uniweb-Sync'
|
|
55
55
|
export const SITE_TRAILER = 'Uniweb-Site'
|
|
@@ -747,7 +747,7 @@ export function contentCommitted(repo, roots) {
|
|
|
747
747
|
export function uncommittedPaths(repo, roots) {
|
|
748
748
|
let parts
|
|
749
749
|
try {
|
|
750
|
-
parts = zlist(git(repo.top, ['status', '--porcelain', '-z', '--untracked-files=all', '--', ...roots.map((r) =>
|
|
750
|
+
parts = zlist(git(repo.top, ['status', '--porcelain', '-z', '--untracked-files=all', '--', ...roots.map((r) => underTop(repo, r))]))
|
|
751
751
|
} catch {
|
|
752
752
|
return null
|
|
753
753
|
}
|
|
@@ -794,7 +794,7 @@ export function filesDifferFrom(repo, rev, roots) {
|
|
|
794
794
|
* @returns {{ commit: string, paths: string[] } | null} null when there was nothing to commit
|
|
795
795
|
*/
|
|
796
796
|
export function commitRoots(repo, roots, { message, identity = null }) {
|
|
797
|
-
const full = roots.map((r) =>
|
|
797
|
+
const full = roots.map((r) => underTop(repo, r))
|
|
798
798
|
const present = full.filter((p) => existsSync(join(repo.top, p)) || zlist(git(repo.top, ['ls-files', '-z', '--', p])).length)
|
|
799
799
|
let addable = present
|
|
800
800
|
if (present.length) {
|
|
@@ -818,6 +818,9 @@ export function commitRoots(repo, roots, { message, identity = null }) {
|
|
|
818
818
|
|
|
819
819
|
const siteRelative = (repo, p) => (repo.prefix && p.startsWith(repo.prefix) ? p.slice(repo.prefix.length) : p)
|
|
820
820
|
|
|
821
|
+
// A path relative to the site, as the repository names it. `../src/main.js` comes out as `src/main.js`.
|
|
822
|
+
const underTop = (repo, p) => posix.normalize(`${repo.prefix}${p}`)
|
|
823
|
+
|
|
821
824
|
// ── this copy's own sync point ──────────────────────────────────────────────
|
|
822
825
|
|
|
823
826
|
const cachePath = (siteDir) => join(siteDir, '.uniweb', 'backend-cache.json')
|