uniweb 0.13.16 → 0.14.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.
Files changed (65) hide show
  1. package/README.md +1 -1
  2. package/package.json +7 -7
  3. package/partials/agents.md +51 -0
  4. package/src/backend/client.js +173 -40
  5. package/src/backend/data-bundle.js +15 -3
  6. package/src/backend/foundation-bring-along.js +76 -21
  7. package/src/backend/payment-handoff.js +28 -9
  8. package/src/backend/site-media.js +147 -19
  9. package/src/backend/site-sync.js +362 -40
  10. package/src/commands/add.js +575 -273
  11. package/src/commands/build.js +160 -57
  12. package/src/commands/clone.js +79 -26
  13. package/src/commands/content.js +11 -7
  14. package/src/commands/deploy.js +80 -32
  15. package/src/commands/dev.js +39 -17
  16. package/src/commands/docs.js +44 -16
  17. package/src/commands/doctor.js +338 -82
  18. package/src/commands/export.js +15 -7
  19. package/src/commands/handoff.js +6 -2
  20. package/src/commands/i18n.js +248 -99
  21. package/src/commands/inspect.js +48 -19
  22. package/src/commands/invite.js +9 -3
  23. package/src/commands/org.js +19 -5
  24. package/src/commands/publish.js +229 -60
  25. package/src/commands/pull.js +157 -48
  26. package/src/commands/push.js +144 -42
  27. package/src/commands/refresh.js +37 -10
  28. package/src/commands/register.js +235 -64
  29. package/src/commands/rename.js +126 -46
  30. package/src/commands/runtime.js +74 -24
  31. package/src/commands/status.js +48 -15
  32. package/src/commands/sync.js +7 -2
  33. package/src/commands/template.js +12 -4
  34. package/src/commands/update.js +263 -87
  35. package/src/commands/validate.js +115 -32
  36. package/src/framework-index.json +16 -14
  37. package/src/index.js +298 -145
  38. package/src/templates/fetchers/github.js +7 -7
  39. package/src/templates/fetchers/npm.js +3 -3
  40. package/src/templates/fetchers/release.js +21 -18
  41. package/src/templates/index.js +34 -12
  42. package/src/templates/processor.js +44 -12
  43. package/src/templates/resolver.js +42 -15
  44. package/src/templates/validator.js +14 -7
  45. package/src/utils/asset-upload.js +90 -22
  46. package/src/utils/code-upload.js +62 -37
  47. package/src/utils/config.js +31 -10
  48. package/src/utils/dep-survey.js +33 -7
  49. package/src/utils/destination-prompt.js +27 -17
  50. package/src/utils/git.js +66 -22
  51. package/src/utils/host-prompt.js +4 -3
  52. package/src/utils/install-integrity.js +8 -4
  53. package/src/utils/interactive.js +3 -3
  54. package/src/utils/json-file.js +6 -2
  55. package/src/utils/names.js +15 -6
  56. package/src/utils/placement.js +16 -8
  57. package/src/utils/registry-auth.js +185 -57
  58. package/src/utils/registry-orgs.js +142 -53
  59. package/src/utils/runtime-upload.js +52 -14
  60. package/src/utils/scaffold.js +55 -14
  61. package/src/utils/site-content-refs.js +3 -1
  62. package/src/utils/update-check.js +43 -17
  63. package/src/utils/workspace.js +13 -7
  64. package/src/versions.js +18 -7
  65. package/templates/site/_gitignore +5 -0
@@ -18,7 +18,7 @@ const colors = {
18
18
  reset: '\x1b[0m',
19
19
  red: '\x1b[31m',
20
20
  yellow: '\x1b[33m',
21
- dim: '\x1b[2m',
21
+ dim: '\x1b[2m'
22
22
  }
23
23
 
