uniweb 1.20.2 → 1.20.3
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
CHANGED
package/src/backend/workspace.js
CHANGED
|
@@ -139,6 +139,44 @@ export const SOURCE_LABEL = {
|
|
|
139
139
|
offline: 'not resolved in a preview'
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* What a preview (`--dry-run`) says about the workspace: the one the command would work in,
|
|
144
|
+
* and a warning when the project's record says its site was created in another.
|
|
145
|
+
*
|
|
146
|
+
* ⭐ A preview resolves the workspace offline (`resolveWorkspace`): a flag, `UNIWEB_WORKSPACE`
|
|
147
|
+
* or the login's choice. With none of those, which one the command settles on takes the
|
|
148
|
+
* backend, so the preview says what the command does instead of guessing.
|
|
149
|
+
*
|
|
150
|
+
* ⚠️ The record says where the site was CREATED (`readSiteWorkspace`), not where the backend
|
|
151
|
+
* keeps it now. The backend decides, and a site kept outside the workspace stops the command
|
|
152
|
+
* (`409 wrong_workspace`), so a difference is worded as a warning about the record.
|
|
153
|
+
*
|
|
154
|
+
* @param {{ workspace: string|null, source: string }} ws - `resolveWorkspace`'s answer
|
|
155
|
+
* @param {string|null} createdIn - `readSiteWorkspace` for the project's site on this backend;
|
|
156
|
+
* null when it has none, or no workspace is recorded for it
|
|
157
|
+
* @param {string} verb - `publish`, `push`
|
|
158
|
+
* @returns {{ workspace: string, warning: string|null }}
|
|
159
|
+
*/
|
|
160
|
+
export function previewWorkspace(ws, createdIn, verb) {
|
|
161
|
+
if (ws.source === 'offline') {
|
|
162
|
+
return {
|
|
163
|
+
workspace:
|
|
164
|
+
`none chosen at login — the ${verb} works in your personal workspace if you belong to no ` +
|
|
165
|
+
'organization or project, and otherwise stops and says how to choose one',
|
|
166
|
+
warning: null
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const differs =
|
|
170
|
+
typeof createdIn === 'string' && createdIn.toLowerCase() !== String(ws.workspace ?? '').toLowerCase()
|
|
171
|
+
return {
|
|
172
|
+
workspace: `${describeWorkspace(ws.workspace)} (${SOURCE_LABEL[ws.source]})`,
|
|
173
|
+
warning: differs
|
|
174
|
+
? `sync.json records this site as created in ${describeWorkspace(createdIn)}. If the backend ` +
|
|
175
|
+
`still keeps it there, it stops this ${verb}: add --org ${createdIn} to work in it.`
|
|
176
|
+
: null
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
142
180
|
/** How to choose, for a command on `origin` — its login names the backend when it must (`loginCommand`). */
|
|
143
181
|
const choose = (origin) =>
|
|
144
182
|
[
|
package/src/commands/publish.js
CHANGED
|
@@ -111,11 +111,12 @@ import {
|
|
|
111
111
|
commitWriteBacks,
|
|
112
112
|
reportWriteBacks,
|
|
113
113
|
dropSiteBoundValues,
|
|
114
|
-
pushSyncPackages
|
|
114
|
+
pushSyncPackages,
|
|
115
|
+
readSiteWorkspace
|
|
115
116
|
} from '../backend/site-sync.js'
|
|
116
117
|
import { repoOf } from '../utils/sync-point.js'
|
|
117
118
|
import { commitBeforeSending } from '../backend/commit-before-sending.js'
|
|
118
|
-
import { resolveWorkspace, describeWorkspace, SOURCE_LABEL } from '../backend/workspace.js'
|
|
119
|
+
import { resolveWorkspace, describeWorkspace, previewWorkspace, SOURCE_LABEL } from '../backend/workspace.js'
|
|
119
120
|
import { uploadSiteMedia, describeAssetRefusal } from '../backend/site-media.js'
|
|
120
121
|
import {
|
|
121
122
|
updateBackendMap,
|
|
@@ -479,13 +480,15 @@ export async function publish(args = []) {
|
|
|
479
480
|
}
|
|
480
481
|
|
|
481
482
|
if (dryRun) {
|
|
483
|
+
const siteUuid = readBackendState(siteDir, client.origin).site?.uuid
|
|
484
|
+
const preview = previewWorkspace(ws, siteUuid ? readSiteWorkspace(siteDir, client.origin) : null, 'publish')
|
|
482
485
|
say.info('Dry run — would bring the foundation along, sync, and go live:')
|
|
483
486
|
say.dim(`Backend : ${client.origin}`)
|
|
484
|
-
say.dim(
|
|
485
|
-
|
|
486
|
-
)
|
|
487
|
+
say.dim(`Workspace : ${preview.workspace}`)
|
|
488
|
+
say.dim(`site_uuid : ${siteUuid || '(none — the site is created before anything uploads)'}`)
|
|
487
489
|
const langs = languagesFromSiteYml(siteYml)
|
|
488
490
|
if (langs) say.dim(`Languages : ${langs.join(', ')}`)
|
|
491
|
+
if (preview.warning) say.warn(preview.warning)
|
|
489
492
|
await bringFoundationAlong({
|
|
490
493
|
client,
|
|
491
494
|
siteDir,
|
package/src/commands/push.js
CHANGED
|
@@ -103,10 +103,11 @@ import {
|
|
|
103
103
|
commitWriteBacks,
|
|
104
104
|
reportWriteBacks,
|
|
105
105
|
holdUnchangedPush,
|
|
106
|
-
pushSyncPackages
|
|
106
|
+
pushSyncPackages,
|
|
107
|
+
readSiteWorkspace
|
|
107
108
|
} from '../backend/site-sync.js'
|
|
108
109
|
import { commitBeforeSending } from '../backend/commit-before-sending.js'
|
|
109
|
-
import { resolveWorkspace, describeWorkspace, SOURCE_LABEL } from '../backend/workspace.js'
|
|
110
|
+
import { resolveWorkspace, describeWorkspace, previewWorkspace, SOURCE_LABEL } from '../backend/workspace.js'
|
|
110
111
|
|
|
111
112
|
// Re-exported for downstream importers (pull.js, push.test.js) that read these
|
|
112
113
|
// helpers from this module — their canonical home is now ../backend/site-sync.js.
|
|
@@ -685,6 +686,10 @@ export async function push(args = [], deps = {}) {
|
|
|
685
686
|
`Dry run — would push the folder at ${colors.dim}${client.origin}${colors.reset}`
|
|
686
687
|
)
|
|
687
688
|
}
|
|
689
|
+
const siteUuid = readBackendState(siteDir, client.origin).site?.uuid
|
|
690
|
+
const preview = previewWorkspace(ws, siteUuid ? readSiteWorkspace(siteDir, client.origin) : null, 'push')
|
|
691
|
+
note(`Workspace: ${preview.workspace}`)
|
|
692
|
+
if (preview.warning) warn(preview.warning)
|
|
688
693
|
return { exitCode: 0 }
|
|
689
694
|
}
|
|
690
695
|
|
package/src/framework-index.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-26T02:00:48.151Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
6
|
"version": "1.6.4"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"version": "1.0.6"
|
|
25
25
|
},
|
|
26
26
|
"@uniweb/kit": {
|
|
27
|
-
"version": "1.6.
|
|
27
|
+
"version": "1.6.5"
|
|
28
28
|
},
|
|
29
29
|
"@uniweb/loom": {
|
|
30
30
|
"version": "1.1.2"
|