@byline/cli 6.6.0 → 6.7.1

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.
@@ -0,0 +1,11 @@
1
+ export interface PgConn {
2
+ host: string;
3
+ port: number;
4
+ user: string;
5
+ password: string;
6
+ database: string;
7
+ }
8
+ export declare function buildPgUrl(c: PgConn): string;
9
+ export declare function parsePgUrl(raw: string): PgConn;
10
+ export declare function withDatabase(c: PgConn, database: string): PgConn;
11
+ //# sourceMappingURL=pg-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pg-url.d.ts","sourceRoot":"","sources":["../../src/lib/pg-url.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY9C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE"}
@@ -0,0 +1,22 @@
1
+ export function buildPgUrl(c) {
2
+ const u = encodeURIComponent(c.user);
3
+ const p = encodeURIComponent(c.password);
4
+ return `postgresql://${u}:${p}@${c.host}:${c.port}/${encodeURIComponent(c.database)}`;
5
+ }
6
+ export function parsePgUrl(raw) {
7
+ const url = new URL(raw);
8
+ if (url.protocol !== 'postgresql:' && url.protocol !== 'postgres:') {
9
+ throw new Error(`expected postgresql:// URL, got ${url.protocol}`);
10
+ }
11
+ return {
12
+ host: url.hostname,
13
+ port: url.port ? Number(url.port) : 5432,
14
+ user: decodeURIComponent(url.username),
15
+ password: decodeURIComponent(url.password),
16
+ database: url.pathname.replace(/^\//, '') || 'postgres',
17
+ };
18
+ }
19
+ export function withDatabase(c, database) {
20
+ return { ...c, database };
21
+ }
22
+ //# sourceMappingURL=pg-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pg-url.js","sourceRoot":"","sources":["../../src/lib/pg-url.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACpC,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACxC,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAA;AACvF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IACxB,IAAI,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAA;IACpE,CAAC;IACD,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;QACxC,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC;QACtC,QAAQ,EAAE,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC1C,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,UAAU;KACxD,CAAA;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAS,EAAE,QAAgB;IACtD,OAAO,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAA;AAC3B,CAAC"}
@@ -0,0 +1,9 @@
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
+ export {};
9
+ //# sourceMappingURL=template-docs-hooks.test.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-docs-hooks.test.node.d.ts","sourceRoot":"","sources":["../../src/lib/template-docs-hooks.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,98 @@
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
+ import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
9
+ const search = vi.hoisted(() => ({
10
+ collection: vi.fn(),
11
+ indexDocument: vi.fn(),
12
+ }));
13
+ vi.mock('@byline/client/server', () => ({
14
+ getSystemBylineClient: () => ({ collection: search.collection }),
15
+ }));
16
+ // The template imports `@byline/client/server`, which is not a CLI dependency
17
+ // (it is mocked above), and `src/templates` is excluded from the CLI's
18
+ // TypeScript program. A runtime-only specifier keeps the compiler from
19
+ // following the import while Vitest still resolves and loads the module.
20
+ const templateHooksPath = '../templates/byline-examples/collections/docs/hooks.js';
21
+ let hooks;
22
+ beforeAll(async () => {
23
+ hooks = (await import(/* @vite-ignore */ templateHooksPath)).default;
24
+ });
25
+ function context(overrides) {
26
+ return {
27
+ documentId: 'doc-1',
28
+ collectionPath: 'docs',
29
+ requested: { path: false, availableLocales: false },
30
+ changed: { path: false, availableLocales: false },
31
+ reconciliation: false,
32
+ previousPath: 'intro',
33
+ currentPath: 'intro',
34
+ previousAvailableLocales: ['en'],
35
+ currentAvailableLocales: ['en'],
36
+ ...overrides,
37
+ };
38
+ }
39
+ async function run(ctx) {
40
+ const hook = hooks.afterSystemFieldsChange;
41
+ expect(hook).toBeDefined();
42
+ for (const fn of Array.isArray(hook) ? hook : hook ? [hook] : [])
43
+ await fn(ctx);
44
+ }
45
+ describe('scaffolded docs afterSystemFieldsChange', () => {
46
+ beforeEach(() => {
47
+ vi.clearAllMocks();
48
+ vi.spyOn(console, 'log').mockImplementation(() => { });
49
+ search.indexDocument.mockResolvedValue(undefined);
50
+ search.collection.mockReturnValue({ indexDocument: search.indexDocument });
51
+ });
52
+ it.each([
53
+ ['enabled', ['en'], ['en', 'es']],
54
+ ['disabled', ['en', 'es'], ['en']],
55
+ ])('reindexes once when a locale is %s and the path is untouched', async (_name, before, after) => {
56
+ await run(context({
57
+ requested: { path: false, availableLocales: true },
58
+ changed: { path: false, availableLocales: true },
59
+ previousAvailableLocales: before,
60
+ currentAvailableLocales: after,
61
+ }));
62
+ expect(search.collection).toHaveBeenCalledWith('docs');
63
+ expect(search.indexDocument).toHaveBeenCalledOnce();
64
+ expect(search.indexDocument).toHaveBeenCalledWith('doc-1');
65
+ });
66
+ it('reindexes once for a path change, or a combined path and locale change', async () => {
67
+ await run(context({
68
+ requested: { path: true, availableLocales: false },
69
+ changed: { path: true, availableLocales: false },
70
+ currentPath: 'introduction',
71
+ }));
72
+ await run(context({
73
+ requested: { path: true, availableLocales: true },
74
+ changed: { path: true, availableLocales: true },
75
+ currentPath: 'introduction',
76
+ currentAvailableLocales: ['en', 'es'],
77
+ }));
78
+ expect(search.indexDocument).toHaveBeenCalledTimes(2);
79
+ });
80
+ it('re-runs indexing on an explicit no-op locale reconciliation retry', async () => {
81
+ await run(context({
82
+ requested: { path: false, availableLocales: true },
83
+ changed: { path: false, availableLocales: false },
84
+ reconciliation: true,
85
+ }));
86
+ expect(search.indexDocument).toHaveBeenCalledOnce();
87
+ });
88
+ it('surfaces an indexing failure so the committed-hook flow can report and retry it', async () => {
89
+ const failure = new Error('index unavailable');
90
+ search.indexDocument.mockRejectedValueOnce(failure);
91
+ await expect(run(context({
92
+ requested: { path: false, availableLocales: true },
93
+ changed: { path: false, availableLocales: true },
94
+ currentAvailableLocales: ['en', 'es'],
95
+ }))).rejects.toBe(failure);
96
+ });
97
+ });
98
+ //# sourceMappingURL=template-docs-hooks.test.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-docs-hooks.test.node.js","sourceRoot":"","sources":["../../src/lib/template-docs-hooks.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAExE,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/B,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;IACnB,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE;CACvB,CAAC,CAAC,CAAA;AAEH,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;CACjE,CAAC,CAAC,CAAA;AAIH,8EAA8E;AAC9E,uEAAuE;AACvE,uEAAuE;AACvE,yEAAyE;AACzE,MAAM,iBAAiB,GAAG,wDAAwD,CAAA;AAClF,IAAI,KAA0E,CAAA;AAE9E,SAAS,CAAC,KAAK,IAAI,EAAE;IACnB,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAA;AACtE,CAAC,CAAC,CAAA;AAEF,SAAS,OAAO,CAAC,SAA6C;IAC5D,OAAO;QACL,UAAU,EAAE,OAAO;QACnB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I,CAAC;SACtC,CAAC,CACH,CAAA;QACD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;IACvD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mEAAmE,EAAE,KAAK,IAAI,EAAE;QACjF,MAAM,GAAG,CACP,OAAO,CAAC;YACN,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE;YAClD,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE;YACjD,cAAc,EAAE,IAAI;SACrB,CAAC,CACH,CAAA;QACD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,oBAAoB,EAAE,CAAA;IACrD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iFAAiF,EAAE,KAAK,IAAI,EAAE;QAC/F,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC9C,MAAM,CAAC,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAA;QACnD,MAAM,MAAM,CACV,GAAG,CACD,OAAO,CAAC;YACN,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE;YAClD,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE;YAChD,uBAAuB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;SACtC,CAAC,CACH,CACF,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACzB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
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
+ export {};
9
+ //# sourceMappingURL=template-pages-preview.test.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-pages-preview.test.node.d.ts","sourceRoot":"","sources":["../../src/lib/template-pages-preview.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,55 @@
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
+ * Runtime test of the scaffolded Pages preview builder (the file generated
10
+ * projects receive). The prefix must follow the content default locale, never
11
+ * the admin interface default, and the selected content locale must survive
12
+ * even when it is not advertised.
13
+ */
14
+ import { beforeAll, describe, expect, it, vi } from 'vitest';
15
+ // Admin and content defaults deliberately differ.
16
+ vi.mock('~/i18n', () => ({
17
+ i18n: {
18
+ admin: { defaultLocale: 'en', locales: ['en', 'fr'] },
19
+ content: { defaultLocale: 'fr', locales: ['fr', 'en', 'es'] },
20
+ },
21
+ }));
22
+ // The admin config is data plus React components; only `preview.url` matters.
23
+ vi.mock('@byline/core', async (importOriginal) => ({
24
+ ...(await importOriginal()),
25
+ defineAdmin: (_definition, config) => config,
26
+ }));
27
+ vi.mock('@byline/admin/react', () => ({ DateTimeFormatter: () => null }));
28
+ vi.mock('~/components/summary-length.js', () => ({ SummaryLength: () => null }));
29
+ // `src/templates` is excluded from the CLI's TypeScript program; a runtime-only
30
+ // specifier keeps the compiler from following the import (see the docs hooks test).
31
+ const templateAdminPath = '../templates/byline-examples/collections/pages/admin.js';
32
+ let url;
33
+ beforeAll(async () => {
34
+ const module = await import(/* @vite-ignore */ templateAdminPath);
35
+ const preview = module.PagesAdmin.preview;
36
+ if (preview == null)
37
+ throw new Error('template Pages admin has no preview builder');
38
+ url = preview.url;
39
+ });
40
+ function page(path, area) {
41
+ return { id: 'doc-1', path, status: 'draft', fields: area ? { area } : {} };
42
+ }
43
+ describe('scaffolded Pages preview URL', () => {
44
+ it('omits the prefix for the content default locale, even though admin defaults to en', () => {
45
+ expect(url(page('team'), { locale: 'fr' })).toBe('/team');
46
+ });
47
+ it('prefixes every other content locale, including the admin default', () => {
48
+ expect(url(page('team'), { locale: 'en' })).toBe('/en/team');
49
+ expect(url(page('team'), { locale: 'es' })).toBe('/es/team');
50
+ });
51
+ it('hides the affordance until the page has a path', () => {
52
+ expect(url(page(''), { locale: 'es' })).toBeNull();
53
+ });
54
+ });
55
+ //# sourceMappingURL=template-pages-preview.test.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-pages-preview.test.node.js","sourceRoot":"","sources":["../../src/lib/template-pages-preview.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE5D,kDAAkD;AAClD,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IACvB,IAAI,EAAE;QACJ,KAAK,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;QACrD,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;KAC9D;CACF,CAAC,CAAC,CAAA;AAEH,8EAA8E;AAC9E,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,CAAC,CAAC;IACjD,GAAG,CAAC,MAAM,cAAc,EAA2B,CAAC;IACpD,WAAW,EAAE,CAAC,WAAoB,EAAE,MAAe,EAAE,EAAE,CAAC,MAAM;CAC/D,CAAC,CAAC,CAAA;AACH,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAA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EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC5D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IACpD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Phase, PhaseId } from '../types.js';
2
+ export declare function stubPhase(id: PhaseId, title: string): Phase;
3
+ //# sourceMappingURL=stub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub.d.ts","sourceRoot":"","sources":["../../src/phases/stub.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAEjD,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAoB3D"}
@@ -0,0 +1,25 @@
1
+ export function stubPhase(id, title) {
2
+ return {
3
+ id,
4
+ title,
5
+ defaultMode: 'confirm',
6
+ async detect(ctx) {
7
+ return ctx.state.isComplete(id) ? 'done' : 'pending';
8
+ },
9
+ async plan() {
10
+ return {
11
+ writes: [],
12
+ commands: [],
13
+ notes: [`${id}: not yet implemented in @byline/cli ${currentVersion()}`],
14
+ };
15
+ },
16
+ async apply(_plan, ctx) {
17
+ ctx.logger.warn(`${id} — phase is stubbed; please follow the manual instructions in docs`);
18
+ return { state: 'pending' };
19
+ },
20
+ };
21
+ }
22
+ function currentVersion() {
23
+ return '0.1.0';
24
+ }
25
+ //# sourceMappingURL=stub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../src/phases/stub.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,SAAS,CAAC,EAAW,EAAE,KAAa;IAClD,OAAO;QACL,EAAE;QACF,KAAK;QACL,WAAW,EAAE,SAAS;QACtB,KAAK,CAAC,MAAM,CAAC,GAAY;YACvB,OAAO,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QACtD,CAAC;QACD,KAAK,CAAC,IAAI;YACR,OAAO;gBACL,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,EAAE;gBACZ,KAAK,EAAE,CAAC,GAAG,EAAE,wCAAwC,cAAc,EAAE,EAAE,CAAC;aACzE,CAAA;QACH,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG;YACpB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,oEAAoE,CAAC,CAAA;YAC1F,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;QAC7B,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -129,6 +129,13 @@ export const DocsAdmin: CollectionAdminConfig = defineAdmin(Docs, {
129
129
  * Direct relations are auto-populated by the edit view (depth 1, picker
130
130
  * projection) and appear under `doc.fields.<name>?.document`.
131
131
  *
132
+ * `locale` is the content locale selected in the editor. Keep it even when
133
+ * that translation is not advertised: preview is how an editor reviews an
134
+ * unchecked translation. The locale prefix must follow your public routes'
135
+ * rule, which this scaffold cannot know; the example assumes the default
136
+ * locale (`'en'`) is unprefixed. Never derive it from the admin interface
137
+ * language.
138
+ *
132
139
  * @example
133
140
  * preview: {
134
141
  * url: (doc, { locale }) => {
@@ -78,8 +78,11 @@ export default defineHooks({
78
78
  `afterSystemFieldsChange: ${documentId} in '${collectionPath}' changed`,
79
79
  changed
80
80
  )
81
- // Advertised locales affect alternates/sitemaps, not indexed content.
82
- if (requested.path) {
81
+ // Both change the public index: a path change moves the indexed URL, and
82
+ // an advertised-locale change alters which translations are publicly
83
+ // delivered (and so indexed). Check `requested` rather than `changed` so an
84
+ // explicit reconciliation retry re-runs indexing after a failed attempt.
85
+ if (requested.path || requested.availableLocales) {
83
86
  await getSystemBylineClient().collection('docs').indexDocument(documentId)
84
87
  }
85
88
  },
@@ -140,6 +140,13 @@ export const NewsAdmin: CollectionAdminConfig = defineAdmin(News, {
140
140
  * Direct relations are auto-populated by the edit view (depth 1, picker
141
141
  * projection) and appear under `doc.fields.<name>?.document`.
142
142
  *
143
+ * `locale` is the content locale selected in the editor. Keep it even when
144
+ * that translation is not advertised: preview is how an editor reviews an
145
+ * unchecked translation. The locale prefix must follow your public routes'
146
+ * rule, which this scaffold cannot know; the example assumes the default
147
+ * locale (`'en'`) is unprefixed. Never derive it from the admin interface
148
+ * language.
149
+ *
143
150
  * @example
144
151
  * preview: {
145
152
  * url: (doc, { locale }) => {
@@ -125,6 +125,14 @@ export const PagesAdmin: CollectionAdminConfig = defineAdmin(Pages, {
125
125
  * richtext embed walker on internal-link nodes) and adds the request-
126
126
  * locale prefix on top. Returns `null` to hide the preview affordance.
127
127
  *
128
+ * `locale` is the content locale selected in the editor. Keep it even
129
+ * when that translation is not advertised: preview is how an editor
130
+ * reviews an unchecked translation. The locale prefix is your public
131
+ * routes' rule, which this scaffold cannot know. This default assumes
132
+ * the content default locale is served without a prefix and every other
133
+ * locale under `/<locale>`; change it to match your routes. Never derive
134
+ * the prefix from the admin interface language.
135
+ *
128
136
  * `doc.path` is the top-level slug (derived from `useAsPath`), not a
129
137
  * field. Direct relations are auto-populated by the edit view (depth
130
138
  * 1, picker projection) and appear under `doc.fields.<name>?.document`.
@@ -133,7 +141,7 @@ export const PagesAdmin: CollectionAdminConfig = defineAdmin(Pages, {
133
141
  url: (doc, { locale }) => {
134
142
  const path = Pages.buildDocumentPath?.(doc, { collectionPath: Pages.path }) ?? null
135
143
  if (path == null) return null
136
- const prefix = locale && locale !== i18n.admin.defaultLocale ? `/${locale}` : ''
144
+ const prefix = locale && locale !== i18n.content.defaultLocale ? `/${locale}` : ''
137
145
  return `${prefix}${path}`
138
146
  },
139
147
  },
@@ -0,0 +1,2 @@
1
+ export declare function renderSnippet(title: string, body: string, lang?: string): string;
2
+ //# sourceMappingURL=snippet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../src/ui/snippet.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAI5E"}
@@ -0,0 +1,7 @@
1
+ import pc from 'picocolors';
2
+ export function renderSnippet(title, body, lang = '') {
3
+ const header = pc.dim(`--- ${title}${lang ? ` (${lang})` : ''} ---`);
4
+ const footer = pc.dim('---');
5
+ return `${header}\n${body}\n${footer}`;
6
+ }
7
+ //# sourceMappingURL=snippet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../src/ui/snippet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,IAAY,EAAE,IAAI,GAAG,EAAE;IAClE,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IACpE,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAC5B,OAAO,GAAG,MAAM,KAAK,IAAI,KAAK,MAAM,EAAE,CAAA;AACxC,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@byline/cli",
3
3
  "private": false,
4
4
  "license": "MPL-2.0",
5
- "version": "6.6.0",
5
+ "version": "6.7.1",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },
@@ -61,7 +61,7 @@
61
61
  "typescript": "^7.0.2",
62
62
  "unified": "^11.0.5",
63
63
  "vitest": "^5.0.1",
64
- "@byline/core": "6.6.0"
64
+ "@byline/core": "6.7.1"
65
65
  },
66
66
  "publishConfig": {
67
67
  "access": "public",