uniweb 1.34.12 → 1.35.0
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 +5 -5
- package/partials/agents.md +2 -1
- package/partials/guides/index.json +5 -0
- package/partials/guides/promote.md +142 -0
- package/src/backend/client.js +140 -7
- package/src/backend/promote-drafts.js +992 -0
- package/src/backend/site-sync.js +2 -1
- package/src/commands/doctor.js +21 -5
- package/src/commands/promote.js +1598 -0
- package/src/commands/pull.js +72 -2
- package/src/commands/site.js +1 -1
- package/src/commands/status.js +169 -2
- package/src/framework-index.json +3 -3
- package/src/index.js +11 -1
- package/src/utils/flag-guard.js +6 -0
- package/src/utils/status-next.js +2 -2
package/src/commands/pull.js
CHANGED
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
* uniweb pull --no-records Pull pages only; skip the folder (records) lane
|
|
48
48
|
* uniweb pull --no-delete Keep files with no backend item
|
|
49
49
|
* uniweb pull --force Take the backend's version, discarding local changes
|
|
50
|
-
* uniweb pull --dry-run
|
|
50
|
+
* uniweb pull --dry-run In git, name each file it would change (a YAML file's keys
|
|
51
|
+
* too); write nothing
|
|
51
52
|
*
|
|
52
53
|
* The content + folder pull lanes are both keyed by the site's uuid on that backend
|
|
53
54
|
* (sync.json).
|
|
@@ -772,6 +773,63 @@ export async function probePull(args = [], deps = {}) {
|
|
|
772
773
|
}
|
|
773
774
|
}
|
|
774
775
|
|
|
776
|
+
/**
|
|
777
|
+
* In each YAML file a pull would change (`M`, in the site), the keys whose values it changes, read as
|
|
778
|
+
* values: a key in a map the pull changes is named by its path (`services.search`), to three levels,
|
|
779
|
+
* and a list as a whole. A file whose values are all the same is named with none.
|
|
780
|
+
*
|
|
781
|
+
* @param {Array<[string, string]>} files - the stand-in's `changes()`
|
|
782
|
+
* @param {{ repo: object, rev: string, siteDir: string }} at - the commit the stand-in holds, and its site
|
|
783
|
+
* @returns {Record<string, string[]>} path → the keys, for each file that has any
|
|
784
|
+
*/
|
|
785
|
+
function yamlKeysChanged(files, { repo, rev, siteDir }) {
|
|
786
|
+
const out = {}
|
|
787
|
+
for (const [status, path] of files) {
|
|
788
|
+
if (status !== 'M' || !/\.ya?ml$/i.test(path) || path.startsWith('..')) continue
|
|
789
|
+
try {
|
|
790
|
+
const was = yaml.load(fileAt(repo, rev, path)?.toString('utf8') ?? '') ?? {}
|
|
791
|
+
const now = yaml.load(readFileSync(join(siteDir, path), 'utf8')) ?? {}
|
|
792
|
+
const keys = changedKeys(was, now)
|
|
793
|
+
if (keys.length) out[path] = keys
|
|
794
|
+
} catch {
|
|
795
|
+
// A file that does not read is named with no keys.
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return out
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
function changedKeys(was, now, at = '', depth = 0) {
|
|
802
|
+
const plainMap = (v) => v !== null && typeof v === 'object' && !Array.isArray(v)
|
|
803
|
+
if (!plainMap(was) || !plainMap(now)) return JSON.stringify(was) === JSON.stringify(now) ? [] : [at || '(the whole file)']
|
|
804
|
+
const out = []
|
|
805
|
+
for (const key of new Set([...Object.keys(was), ...Object.keys(now)])) {
|
|
806
|
+
const a = was[key]
|
|
807
|
+
const b = now[key]
|
|
808
|
+
if (JSON.stringify(sortedDeep(a)) === JSON.stringify(sortedDeep(b))) continue
|
|
809
|
+
const path = at ? `${at}.${key}` : key
|
|
810
|
+
if (depth < 2 && plainMap(a) && plainMap(b)) out.push(...changedKeys(a, b, path, depth + 1))
|
|
811
|
+
else out.push(path)
|
|
812
|
+
}
|
|
813
|
+
return out
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/** A dry run's account of the pull it stands for (`probePull`). */
|
|
817
|
+
function printPreview({ files, keys = {}, noBase, recordsNotPlaced, itemsBehind = 0, mountedMoved = [], held = [] }, origin) {
|
|
818
|
+
const from = `${colors.dim}${origin}${colors.reset}`
|
|
819
|
+
if (!files.length) {
|
|
820
|
+
info(`Dry run — a pull from ${from} would change no file.`)
|
|
821
|
+
if (itemsBehind || mountedMoved.length || held.length) note('The backend moved with no file here to show it; the pull would record that (`uniweb status` says what moved).')
|
|
822
|
+
return
|
|
823
|
+
}
|
|
824
|
+
info(`Dry run — a pull from ${from} would change ${files.length === 1 ? '1 file' : `${files.length} files`}:`)
|
|
825
|
+
for (const [status, path] of files) {
|
|
826
|
+
const what = status === 'A' ? ' (new)' : status === 'D' ? ' (removed)' : ''
|
|
827
|
+
note(`${path}${what}${keys[path] ? ` — ${keys[path].join(', ')}` : ''}`)
|
|
828
|
+
}
|
|
829
|
+
if (noBase) note('This copy has no sync point with the site, so these are the files that differ, either way.')
|
|
830
|
+
if (recordsNotPlaced) note('Some records could not be placed in files; the pull says which, and why.')
|
|
831
|
+
}
|
|
832
|
+
|
|
775
833
|
export async function pull(args = [], deps = {}) {
|
|
776
834
|
// See utils/flag-guard.js — an unrecognized flag is invisible to a literal scan, so
|
|
777
835
|
// it silently keeps the default: a mistyped `--dry-run` would pull for real, and a
|
|
@@ -920,6 +978,15 @@ export async function pull(args = [], deps = {}) {
|
|
|
920
978
|
}
|
|
921
979
|
|
|
922
980
|
if (dryRun) {
|
|
981
|
+
// ⭐ IN A REPOSITORY A DRY RUN IS THE PULL ITSELF, STOPPED BEFORE IT TAKES ANYTHING (`probePull`), as
|
|
982
|
+
// `uniweb status` asks it: each file it would change, and in a YAML file the keys. ⛔ Until 2026-11-16
|
|
983
|
+
// it said only "would pull content", and a pull that rewrote a whole `site.yml` to change its favicon
|
|
984
|
+
// gave no sign of it beforehand (measured on a site, 2026-11-16).
|
|
985
|
+
const preview = repo?.head && !probe ? await probePull(args.filter((a) => a !== '--dry-run'), deps) : null
|
|
986
|
+
if (preview) {
|
|
987
|
+
printPreview(preview, client.origin)
|
|
988
|
+
return { exitCode: 0 }
|
|
989
|
+
}
|
|
923
990
|
info(
|
|
924
991
|
`Dry run — would pull content from ${colors.dim}${client.origin}${colors.reset}`
|
|
925
992
|
)
|
|
@@ -1461,10 +1528,13 @@ export async function pull(args = [], deps = {}) {
|
|
|
1461
1528
|
// another copy these files already hold; either way a push from here may be refused.
|
|
1462
1529
|
const seen = readItemBaseVersions(siteDir, client.origin)
|
|
1463
1530
|
const itemsBehind = Object.entries(content?.itemVersions || {}).filter(([uuid, v]) => seen[uuid] && seen[uuid] !== v).length
|
|
1531
|
+
const files = standIn.changes()
|
|
1464
1532
|
return {
|
|
1465
1533
|
exitCode: 0,
|
|
1466
1534
|
probe: {
|
|
1467
|
-
files
|
|
1535
|
+
files,
|
|
1536
|
+
// In a YAML file the pull would change, the keys whose values it changes (`changedKeys`).
|
|
1537
|
+
keys: yamlKeysChanged(files, { repo, rev: onto, siteDir: standIn.siteDir }),
|
|
1468
1538
|
itemsBehind,
|
|
1469
1539
|
// By route: the mounted pages the backend moved, which the next push puts back, and the pages
|
|
1470
1540
|
// held because their files cannot say what the app made of them.
|
package/src/commands/site.js
CHANGED
|
@@ -95,7 +95,7 @@ function positionals(args) {
|
|
|
95
95
|
* workspace's only site. ⛔ Never a stop: outside a project — or from an install without
|
|
96
96
|
* `@uniweb/build`, which finding a workspace's sites may load — there is simply none.
|
|
97
97
|
*/
|
|
98
|
-
async function projectSiteDir() {
|
|
98
|
+
export async function projectSiteDir() {
|
|
99
99
|
try {
|
|
100
100
|
const cwd = process.cwd()
|
|
101
101
|
if (existsSync(join(cwd, 'site.yml'))) return { dir: cwd }
|
package/src/commands/status.js
CHANGED
|
@@ -92,6 +92,14 @@ import { siteAround } from '../utils/pick-site.js'
|
|
|
92
92
|
import { getCliVersion } from '../versions.js'
|
|
93
93
|
import { planNext } from '../utils/status-next.js'
|
|
94
94
|
import { AD_PLATFORMS } from '../backend/ad-platforms.js'
|
|
95
|
+
import {
|
|
96
|
+
campaignDeliveries,
|
|
97
|
+
connectionOf,
|
|
98
|
+
deliveryOf,
|
|
99
|
+
indexPromotion,
|
|
100
|
+
reasonWords,
|
|
101
|
+
shortIds
|
|
102
|
+
} from '../backend/promote-drafts.js'
|
|
95
103
|
|
|
96
104
|
const c = {
|
|
97
105
|
reset: '\x1b[0m',
|
|
@@ -739,10 +747,11 @@ async function appChecks(siteDir, siteYml, { offline, args, git }) {
|
|
|
739
747
|
}
|
|
740
748
|
return readAppChanges({ client, siteDir, siteUuid: uuid })
|
|
741
749
|
}
|
|
742
|
-
const [state, changes, foundation] = await Promise.all([
|
|
750
|
+
const [state, changes, foundation, promotion] = await Promise.all([
|
|
743
751
|
uuid ? client.siteState(uuid) : null,
|
|
744
752
|
uuid ? readChanges().catch((err) => ({ error: err })) : null,
|
|
745
|
-
foundationCheck(siteDir, siteYml, client).catch(() => null)
|
|
753
|
+
foundationCheck(siteDir, siteYml, client).catch(() => null),
|
|
754
|
+
uuid ? client.readPromotion(uuid).catch(() => null) : null
|
|
746
755
|
])
|
|
747
756
|
|
|
748
757
|
if (state) {
|
|
@@ -836,9 +845,166 @@ async function appChecks(siteDir, siteYml, { offline, args, git }) {
|
|
|
836
845
|
}
|
|
837
846
|
}
|
|
838
847
|
if (foundation) checks.push(foundation)
|
|
848
|
+
if (site && !elsewhere) {
|
|
849
|
+
const promote = await promoteChecks(client, uuid, promotion)
|
|
850
|
+
checks.push(...promote.checks)
|
|
851
|
+
proposals.push(...promote.proposals)
|
|
852
|
+
}
|
|
839
853
|
return { checks, proposals, backend, site: site ?? null }
|
|
840
854
|
}
|
|
841
855
|
|
|
856
|
+
/**
|
|
857
|
+
* `promote.*` — the site's Promote, once the site has used it: what only the person can do (an
|
|
858
|
+
* account to reconnect or hand on, Promote to turn on where its ads were paused), the steps that
|
|
859
|
+
* get it found, the posts that failed and the ones going out this week, and what each running
|
|
860
|
+
* campaign spent. `uniweb promote status` says the rest.
|
|
861
|
+
*
|
|
862
|
+
* Nothing is said for a backend that has no Promote, or a site that never used it; a read that
|
|
863
|
+
* failed otherwise is `unknown`.
|
|
864
|
+
*
|
|
865
|
+
* @param {object} client
|
|
866
|
+
* @param {string} uuid - the site
|
|
867
|
+
* @param {Response|null} res - the promotion read, made beside the site's other reads
|
|
868
|
+
*/
|
|
869
|
+
async function promoteChecks(client, uuid, res, { now = Date.now() } = {}) {
|
|
870
|
+
if (!res || res.status === 404) return { checks: [], proposals: [] }
|
|
871
|
+
if (!res.ok) {
|
|
872
|
+
return { checks: [{ id: 'promote.site', state: 'unknown', summary: `Could not read the site's Promote: HTTP ${res.status}.` }], proposals: [] }
|
|
873
|
+
}
|
|
874
|
+
const promotion = (await res.json().catch(() => null))?.promotion ?? null
|
|
875
|
+
if (!promotion) return { checks: [], proposals: [] }
|
|
876
|
+
const index = indexPromotion(promotion)
|
|
877
|
+
const ids = shortIds(index.items.map((i) => i.uuid))
|
|
878
|
+
const checks = []
|
|
879
|
+
const proposals = []
|
|
880
|
+
|
|
881
|
+
// ── Getting found: each step's reading ──
|
|
882
|
+
const steps = index.top('getting_found').filter((s) => s.data?.skipped !== true)
|
|
883
|
+
if (steps.length) {
|
|
884
|
+
const reading = (s) => index.child('getting_found/reading', s.uuid)?.data ?? null
|
|
885
|
+
const todo = steps.filter((s) => reading(s)?.state !== 'done')
|
|
886
|
+
checks.push({
|
|
887
|
+
id: 'promote.found',
|
|
888
|
+
state: todo.length ? 'attention' : 'ok',
|
|
889
|
+
summary: todo.length
|
|
890
|
+
? `Getting found: ${todo.map((s) => `${s.data?.step} ${{ todo: 'to do' }[reading(s)?.state] ?? reading(s)?.state ?? 'not checked'}`).join(', ')}.`
|
|
891
|
+
: `Getting found: ${steps.map((s) => s.data?.step).join(', ')} done.`,
|
|
892
|
+
lines: todo.length ? ['`npx uniweb promote check <step>` checks one again.'] : [],
|
|
893
|
+
detail: { steps: steps.map((s) => ({ step: s.data?.step ?? null, reading: reading(s) })) }
|
|
894
|
+
})
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// ── The accounts it goes out through: the person's to reconnect or hand on ──
|
|
898
|
+
const accounts = index.top('networks').map((n) => ({ network: n.data?.network, use: n.data?.use, ...connectionOf(n.data?.connection) }))
|
|
899
|
+
const stuck = accounts.filter((a) => a.state === 'needs_reconnect' || a.state === 'stopped')
|
|
900
|
+
if (accounts.length) {
|
|
901
|
+
checks.push({
|
|
902
|
+
id: 'promote.accounts',
|
|
903
|
+
state: stuck.length ? 'attention' : 'ok',
|
|
904
|
+
summary: stuck.length
|
|
905
|
+
? `${count(stuck.length, 'account')} the site goes out through ${stuck.length === 1 ? 'needs' : 'need'} its person.`
|
|
906
|
+
: `Goes out through ${accounts.map((a) => `${a.network} (${a.use})`).join(', ')}.`,
|
|
907
|
+
lines: stuck.map((a) => `${a.network} “${a.name ?? a.handle ?? a.uuid}”: ${a.state === 'stopped' ? 'stopped — its person left; an admin hands it on' : 'needs reconnecting'}`),
|
|
908
|
+
detail: { accounts }
|
|
909
|
+
})
|
|
910
|
+
for (const a of stuck) {
|
|
911
|
+
proposals.push({
|
|
912
|
+
step: 'promote',
|
|
913
|
+
command: null,
|
|
914
|
+
why: a.state === 'stopped'
|
|
915
|
+
? `the ${a.network} account “${a.name ?? a.handle ?? a.uuid}” stopped when its person left: an admin of the workspace hands it on, in the app`
|
|
916
|
+
: `the ${a.network} account “${a.name ?? a.handle ?? a.uuid}” needs reconnecting: its person does it, in the app`,
|
|
917
|
+
ask: true
|
|
918
|
+
})
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// ── Posts: what failed, and what goes out this week ──
|
|
923
|
+
const posts = index.top('posts').map((p) => ({ item: p, delivery: deliveryOf(index, p) }))
|
|
924
|
+
if (posts.length) {
|
|
925
|
+
const weekAhead = now + 7 * 86400000
|
|
926
|
+
const failed = posts.filter((p) => p.delivery?.status === 'failed' || p.delivery?.status === 'refused')
|
|
927
|
+
const soon = posts
|
|
928
|
+
.filter((p) => p.delivery?.status === 'scheduled' && Date.parse(p.item.data?.send_at) <= weekAhead)
|
|
929
|
+
.sort((a, b) => Date.parse(a.item.data?.send_at) - Date.parse(b.item.data?.send_at))
|
|
930
|
+
const network = (p) => index.byUuid.get(p.item.data?.via)?.data?.network ?? 'its network'
|
|
931
|
+
const tally = ['draft', 'scheduled', 'published']
|
|
932
|
+
.map((state) => [state, posts.filter((p) => (p.delivery?.status ?? 'draft') === state).length])
|
|
933
|
+
.filter(([, n]) => n)
|
|
934
|
+
.map(([state, n]) => `${n} ${state}`)
|
|
935
|
+
checks.push({
|
|
936
|
+
id: 'promote.posts',
|
|
937
|
+
state: failed.length ? 'attention' : 'ok',
|
|
938
|
+
summary: `Posts: ${[...(failed.length ? [`${failed.length} failed`] : []), ...tally].join(' · ')}.`,
|
|
939
|
+
lines: [
|
|
940
|
+
...failed.map((p) => `${ids.get(p.item.uuid)} failed on ${network(p)}: ${reasonWords(p.delivery.reason)}${p.delivery.detail ? ` — ${p.delivery.detail}` : ''}`),
|
|
941
|
+
...soon.map((p) => `${ids.get(p.item.uuid)} goes out on ${network(p)} at ${p.item.data.send_at}`)
|
|
942
|
+
],
|
|
943
|
+
detail: {
|
|
944
|
+
failed: failed.map((p) => ({ id: p.item.uuid, reason: p.delivery.reason ?? null })),
|
|
945
|
+
scheduled: soon.map((p) => ({ id: p.item.uuid, send_at: p.item.data.send_at }))
|
|
946
|
+
}
|
|
947
|
+
})
|
|
948
|
+
if (failed.some((p) => p.delivery?.reason === 'promote_off')) {
|
|
949
|
+
proposals.push({ step: 'promote', command: null, why: 'a scheduled post failed because the site has no Promote: it comes with the site\'s Analytics, which the person turns on in the app', ask: true })
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// ── Campaigns: what runs, and what it spent ──
|
|
954
|
+
const campaigns = index.top('campaigns').map((x) => ({ item: x, deliveries: campaignDeliveries(index, x) }))
|
|
955
|
+
if (campaigns.length) {
|
|
956
|
+
const running = campaigns.filter((x) => x.deliveries.some((d) => d.status === 'active'))
|
|
957
|
+
const spent = await Promise.all(
|
|
958
|
+
running.map(async (x) => {
|
|
959
|
+
const r = await client.campaignSpend(uuid, x.item.uuid).catch(() => null)
|
|
960
|
+
return r?.ok ? ((await r.json().catch(() => null))?.spend ?? null) : null
|
|
961
|
+
})
|
|
962
|
+
)
|
|
963
|
+
const offPaused = campaigns.some((x) => x.deliveries.some((d) => d.status === 'paused' && d.reason === 'promote_off'))
|
|
964
|
+
const attention = campaigns.filter((x) => x.deliveries.some((d) => d.status === 'attention'))
|
|
965
|
+
const lines = running.map((x, i) => `“${x.item.data?.name ?? ids.get(x.item.uuid)}” running — ${spendWords(spent[i])}`)
|
|
966
|
+
for (const x of attention) {
|
|
967
|
+
for (const d of x.deliveries.filter((d) => d.status === 'attention')) {
|
|
968
|
+
lines.push(`“${x.item.data?.name ?? ids.get(x.item.uuid)}” waits in an ad account: ${reasonWords(d.reason)}${d.detail ? ` — ${d.detail}` : ''}`)
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
if (offPaused) lines.push('Its ads were paused because the site has no Promote.')
|
|
972
|
+
checks.push({
|
|
973
|
+
id: 'promote.campaigns',
|
|
974
|
+
state: attention.length || offPaused ? 'attention' : 'ok',
|
|
975
|
+
summary: `Campaigns: ${running.length} running, ${campaigns.length - running.length} not.`,
|
|
976
|
+
lines,
|
|
977
|
+
detail: {
|
|
978
|
+
running: running.map((x, i) => ({ id: x.item.uuid, name: x.item.data?.name ?? null, spend: spent[i] }))
|
|
979
|
+
}
|
|
980
|
+
})
|
|
981
|
+
if (offPaused) {
|
|
982
|
+
proposals.push({ step: 'promote', command: null, why: 'the site\'s ads were paused because it has no Promote: it comes with the site\'s Analytics, which the person turns on in the app', ask: true })
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
return { checks, proposals }
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* What a campaign spent, from the days the network last reported: the latest day and the one
|
|
990
|
+
* before it, each per currency. A day not reported is unknown, never zero.
|
|
991
|
+
*/
|
|
992
|
+
function spendWords(rows) {
|
|
993
|
+
if (!Array.isArray(rows) || !rows.length) return 'no spend reported yet'
|
|
994
|
+
const days = [...new Set(rows.map((r) => r.day).filter(Boolean))].sort()
|
|
995
|
+
const on = (day) => {
|
|
996
|
+
const cents = {}
|
|
997
|
+
for (const r of rows.filter((x) => x.day === day)) {
|
|
998
|
+
const n = Math.round(Number(r.amount) * 100)
|
|
999
|
+
if (r.currency && Number.isFinite(n)) cents[r.currency] = (cents[r.currency] ?? 0) + n
|
|
1000
|
+
}
|
|
1001
|
+
return Object.entries(cents).map(([cur, n]) => `${(n / 100).toFixed(2)} ${cur}`).join(' + ') || 'unknown'
|
|
1002
|
+
}
|
|
1003
|
+
const last = days[days.length - 1]
|
|
1004
|
+
const before = days[days.length - 2]
|
|
1005
|
+
return before ? `${on(before)} on ${before}, ${on(last)} on ${last} so far` : `${on(last)} on ${last}`
|
|
1006
|
+
}
|
|
1007
|
+
|
|
842
1008
|
/** The name a backend's hosting goes by: Uniweb Cloud on the default backend, its origin elsewhere. */
|
|
843
1009
|
const cloudName = (origin) => (origin === DEFAULT_BACKEND_ORIGIN ? 'Uniweb Cloud' : origin)
|
|
844
1010
|
|
|
@@ -1710,6 +1876,7 @@ const GROUPS = [
|
|
|
1710
1876
|
['git', 'Git'],
|
|
1711
1877
|
['app', 'App'],
|
|
1712
1878
|
['hosting', 'Hosting'],
|
|
1879
|
+
['promote', 'Promote'],
|
|
1713
1880
|
['uniweb', 'Uniweb'],
|
|
1714
1881
|
['health', 'Health'],
|
|
1715
1882
|
['dev', 'Dev server']
|
package/src/framework-index.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-16T19:23:17.851Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
6
|
"version": "1.7.1"
|
|
7
7
|
},
|
|
8
8
|
"@uniweb/build": {
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.24.0"
|
|
10
10
|
},
|
|
11
11
|
"@uniweb/content-reader": {
|
|
12
12
|
"version": "1.5.11"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"version": "1.3.2"
|
|
61
61
|
},
|
|
62
62
|
"@uniweb/unipress": {
|
|
63
|
-
"version": "1.1.
|
|
63
|
+
"version": "1.1.41"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"templates": {
|
package/src/index.js
CHANGED
|
@@ -1059,6 +1059,14 @@ async function main() {
|
|
|
1059
1059
|
await exitWhenDrained(result?.exitCode ?? 0)
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
|
+
// Handle promote command — a site's Promote: getting found, networks, posts, campaigns.
|
|
1063
|
+
// Runs anywhere: inside a project it acts on the site the project is synced to.
|
|
1064
|
+
if (command === 'promote') {
|
|
1065
|
+
const { promote } = await import('./commands/promote.js')
|
|
1066
|
+
const result = await promote(args.slice(1))
|
|
1067
|
+
await exitWhenDrained(result?.exitCode ?? 0)
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1062
1070
|
// Handle org command (new-backend orgs/units — publish-scope management)
|
|
1063
1071
|
if (command === 'org') {
|
|
1064
1072
|
const { org } = await import('./commands/org.js')
|
|
@@ -2136,7 +2144,8 @@ Outside a repository there is nothing to merge against: the files are rewritten
|
|
|
2136
2144
|
what the backend holds, after asking if any of them are yours.
|
|
2137
2145
|
|
|
2138
2146
|
${colors.bright}Options:${colors.reset}
|
|
2139
|
-
--dry-run
|
|
2147
|
+
--dry-run Name each file it would change, and in a YAML file the keys;
|
|
2148
|
+
write nothing (outside a repository: what it would fetch)
|
|
2140
2149
|
--force Take the backend's version, discarding local changes
|
|
2141
2150
|
--no-records Pull pages only; skip records
|
|
2142
2151
|
--no-assets Don't download media; the content keeps its URLs
|
|
@@ -2499,6 +2508,7 @@ ${colors.bright}Commands:${colors.reset}
|
|
|
2499
2508
|
status What changed in the app, in git and in Uniweb — and what to run
|
|
2500
2509
|
forget Forget a backend, or --all to make a copied project a new one
|
|
2501
2510
|
site <cmd> The sites in a workspace: list, unpublish, delete
|
|
2511
|
+
promote <cmd> A site's Promote: its posts and ads, getting found, and the accounts
|
|
2502
2512
|
org <cmd> The organizations you belong to: list, create
|
|
2503
2513
|
inspect <path> Inspect parsed content shape of a markdown file or folder
|
|
2504
2514
|
docs Generate component documentation
|
package/src/utils/flag-guard.js
CHANGED
|
@@ -111,6 +111,12 @@ const VERBS = {
|
|
|
111
111
|
* `--org` / `--personal`.
|
|
112
112
|
*/
|
|
113
113
|
site: ['--json', '--yes', '--clear', '--org', '--personal'],
|
|
114
|
+
/**
|
|
115
|
+
* `promote <command>` — a site's Promote. `--json` is every command's porcelain; `--site` names
|
|
116
|
+
* a site this project isn't synced to; `--at` and `--now` are `send`'s time; `--yes` is what
|
|
117
|
+
* `start` and `resume` take in place of their question; the workspace is `--org` / `--personal`.
|
|
118
|
+
*/
|
|
119
|
+
promote: ['--json', '--site', '--at', '--now', '--yes', '--org', '--personal'],
|
|
114
120
|
status: [
|
|
115
121
|
'--json', '--offline', '--dry-run',
|
|
116
122
|
'--force', '--no-verify', '--no-validate', '--yes', '--org', '--personal',
|
package/src/utils/status-next.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* sign in → settle conflicts → finish a merge → take what others did (refresh, or pull)
|
|
10
10
|
* → commit what else changed → push → push to git → go live → deploy to another host
|
|
11
|
-
* → update Uniweb → read doctor's findings
|
|
11
|
+
* → update Uniweb → read doctor's findings → what Promote needs of the person
|
|
12
12
|
*
|
|
13
13
|
* A commit of the project's other files needs nothing above it — refresh's `git pull` keeps
|
|
14
14
|
* uncommitted work (`--autostash`, `utils/git.js::pullRemote`) — and comes before the push,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* already does, and drops duplicates.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
const ORDER = ['login', 'conflicts', 'merge', 'refresh', 'pull', 'commit', 'push', 'gitpush', 'publish', 'deploy', 'update', 'doctor']
|
|
22
|
+
const ORDER = ['login', 'conflicts', 'merge', 'refresh', 'pull', 'commit', 'push', 'gitpush', 'publish', 'deploy', 'update', 'doctor', 'promote']
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @param {Array<{ step: string, command: string|null, why: string, ask?: boolean }>} proposals
|