@byline/cli 3.20.4 → 4.0.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/README.md +42 -2
- package/dist/cli.js +5 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +1 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +10 -14
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/setup-checks.d.ts +9 -0
- package/dist/commands/setup-checks.d.ts.map +1 -1
- package/dist/commands/setup-checks.js +43 -18
- package/dist/commands/setup-checks.js.map +1 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/setup.js.map +1 -1
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +6 -0
- package/dist/context.js.map +1 -1
- package/dist/lib/dependency-version.d.ts +12 -0
- package/dist/lib/dependency-version.d.ts.map +1 -0
- package/dist/lib/dependency-version.js +101 -0
- package/dist/lib/dependency-version.js.map +1 -0
- package/dist/lib/planned-writes.d.ts +8 -0
- package/dist/lib/planned-writes.d.ts.map +1 -0
- package/dist/lib/planned-writes.js +177 -0
- package/dist/lib/planned-writes.js.map +1 -0
- package/dist/lib/planned-writes.test.d.ts +2 -0
- package/dist/lib/planned-writes.test.d.ts.map +1 -0
- package/dist/lib/planned-writes.test.js +113 -0
- package/dist/lib/planned-writes.test.js.map +1 -0
- package/dist/lib/release-policy.d.ts +12 -0
- package/dist/lib/release-policy.d.ts.map +1 -0
- package/dist/lib/release-policy.js +20 -0
- package/dist/lib/release-policy.js.map +1 -0
- package/dist/lib/release-policy.test.d.ts +2 -0
- package/dist/lib/release-policy.test.d.ts.map +1 -0
- package/dist/lib/release-policy.test.js +36 -0
- package/dist/lib/release-policy.test.js.map +1 -0
- package/dist/lib/route-config.d.ts +40 -0
- package/dist/lib/route-config.d.ts.map +1 -0
- package/dist/lib/route-config.js +322 -0
- package/dist/lib/route-config.js.map +1 -0
- package/dist/lib/static-config.d.ts +20 -0
- package/dist/lib/static-config.d.ts.map +1 -0
- package/dist/lib/static-config.js +444 -0
- package/dist/lib/static-config.js.map +1 -0
- package/dist/lib/static-config.test.d.ts +2 -0
- package/dist/lib/static-config.test.d.ts.map +1 -0
- package/dist/lib/static-config.test.js +105 -0
- package/dist/lib/static-config.test.js.map +1 -0
- package/dist/lib/template-hook-boundary.test.node.d.ts +2 -0
- package/dist/lib/template-hook-boundary.test.node.d.ts.map +1 -0
- package/dist/lib/template-hook-boundary.test.node.js +30 -0
- package/dist/lib/template-hook-boundary.test.node.js.map +1 -0
- package/dist/lib/template-path.d.ts +5 -0
- package/dist/lib/template-path.d.ts.map +1 -0
- package/dist/lib/template-path.js +9 -0
- package/dist/lib/template-path.js.map +1 -0
- package/dist/lib/workspace-root.d.ts +28 -0
- package/dist/lib/workspace-root.d.ts.map +1 -0
- package/dist/lib/workspace-root.js +205 -0
- package/dist/lib/workspace-root.js.map +1 -0
- package/dist/manifest/deps.d.ts +1 -1
- package/dist/manifest/deps.d.ts.map +1 -1
- package/dist/manifest/deps.js +18 -8
- package/dist/manifest/deps.js.map +1 -1
- package/dist/phases/deps.d.ts +14 -1
- package/dist/phases/deps.d.ts.map +1 -1
- package/dist/phases/deps.js +312 -137
- package/dist/phases/deps.js.map +1 -1
- package/dist/phases/deps.test.d.ts +2 -0
- package/dist/phases/deps.test.d.ts.map +1 -0
- package/dist/phases/deps.test.js +343 -0
- package/dist/phases/deps.test.js.map +1 -0
- package/dist/phases/preflight.d.ts.map +1 -1
- package/dist/phases/preflight.js +59 -11
- package/dist/phases/preflight.js.map +1 -1
- package/dist/phases/prompts.d.ts +2 -0
- package/dist/phases/prompts.d.ts.map +1 -1
- package/dist/phases/prompts.js +51 -2
- package/dist/phases/prompts.js.map +1 -1
- package/dist/phases/routes-ui.test.d.ts +2 -0
- package/dist/phases/routes-ui.test.d.ts.map +1 -0
- package/dist/phases/routes-ui.test.js +766 -0
- package/dist/phases/routes-ui.test.js.map +1 -0
- package/dist/phases/routes.d.ts +4 -1
- package/dist/phases/routes.d.ts.map +1 -1
- package/dist/phases/routes.js +610 -122
- package/dist/phases/routes.js.map +1 -1
- package/dist/phases/scaffold-smoke.test.d.ts +2 -0
- package/dist/phases/scaffold-smoke.test.d.ts.map +1 -0
- package/dist/phases/scaffold-smoke.test.js +168 -0
- package/dist/phases/scaffold-smoke.test.js.map +1 -0
- package/dist/phases/scaffold.d.ts +4 -1
- package/dist/phases/scaffold.d.ts.map +1 -1
- package/dist/phases/scaffold.js +275 -72
- package/dist/phases/scaffold.js.map +1 -1
- package/dist/phases/scaffold.test.d.ts +2 -0
- package/dist/phases/scaffold.test.d.ts.map +1 -0
- package/dist/phases/scaffold.test.js +178 -0
- package/dist/phases/scaffold.test.js.map +1 -0
- package/dist/phases/ui.d.ts +4 -1
- package/dist/phases/ui.d.ts.map +1 -1
- package/dist/phases/ui.js +51 -59
- package/dist/phases/ui.js.map +1 -1
- package/dist/phases/wire/index.d.ts.map +1 -1
- package/dist/phases/wire/index.js +10 -6
- package/dist/phases/wire/index.js.map +1 -1
- package/dist/phases/wire/shared.d.ts +4 -1
- package/dist/phases/wire/shared.d.ts.map +1 -1
- package/dist/phases/wire/vite-config.d.ts.map +1 -1
- package/dist/phases/wire/vite-config.js +69 -20
- package/dist/phases/wire/vite-config.js.map +1 -1
- package/dist/phases/wire/vite-config.test.d.ts +2 -0
- package/dist/phases/wire/vite-config.test.d.ts.map +1 -0
- package/dist/phases/wire/vite-config.test.js +97 -0
- package/dist/phases/wire/vite-config.test.js.map +1 -0
- package/dist/prompts.d.ts +1 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +7 -2
- package/dist/prompts.js.map +1 -1
- package/dist/runner.js +1 -1
- package/dist/runner.js.map +1 -1
- package/dist/templates/byline/admin.config.ts +8 -7
- package/dist/templates/byline/clients.server.ts +77 -0
- package/dist/templates/byline/collection-types.contract.ts +67 -0
- package/dist/templates/byline/collections/index.ts +17 -0
- package/dist/templates/byline/collections/server-hooks.ts +7 -0
- package/dist/templates/byline/generated/collection-types.ts +11 -0
- package/dist/templates/byline/i18n.ts +3 -3
- package/dist/templates/byline/locales.ts +9 -9
- package/dist/templates/byline/public.ts +12 -0
- package/dist/templates/byline/routes.ts +7 -6
- package/dist/templates/byline/scripts/generate-types.ts +81 -0
- package/dist/templates/byline/server.config.ts +5 -5
- package/dist/templates/byline-examples/admin.config.ts +18 -21
- package/dist/templates/byline-examples/blocks/photo-block.ts +3 -2
- package/dist/templates/byline-examples/clients.server.ts +77 -0
- package/dist/templates/byline-examples/collection-types.contract.ts +67 -0
- package/dist/templates/byline-examples/collections/docs/hooks.ts +30 -20
- package/dist/templates/byline-examples/collections/docs/schema.ts +18 -18
- package/dist/templates/byline-examples/collections/index.ts +22 -0
- package/dist/templates/byline-examples/collections/media/components/media-list-view.tsx +11 -6
- package/dist/templates/byline-examples/collections/media/schema.ts +16 -0
- package/dist/templates/byline-examples/collections/news/schema.ts +17 -3
- package/dist/templates/byline-examples/collections/news-categories/schema.ts +13 -0
- package/dist/templates/byline-examples/collections/pages/schema.ts +13 -0
- package/dist/templates/byline-examples/collections/server-hooks.ts +8 -0
- package/dist/templates/byline-examples/fields/ai-text.ts +1 -1
- package/dist/templates/byline-examples/fields/ai-textarea.ts +1 -1
- package/dist/templates/byline-examples/fields/lexical-richtext-ai.tsx +3 -3
- package/dist/templates/byline-examples/generated/collection-types.ts +139 -0
- package/dist/templates/byline-examples/i18n.ts +3 -3
- package/dist/templates/byline-examples/locales.ts +9 -9
- package/dist/templates/byline-examples/public.ts +12 -0
- package/dist/templates/byline-examples/routes.ts +7 -6
- package/dist/templates/byline-examples/scripts/backfill-version-locales.ts +1 -1
- package/dist/templates/byline-examples/scripts/generate-types.ts +81 -0
- package/dist/templates/byline-examples/scripts/import-docs.ts +11 -12
- package/dist/templates/byline-examples/scripts/lib/mdast-to-lexical.test.node.ts +93 -233
- package/dist/templates/byline-examples/scripts/lib/mdast-to-lexical.ts +2 -2
- package/dist/templates/byline-examples/scripts/lib/strip-leading-h1.test.node.ts +0 -4
- package/dist/templates/byline-examples/scripts/re-anchor.ts +3 -3
- package/dist/templates/byline-examples/scripts/regenerate-media.ts +6 -5
- package/dist/templates/byline-examples/server.config.ts +6 -15
- package/dist/templates/host/vite.config.ts +2 -0
- package/dist/templates/routes/_byline/admin/collections/$collection/$id/api.tsx +1 -6
- package/dist/templates/routes/_byline/admin/collections/$collection/$id/history.tsx +1 -7
- package/dist/templates/routes/_byline/admin/collections/$collection/$id/index.tsx +1 -6
- package/dist/templates/routes/_byline/route.lazy.tsx +1 -2
- package/dist/templates/routes/_byline/route.tsx +1 -1
- package/dist/templates/ui-byline/blocks/photo-block/index.tsx +18 -23
- package/dist/templates/ui-byline/blocks/richtext-block/index.tsx +1 -1
- package/dist/templates/ui-byline/components/admonition/index.tsx +11 -8
- package/dist/templates/ui-byline/components/code/code.tsx +6 -4
- package/dist/templates/ui-byline/components/link/lang-link.tsx +4 -8
- package/dist/templates/ui-byline/components/link/link-field.tsx +3 -2
- package/dist/templates/ui-byline/components/link/link-lexical.tsx +9 -8
- package/dist/templates/ui-byline/render-blocks.tsx +38 -38
- package/dist/templates/ui-byline/types/content.ts +25 -0
- package/dist/templates/ui-byline/types/i18n.ts +4 -8
- package/dist/test-helpers.d.ts +5 -0
- package/dist/test-helpers.d.ts.map +1 -0
- package/dist/test-helpers.js +52 -0
- package/dist/test-helpers.js.map +1 -0
- package/dist/types.d.ts +21 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/ui-template-contract.test.d.ts +2 -0
- package/dist/ui-template-contract.test.d.ts.map +1 -0
- package/dist/ui-template-contract.test.js +130 -0
- package/dist/ui-template-contract.test.js.map +1 -0
- package/dist/workspace-root.test.d.ts +2 -0
- package/dist/workspace-root.test.d.ts.map +1 -0
- package/dist/workspace-root.test.js +307 -0
- package/dist/workspace-root.test.js.map +1 -0
- package/package.json +9 -1
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
* registry). `byline/i18n.ts` consumes these to assemble the
|
|
13
13
|
* `defineServerConfig` / `defineClientConfig` payload.
|
|
14
14
|
*
|
|
15
|
-
* Kept separate from `byline/i18n.ts` so
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* (`@byline/i18n/admin`) that `i18n.ts` depends on.
|
|
19
|
-
* would; importing this won't — which keeps the lazy
|
|
20
|
-
* (`src/routes/_byline/route.lazy.tsx`) intact.
|
|
15
|
+
* Kept separate from `byline/i18n.ts` so `byline/public.ts` can expose the
|
|
16
|
+
* locale arrays to a public frontend (or a collection schema file loaded
|
|
17
|
+
* outside Vite — e.g. when running seeds via tsx) without dragging in the
|
|
18
|
+
* admin translation graph (`@byline/i18n/admin`) that `i18n.ts` depends on.
|
|
19
|
+
* Importing `byline/i18n.ts` would; importing this won't — which keeps the lazy
|
|
20
|
+
* admin/public bundle split (`src/routes/_byline/route.lazy.tsx`) intact.
|
|
21
21
|
*
|
|
22
22
|
* `interface` locales govern the CMS admin UI language; `content` locales
|
|
23
23
|
* govern the languages a document can be published in.
|
|
@@ -33,10 +33,10 @@ export interface LocaleDefinition {
|
|
|
33
33
|
// (or a third-party plugin merged in via `mergeTranslations(...)`).
|
|
34
34
|
// `adminTranslations({ locales })` in `byline/i18n.ts` throws at boot if a
|
|
35
35
|
// requested code is not bundled — `@byline/i18n/admin` ships English and French.
|
|
36
|
-
export const interfaceLocales
|
|
36
|
+
export const interfaceLocales = [
|
|
37
37
|
{ code: 'en', label: 'English' },
|
|
38
38
|
{ code: 'fr', label: 'Français' },
|
|
39
|
-
]
|
|
39
|
+
] as const satisfies readonly LocaleDefinition[]
|
|
40
40
|
|
|
41
41
|
/** Locales a document can be published in. */
|
|
42
42
|
export const contentLocales = [
|
|
@@ -44,4 +44,4 @@ export const contentLocales = [
|
|
|
44
44
|
{ code: 'fr', label: 'Français' },
|
|
45
45
|
{ code: 'es', label: 'Español' },
|
|
46
46
|
{ code: 'de', label: 'Deutsch' },
|
|
47
|
-
] as const
|
|
47
|
+
] as const satisfies readonly LocaleDefinition[]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** Client-safe public configuration. Keep this barrel free of admin and server imports. */
|
|
10
|
+
export { contentLocales, interfaceLocales } from './locales.js'
|
|
11
|
+
export { routes } from './routes.js'
|
|
12
|
+
export type { LocaleDefinition } from './locales.js'
|
|
@@ -7,17 +7,18 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* URL
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Client-safe URL paths for admin, sign-in, and the future public API.
|
|
11
|
+
* Resolve once at this client-safe configuration boundary so consumers only
|
|
12
|
+
* read canonical paths.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import { resolveRoutes } from '@byline/core'
|
|
16
16
|
|
|
17
|
-
export const routes
|
|
17
|
+
export const routes = resolveRoutes({
|
|
18
18
|
admin: '/admin',
|
|
19
19
|
api: '/api',
|
|
20
|
-
|
|
20
|
+
signIn: '/sign-in',
|
|
21
|
+
})
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Fallback used by both server and admin entry points when no
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Idempotent — safe to re-run. Uses the installation's configured default
|
|
17
17
|
* content locale (resolved from byline/i18n.ts via the server config).
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* pnpm tsx byline/scripts/backfill-version-locales.ts
|
|
20
20
|
*
|
|
21
21
|
* See docs/07-internationalization/index.md.
|
|
22
22
|
*/
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs'
|
|
3
|
+
import { dirname, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
5
|
+
|
|
6
|
+
import { emitCollectionTypes } from '@byline/core/codegen'
|
|
7
|
+
|
|
8
|
+
import { collections } from '../collections/index.js'
|
|
9
|
+
|
|
10
|
+
const defaultOutputPath = fileURLToPath(
|
|
11
|
+
new URL('../generated/collection-types.ts', import.meta.url)
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
export type GenerationStatus = 'current' | 'unchanged' | 'written'
|
|
15
|
+
|
|
16
|
+
export function writeCollectionTypes(
|
|
17
|
+
outputPath: string,
|
|
18
|
+
source: string,
|
|
19
|
+
check: boolean
|
|
20
|
+
): GenerationStatus {
|
|
21
|
+
const existing = existsSync(outputPath) ? readFileSync(outputPath, 'utf8') : undefined
|
|
22
|
+
|
|
23
|
+
if (check) {
|
|
24
|
+
if (existing === undefined) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`generated collection types are missing: ${outputPath}. Run pnpm byline:generate`
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
if (existing !== source) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`generated collection types are stale: ${outputPath}. Run pnpm byline:generate`
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
return 'current'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (existing === source) return 'unchanged'
|
|
38
|
+
|
|
39
|
+
mkdirSync(dirname(outputPath), { recursive: true })
|
|
40
|
+
const temporaryPath = `${outputPath}.${process.pid}.${randomUUID()}.tmp`
|
|
41
|
+
try {
|
|
42
|
+
writeFileSync(temporaryPath, source, 'utf8')
|
|
43
|
+
renameSync(temporaryPath, outputPath)
|
|
44
|
+
} finally {
|
|
45
|
+
rmSync(temporaryPath, { force: true })
|
|
46
|
+
}
|
|
47
|
+
return 'written'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function parseArgs(args: readonly string[]): { check: boolean } {
|
|
51
|
+
const unknown = args.filter((arg) => arg !== '--check')
|
|
52
|
+
if (unknown.length > 0) throw new Error(`unknown argument: ${unknown.join(', ')}`)
|
|
53
|
+
if (args.filter((arg) => arg === '--check').length > 1) {
|
|
54
|
+
throw new Error('duplicate argument: --check')
|
|
55
|
+
}
|
|
56
|
+
return { check: args.includes('--check') }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function generateCollectionTypes(
|
|
60
|
+
outputPath = defaultOutputPath,
|
|
61
|
+
check = false
|
|
62
|
+
): { hash: string; status: GenerationStatus } {
|
|
63
|
+
const { source, hash } = emitCollectionTypes(collections)
|
|
64
|
+
return { hash, status: writeCollectionTypes(outputPath, source, check) }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function main(): void {
|
|
68
|
+
const { check } = parseArgs(process.argv.slice(2))
|
|
69
|
+
const { hash, status } = generateCollectionTypes(defaultOutputPath, check)
|
|
70
|
+
console.log(`collection types: ${collections.length} collections ${hash.slice(0, 12)} ${status}`)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const entryPath = process.argv[1]
|
|
74
|
+
if (entryPath !== undefined && pathToFileURL(resolve(entryPath)).href === import.meta.url) {
|
|
75
|
+
try {
|
|
76
|
+
main()
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error(`collection type generation failed: ${(error as Error).message}`)
|
|
79
|
+
process.exitCode = 1
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -12,11 +12,6 @@
|
|
|
12
12
|
// pnpm tsx byline/scripts/import-docs.ts ../../docs/**/*.md --verbose
|
|
13
13
|
// pnpm tsx byline/scripts/import-docs.ts '../../docs/*.md' --dry-run --verbose
|
|
14
14
|
// pnpm tsx byline/scripts/import-docs.ts ../../docs/**/*.md
|
|
15
|
-
//
|
|
16
|
-
// Run tests...
|
|
17
|
-
//
|
|
18
|
-
// pnpm vitest run --mode=node byline/scripts/lib/
|
|
19
|
-
|
|
20
15
|
/**
|
|
21
16
|
* Import markdown files into the `docs` collection.
|
|
22
17
|
*
|
|
@@ -59,7 +54,7 @@ import { glob } from 'node:fs/promises'
|
|
|
59
54
|
import { basename, dirname, join, resolve } from 'node:path'
|
|
60
55
|
|
|
61
56
|
import { createSuperAdminContext } from '@byline/auth'
|
|
62
|
-
import { type CollectionHandle, createBylineClient } from '@byline/client'
|
|
57
|
+
import { type BylineClient, type CollectionHandle, createBylineClient } from '@byline/client'
|
|
63
58
|
import { getCollectionDefinition, getServerConfig, slugify } from '@byline/core'
|
|
64
59
|
|
|
65
60
|
import { type DocFrontmatter, parseDocFile } from './lib/frontmatter.js'
|
|
@@ -67,12 +62,16 @@ import { type MdastToLexicalWarning, mdastToLexical } from './lib/mdast-to-lexic
|
|
|
67
62
|
import { parseBodyToMdast } from './lib/parse-markdown.js'
|
|
68
63
|
import { type DocLinkRewriteWarning, rewriteDocLinks } from './lib/rewrite-doc-links.js'
|
|
69
64
|
import { stripLeadingH1IfMatches } from './lib/strip-leading-h1.js'
|
|
65
|
+
import type { CollectionFieldsByPath, DocsFields } from '../generated/collection-types.js'
|
|
70
66
|
|
|
71
67
|
const DOCS_COLLECTION = 'docs'
|
|
72
68
|
const MEDIA_COLLECTION = 'media'
|
|
73
69
|
const DOCS_URL_PREFIX = '/docs'
|
|
74
70
|
const DEFAULT_IMPORT_STATUS = 'published'
|
|
75
71
|
|
|
72
|
+
type AppBylineClient = BylineClient<CollectionFieldsByPath>
|
|
73
|
+
type DocsHandle = CollectionHandle<DocsFields>
|
|
74
|
+
|
|
76
75
|
interface Flags {
|
|
77
76
|
dryRun: boolean
|
|
78
77
|
verbose: boolean
|
|
@@ -135,7 +134,7 @@ interface ResolvedFeatureImage {
|
|
|
135
134
|
}
|
|
136
135
|
|
|
137
136
|
async function resolveFeatureImage(
|
|
138
|
-
client:
|
|
137
|
+
client: AppBylineClient,
|
|
139
138
|
path: string
|
|
140
139
|
): Promise<ResolvedFeatureImage | null> {
|
|
141
140
|
const mediaCollectionId = await client.resolveCollectionId(MEDIA_COLLECTION)
|
|
@@ -186,7 +185,7 @@ function derivePath(frontmatter: DocFrontmatter, locale: string): string {
|
|
|
186
185
|
* workflow doesn't include the target or when already at/past it.
|
|
187
186
|
*/
|
|
188
187
|
async function walkToStatus(
|
|
189
|
-
handle:
|
|
188
|
+
handle: DocsHandle,
|
|
190
189
|
documentId: string,
|
|
191
190
|
workflowStatuses: readonly { name: string }[],
|
|
192
191
|
currentStatus: string,
|
|
@@ -230,8 +229,8 @@ function buildSourcePathMap(files: string[], defaultLocale: string): Map<string,
|
|
|
230
229
|
|
|
231
230
|
async function processFile(
|
|
232
231
|
filePath: string,
|
|
233
|
-
client:
|
|
234
|
-
handle:
|
|
232
|
+
client: AppBylineClient,
|
|
233
|
+
handle: DocsHandle,
|
|
235
234
|
flags: Flags,
|
|
236
235
|
pathMap: Map<string, string>
|
|
237
236
|
): Promise<ProcessResult> {
|
|
@@ -340,7 +339,7 @@ function parentIndexFile(filePath: string): string {
|
|
|
340
339
|
* processed in sorted order, so prefix order carries straight through.
|
|
341
340
|
*/
|
|
342
341
|
async function placeTreeFromDirectories(
|
|
343
|
-
handle:
|
|
342
|
+
handle: DocsHandle,
|
|
344
343
|
results: ProcessResult[]
|
|
345
344
|
): Promise<void> {
|
|
346
345
|
const placeable = results.filter(
|
|
@@ -392,7 +391,7 @@ async function run(): Promise<void> {
|
|
|
392
391
|
|
|
393
392
|
const config = getServerConfig()
|
|
394
393
|
const requestContext = createSuperAdminContext({ id: 'import-docs-script' })
|
|
395
|
-
const client = createBylineClient({ config, requestContext })
|
|
394
|
+
const client = createBylineClient<CollectionFieldsByPath>({ config, requestContext })
|
|
396
395
|
const handle = client.collection(DOCS_COLLECTION)
|
|
397
396
|
|
|
398
397
|
// Pre-pass: map each source file to the path its imported doc will
|