24
24
  /**
@@ -30,7 +30,7 @@ function parseArgs(args) {
30
30
  raw: false,
31
31
  full: false,
32
32
  sequence: false,
33
- help: false,
33
+ help: false
34
34
  }
35
35
 
36
36
  for (const arg of args) {
@@ -52,15 +52,19 @@ async function loadDependencies() {
52
52
  try {
53
53
  const [contentReader, semanticParser] = await Promise.all([
54
54
  import('@uniweb/content-reader'),
55
- import('@uniweb/semantic-parser'),
55
+ import('@uniweb/semantic-parser')
56
56
  ])
57
57
  return {
58
58
  markdownToProseMirror: contentReader.markdownToProseMirror,
59
- parseContent: semanticParser.parseContent,
59
+ parseContent: semanticParser.parseContent
60
60
  }
61
61
  } catch {
62
- console.error(`${colors.red}✗${colors.reset} Could not load @uniweb/content-reader or @uniweb/semantic-parser.`)
63
- console.error(` These packages must be installed in the workspace (they come with @uniweb/build).`)
62
+ console.error(
63
+ `${colors.red}✗${colors.reset} Could not load @uniweb/content-reader or @uniweb/semantic-parser.`
64
+ )
65
+ console.error(
66
+ ` These packages must be installed in the workspace (they come with @uniweb/build).`
67
+ )
64
68
  process.exit(1)
65
69
  }
66
70
  }
@@ -79,7 +83,9 @@ function extractFrontmatter(content) {
79
83
  try {
80
84
  frontMatter = yaml.load(parts[1]) || {}
81
85
  } catch (err) {
82
- console.warn(`${colors.yellow}Warning: YAML parse error: ${err.message}${colors.reset}`)
86
+ console.warn(
87
+ `${colors.yellow}Warning: YAML parse error: ${err.message}${colors.reset}`
88
+ )
83
89
  frontMatter = {}
84
90
  }
85
91
  markdown = parts.slice(2).join('---\n')
@@ -94,12 +100,24 @@ function extractFrontmatter(content) {
94
100
  * Exact match of content-collector line 642.
95
101
  */
96
102
  function splitParams(frontMatter) {
97
- const { type, component, preset, input, props, fetch, data, id, background, theme, ...params } = frontMatter
103
+ const {
104
+ type,
105
+ component,
106
+ preset,
107
+ input,
108
+ props,
109
+ fetch,
110
+ data,
111
+ id,
112
+ background,
113
+ theme,
114
+ ...params
115
+ } = frontMatter
98
116
  return {
99
117
  type: type || component || null,
100
118
  preset: preset || null,
101
119
  reserved: { data, id, background, theme, input },
102
- params,
120
+ params
103
121
  }
104
122
  }
105
123
 
@@ -125,12 +143,12 @@ function extractInsets(doc) {
125
143
  refId,
126
144
  type: component,
127
145
  params: Object.keys(params).length > 0 ? params : {},
128
- description: alt || null,
146
+ description: alt || null
129
147
  })
130
148
  // Replace in-place with placeholder
131
149
  doc.content[i] = {
132
150
  type: 'inset_placeholder',
133
- attrs: { refId },
151
+ attrs: { refId }
134
152
  }
135
153
  }
136
154
  }
@@ -159,7 +177,7 @@ function guaranteeItemStructure(item) {
159
177
  documents: item.documents || [],
160
178
  forms: item.forms || [],
161
179
  quotes: item.quotes || [],
162
- headings: item.headings || [],
180
+ headings: item.headings || []
163
181
  }
164
182
  }
165
183
 
@@ -191,7 +209,7 @@ function guaranteeContentStructure(parsedContent) {
191
209
  headings: content.headings || [],
192
210
  items: (content.items || []).map(guaranteeItemStructure),
193
211
  sequence: content.sequence || [],
194
- raw: content.raw,
212
+ raw: content.raw
195
213
  }
196
214
  }
197
215
 
@@ -205,11 +223,16 @@ function removeEmptyFields(obj) {
205
223
  if (value === null || value === undefined) continue
206
224
  if (value === '') continue
207
225
  if (Array.isArray(value) && value.length === 0) continue
208
- if (typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length === 0) continue
226
+ if (
227
+ typeof value === 'object' &&
228
+ !Array.isArray(value) &&
229
+ Object.keys(value).length === 0
230
+ )
231
+ continue
209
232
 
210
233
  // Recursively clean items
211
234
  if (key === 'items' && Array.isArray(value)) {
212
- result[key] = value.map(item => removeEmptyFields(item))
235
+ result[key] = value.map((item) => removeEmptyFields(item))
213
236
  } else {
214
237
  result[key] = value
215
238
  }
@@ -329,7 +352,9 @@ Options:
329
352
 
330
353
  if (stat.isFile()) {
331
354
  if (extname(target) !== '.md') {
332
- console.error(`${colors.red}✗${colors.reset} Expected a .md file: ${flags.target}`)
355
+ console.error(
356
+ `${colors.red}✗${colors.reset} Expected a .md file: ${flags.target}`
357
+ )
333
358
  process.exit(1)
334
359
  }
335
360
  const content = readFileSync(target, 'utf8')
@@ -337,15 +362,19 @@ Options:
337
362
  console.log(JSON.stringify(result, null, 2))
338
363
  } else if (stat.isDirectory()) {
339
364
  const files = readdirSync(target)
340
- .filter(f => extname(f) === '.md' && !f.startsWith('_') && f !== 'README.md')
365
+ .filter(
366
+ (f) => extname(f) === '.md' && !f.startsWith('_') && f !== 'README.md'
367
+ )
341
368
  .sort(naturalSort)
342
369
 
343
370
  if (files.length === 0) {
344
- console.error(`${colors.yellow}No .md files found in: ${flags.target}${colors.reset}`)
371
+ console.error(
372
+ `${colors.yellow}No .md files found in: ${flags.target}${colors.reset}`
373
+ )
345
374
  return
346
375
  }
347
376
 
348
- const results = files.map(file => {
377
+ const results = files.map((file) => {
349
378
  const content = readFileSync(resolve(target, file), 'utf8')
350
379
  const result = processFile(content, file, deps, options)
351
380
  result._file = file
@@ -9,9 +9,15 @@
9
9
  */
10
10
 
11
11
  export async function invite() {
12
- console.error("\x1b[31m✗\x1b[0m `uniweb invite` isn't available on the new backend yet.")
13
- console.error(' The legacy client-invite flow was retired with the PHP backend.')
14
- console.error(' Invite clients to your foundation from the Uniweb app for now.')
12
+ console.error(
13
+ "\x1b[31m✗\x1b[0m `uniweb invite` isn't available on the new backend yet."
14
+ )
15
+ console.error(
16
+ ' The legacy client-invite flow was retired with the PHP backend.'
17
+ )
18
+ console.error(
19
+ ' Invite clients to your foundation from the Uniweb app for now.'
20
+ )
15
21
  process.exit(1)
16
22
  }
17
23
 
@@ -11,7 +11,13 @@
11
11
  import { BackendClient } from '../backend/client.js'
12
12
  import { validateHandle, bareHandle } from '../utils/registry-orgs.js'
13
13
 
14
- const colors = { reset: '\x1b[0m', bright: '\x1b[1m', dim: '\x1b[2m', red: '\x1b[31m', green: '\x1b[32m' }
14
+ const colors = {
15
+ reset: '\x1b[0m',
16
+ bright: '\x1b[1m',
17
+ dim: '\x1b[2m',
18
+ red: '\x1b[31m',
19
+ green: '\x1b[32m'
20
+ }
15
21
  const error = (m) => console.error(`${colors.red}✗${colors.reset} ${m}`)
16
22
  const success = (m) => console.log(`${colors.green}✓${colors.reset} ${m}`)
17
23
 
@@ -22,12 +28,16 @@ export async function org(args = []) {
22
28
  const client = new BackendClient({ args, command: 'Listing orgs' })
23
29
  const { orgs } = await client.fetchOrgs()
24
30
  if (!orgs.length) {
25
- console.log('You have no orgs yet. Create one: uniweb org create <handle>')
31
+ console.log(
32
+ 'You have no orgs yet. Create one: uniweb org create <handle>'
33
+ )
26
34
  return { exitCode: 0 }
27
35
  }
28
36
  console.log('Your orgs:')
29
37
  for (const u of orgs) {
30
- console.log(` ${colors.bright}@${u.handle}${colors.reset}${u.is_primary ? `${colors.dim} (primary)${colors.reset}` : ''}`)
38
+ console.log(
39
+ ` ${colors.bright}@${u.handle}${colors.reset}${u.is_primary ? `${colors.dim} (primary)${colors.reset}` : ''}`
40
+ )
31
41
  }
32
42
  return { exitCode: 0 }
33
43
  }
@@ -46,8 +56,12 @@ export async function org(args = []) {
46
56
  const client = new BackendClient({ args, command: 'Creating an org' })
47
57
  try {
48
58
  const org = await client.createOrg(handle)
49
- success(`Created ${colors.bright}@${org.handle}${colors.reset} — you're a member${org.is_primary ? ' (primary)' : ''}.`)
50
- console.log(`${colors.dim}Publish under it: uniweb register --scope @${org.handle}${colors.reset}`)
59
+ success(
60
+ `Created ${colors.bright}@${org.handle}${colors.reset} — you're a member${org.is_primary ? ' (primary)' : ''}.`
61
+ )
62
+ console.log(
63
+ `${colors.dim}Publish under it: uniweb register --scope @${org.handle}${colors.reset}`
64
+ )
51
65
  return { exitCode: 0 }
52
66
  } catch (err) {
53
67
  error(err.message)