@se-studio/project-build 1.6.0 → 1.7.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/CHANGELOG.md +8 -0
- package/README.md +24 -0
- package/dist/check-marketing-routes.mjs +7 -2
- package/dist/generate-marketing-routes.mjs +26 -2
- package/dist/marketing-routes-cms.mjs +81 -4
- package/dist/marketing-routes.mjs +278 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @se-studio/project-build
|
|
2
2
|
|
|
3
|
+
## 1.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 680a9af: `check-marketing-routes` now fails closed. A missing `src/lib/marketing-routes.json` fails unless a repo that has not migrated adds `src/lib/marketing-routes.opt-out.json` with a non-empty `reason` (migration: add the config with `generate-marketing-routes . --from-cms --write`, or add the opt-out file; an opt-out beside a real config fails). The check scans every `page.ts` / `page.tsx` under `src/app` and also polices `route.ts` under `(cms-routes)` or shadowing a generated URL. `allowHandWrittenPages` entries become `{ path, reason }` (the bare string form is deprecated and warns).
|
|
8
|
+
|
|
9
|
+
`generate-marketing-routes`: per-type `detailPages: false` (index only, served at `indexSlug`) and `nestedSlugs: true` (`/{type}/[...slugs]`) in object-form `articleTypes`, kept across `--from-cms --write`; `excludeArticleTypes`; tag and person types with no slug are skipped with a warning instead of failing; `route-build-policy.json` uses the real param names; `marketing-slugs.ts` marks index-only routes and exports `ARTICLE_DETAIL_TYPE_SLUGS` only when a type opts in. `--force` without `--write` is now a dry run (it used to write). Sites that set none of the new options generate exactly what they did.
|
|
10
|
+
|
|
3
11
|
## 1.6.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -133,6 +133,30 @@ check-marketing-routes . # fail hand-written (cms-route
|
|
|
133
133
|
|
|
134
134
|
`generate-marketing-routes` honours the same list. It never writes, replaces or deletes a page on `allowHandWrittenPages`, with or without `--force`. Matching is by URL shape: `page.ts` and `page.tsx` are one page, `[slug]` equals `[article]` or `[person]` at the same position, and a parent never covers its child (`people` does not cover `people/[person]`). An entry may be a rest (`resources/[slug]`), with the file name, or a full `src/app/(cms-routes)/...` path. `--force` replaces only files with the `@generated` header; any other existing page at a generated URL is left and printed as kept. Hand-route cleanup removes only `page.ts` / `page.tsx`, never renderers or helpers beside them. `--from-cms --write` keeps `allowHandWrittenPages`, and the URL shape keys below. `tagTypeRoutes: false` lets `--from-cms` succeed on a space whose tag types have no slug (it skips every tag type). To adopt it on a site with custom listings, allowlist those pages (for example `resources`, `resources/[slug]`, `tag/[slug]`) and run `pnpm generate:routes`.
|
|
135
135
|
|
|
136
|
+
##### Fail-closed checker, opt-out, and allowlist reasons
|
|
137
|
+
|
|
138
|
+
`check-marketing-routes` is filesystem only (no CMS secrets). It fails when:
|
|
139
|
+
|
|
140
|
+
- `src/lib/marketing-routes.json` is **missing**. A repo that has not migrated yet opts out explicitly with `src/lib/marketing-routes.opt-out.json`: `{ "reason": "not migrated, see SE-123" }`. The reason is required; the check then passes with a warning that prints it. An opt-out beside a real `marketing-routes.json` fails (delete it once migrated). **Migration note:** before this version a missing config only warned; a repo with none now fails until it adds the config (`generate-marketing-routes . --from-cms --write`) or the opt-out file.
|
|
141
|
+
- any `page.ts` / `page.tsx` under `src/app` is not generated or allowlisted (the whole tree is scanned, modified files included, not only new ones), or a `route.ts` / `route.tsx` sits under `(cms-routes)` or shadows a generated marketing URL. `api`, `sitemap.xml`, `og` and other fixed handlers are untouched.
|
|
142
|
+
- an `allowHandWrittenPages` object has no `reason`.
|
|
143
|
+
|
|
144
|
+
`allowHandWrittenPages` entries are `{ "path": "preview", "reason": "Contentful preview entry" }`. The bare string form still works but is deprecated: `check-marketing-routes` and `generate-marketing-routes` print a warning for each. A preview page, `resource-list-cards` and other non-CMS pages go here too.
|
|
145
|
+
|
|
146
|
+
##### Article type options, exclusions, and dry run
|
|
147
|
+
|
|
148
|
+
Object-form `articleTypes` entries take per-type options. `--from-cms --write` rewrites `articleTypes` from the CMS but carries these over for types that still exist, so write them in `marketing-routes.json`:
|
|
149
|
+
|
|
150
|
+
| Key | Meaning | Default |
|
|
151
|
+
|-----|---------|---------|
|
|
152
|
+
| `detailPages: false` | Index-only type. The index is served at `indexSlug` (`{ "slug": "sketch", "indexSlug": "more", "detailPages": false }` is `/more/`) and no `/{slug}/{article}/` or `/{indexSlug}/{article}/` page, policy entry or sitemap detail is generated. `marketing-slugs.ts` marks the route `detailPages: false` and exports `ARTICLE_DETAIL_TYPE_SLUGS` | detail pages on |
|
|
153
|
+
| `nestedSlugs: true` | Detail pages are `/{slug}/[...slugs]` (`/work/{client}/{case}/`, slug `client/case`) instead of one `[article]` segment. `route-build-policy.json` lists the real param name | `[article]` |
|
|
154
|
+
| `excludeArticleTypes: ["draft"]` (top level) | A CMS article type that stays off. Kept across `--from-cms --write` | none |
|
|
155
|
+
|
|
156
|
+
Neither option works with `tagInPath`. A tag type or person type with no slug is skipped with a warning (it used to fail `--from-cms`). A config with none of this generates exactly what it did before.
|
|
157
|
+
|
|
158
|
+
`--force` replaces only `@generated` files and only together with `--write`: without `--write` the generator never writes (a previous version wrote with `--force` alone).
|
|
159
|
+
|
|
136
160
|
##### URL shape: index and detail slugs, index switches, custom tag listing
|
|
137
161
|
|
|
138
162
|
A section config (`peopleSlug` / `tagsSlug`) can put the index and the detail pages at different segments. All four keys are optional. A config with none of them generates exactly what it did before.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Fail hand-written
|
|
4
|
-
* src/lib/marketing-routes.json (or its allowHandWrittenPages list).
|
|
3
|
+
* Fail hand-written page.ts / page.tsx / route.ts files under src/app that are not in
|
|
4
|
+
* src/lib/marketing-routes.json (or its allowHandWrittenPages list). Fails when
|
|
5
|
+
* marketing-routes.json is missing unless src/lib/marketing-routes.opt-out.json
|
|
6
|
+
* holds {"reason": "..."} (repos not yet migrated). Filesystem only: no CMS secrets.
|
|
5
7
|
*
|
|
6
8
|
* Usage (core): node scripts/check-marketing-routes.mjs <app-dir>
|
|
7
9
|
* Usage (customer): check-marketing-routes <app-dir> (@se-studio/project-build bin)
|
|
@@ -18,6 +20,9 @@ if (!app) {
|
|
|
18
20
|
|
|
19
21
|
const result = checkMarketingRoutes(path.resolve(app));
|
|
20
22
|
console.log(result.detail);
|
|
23
|
+
for (const warning of result.warnings ?? []) {
|
|
24
|
+
console.warn(`warning: ${warning}`);
|
|
25
|
+
}
|
|
21
26
|
if (!result.ok) {
|
|
22
27
|
process.exit(1);
|
|
23
28
|
}
|
|
@@ -32,6 +32,13 @@
|
|
|
32
32
|
* that config and formats the generated `(cms-routes)` pages with the app's
|
|
33
33
|
* Biome. `allowedDynamic` is left as it is.
|
|
34
34
|
*
|
|
35
|
+
* Article type options (object form of `articleTypes`, kept across `--from-cms --write`):
|
|
36
|
+
* `detailPages: false` (index only, served at `indexSlug`), `nestedSlugs: true`
|
|
37
|
+
* (`/{type}/[...slugs]`). `excludeArticleTypes: ["slug"]` keeps a CMS type off.
|
|
38
|
+
* Tag and person types with no slug are skipped with a warning.
|
|
39
|
+
*
|
|
40
|
+
* Without `--write` nothing is written, with or without `--force`.
|
|
41
|
+
*
|
|
35
42
|
* Usage:
|
|
36
43
|
* node scripts/generate-marketing-routes.mjs <app-dir> [--from-cms] [--write] [--force]
|
|
37
44
|
* generate-marketing-routes <app-dir> [--from-cms] [--write] [--force]
|
|
@@ -41,15 +48,17 @@ import fs from 'node:fs';
|
|
|
41
48
|
import path from 'node:path';
|
|
42
49
|
import { fileURLToPath } from 'node:url';
|
|
43
50
|
import {
|
|
51
|
+
articleTypeOptionsFromHand,
|
|
44
52
|
fetchContentSlugs,
|
|
45
53
|
mergeCmsEnv,
|
|
46
54
|
planFromCms,
|
|
47
55
|
sectionConfigFromPlan,
|
|
48
56
|
} from './marketing-routes-cms.mjs';
|
|
49
|
-
import { readMarketingRoutes, syncGeneratedRoutes } from './marketing-routes.mjs';
|
|
57
|
+
import { parseAllowlist, readMarketingRoutes, syncGeneratedRoutes } from './marketing-routes.mjs';
|
|
50
58
|
|
|
51
59
|
const args = process.argv.slice(2).filter((arg) => !arg.startsWith('--'));
|
|
52
|
-
|
|
60
|
+
// --force only widens what --write may replace; on its own it is still a dry run.
|
|
61
|
+
const write = process.argv.includes('--write');
|
|
53
62
|
const force = process.argv.includes('--force');
|
|
54
63
|
const fromCms = process.argv.includes('--from-cms');
|
|
55
64
|
const app = args[0];
|
|
@@ -90,11 +99,16 @@ if (fromCms) {
|
|
|
90
99
|
enableTagsIndex: hand.enableTagsIndex,
|
|
91
100
|
tagInPath: hand.tagInPath === true,
|
|
92
101
|
tagTypeRoutes: hand.tagTypeRoutes !== false,
|
|
102
|
+
excludeArticleTypes: Array.isArray(hand.excludeArticleTypes) ? hand.excludeArticleTypes : [],
|
|
103
|
+
articleTypeOptions: articleTypeOptionsFromHand(hand),
|
|
93
104
|
});
|
|
94
105
|
if (!plan.ok) {
|
|
95
106
|
console.error(plan.problems.join('\n'));
|
|
96
107
|
process.exit(1);
|
|
97
108
|
}
|
|
109
|
+
for (const warning of plan.warnings) {
|
|
110
|
+
console.warn(`warning: ${warning}`);
|
|
111
|
+
}
|
|
98
112
|
const next = sectionConfigFromPlan(hand, plan);
|
|
99
113
|
const configPath = path.join(appRoot, 'src/lib/marketing-routes.json');
|
|
100
114
|
if (!write) {
|
|
@@ -105,7 +119,17 @@ if (fromCms) {
|
|
|
105
119
|
console.log(`Updated ${configPath}`);
|
|
106
120
|
}
|
|
107
121
|
|
|
122
|
+
if (force && !write) {
|
|
123
|
+
console.warn('--force without --write is a dry run: nothing is written. Add --write.');
|
|
124
|
+
}
|
|
108
125
|
const result = syncGeneratedRoutes(appRoot, { write, force });
|
|
126
|
+
try {
|
|
127
|
+
for (const warning of parseAllowlist(readMarketingRoutes(appRoot)).warnings) {
|
|
128
|
+
console.warn(`warning: ${warning}`);
|
|
129
|
+
}
|
|
130
|
+
} catch {
|
|
131
|
+
// an invalid allowlist is reported by check-marketing-routes
|
|
132
|
+
}
|
|
109
133
|
for (const note of result.tagSkips) {
|
|
110
134
|
console.log(note);
|
|
111
135
|
}
|
|
@@ -64,6 +64,16 @@ export function contentfulReadTarget(env) {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* A type with no slug has no URL. Tag and person types are skipped with a warning
|
|
69
|
+
* rather than failing the whole run.
|
|
70
|
+
*
|
|
71
|
+
* @param {{ slug?: string } | undefined} entry
|
|
72
|
+
*/
|
|
73
|
+
function isSlugless(entry) {
|
|
74
|
+
return typeof entry?.slug !== 'string' || entry.slug.length === 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
/**
|
|
68
78
|
* @param {string | undefined} slug
|
|
69
79
|
* @param {string} label
|
|
@@ -236,11 +246,17 @@ function claimRest(used, rest, label, problems) {
|
|
|
236
246
|
* enableTagsIndex?: boolean,
|
|
237
247
|
* tagInPath?: boolean,
|
|
238
248
|
* tagTypeRoutes?: boolean,
|
|
249
|
+
* excludeArticleTypes?: string[],
|
|
250
|
+
* articleTypeOptions?: Record<string, { detailPages?: boolean, nestedSlugs?: boolean }>,
|
|
239
251
|
* }} input
|
|
240
252
|
*/
|
|
241
253
|
export function planFromCms(input) {
|
|
242
254
|
/** @type {string[]} */
|
|
243
255
|
const problems = [];
|
|
256
|
+
/** @type {string[]} */
|
|
257
|
+
const warnings = [];
|
|
258
|
+
const excluded = new Set(input.excludeArticleTypes ?? []);
|
|
259
|
+
const options = input.articleTypeOptions ?? {};
|
|
244
260
|
const declared = {
|
|
245
261
|
person: handSlug(input, 'peopleSlug', null),
|
|
246
262
|
tag: handSlug(input, 'tagsSlug', null),
|
|
@@ -270,6 +286,10 @@ export function planFromCms(input) {
|
|
|
270
286
|
/** @type {string[]} */
|
|
271
287
|
const personTypes = [];
|
|
272
288
|
for (const entry of input.personTypes ?? []) {
|
|
289
|
+
if (isSlugless(entry)) {
|
|
290
|
+
warnings.push(`skipped person type "${entry?.name ?? '(unnamed)'}": no slug`);
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
273
293
|
const slug = segmentOrNull(entry?.slug, 'person type', problems);
|
|
274
294
|
if (slug) {
|
|
275
295
|
personTypes.push(slug);
|
|
@@ -282,6 +302,10 @@ export function planFromCms(input) {
|
|
|
282
302
|
if (entry?.show === false || !tagTypeRoutes) {
|
|
283
303
|
continue;
|
|
284
304
|
}
|
|
305
|
+
if (isSlugless(entry)) {
|
|
306
|
+
warnings.push(`skipped tag type "${entry?.name ?? '(unnamed)'}": no slug`);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
285
309
|
const slug = segmentOrNull(entry?.slug, 'tag type', problems);
|
|
286
310
|
if (slug) {
|
|
287
311
|
tagTypes.push(slug);
|
|
@@ -297,9 +321,13 @@ export function planFromCms(input) {
|
|
|
297
321
|
const peopleIndex = indexFlag(input, 'enablePeopleIndex', peopleSlug, 'peopleSlug', problems);
|
|
298
322
|
const tagsIndex = indexFlag(input, 'enableTagsIndex', tagsSlug, 'tagsSlug', problems);
|
|
299
323
|
const categoryPath = input.tagInPath === true && !articlesSlug;
|
|
300
|
-
/** @type {{ slug: string, indexSlug: string }[]} */
|
|
324
|
+
/** @type {{ slug: string, indexSlug: string, detailPages?: false, nestedSlugs?: true }[]} */
|
|
301
325
|
const articleTypes = [];
|
|
302
326
|
for (const entry of input.articleTypes ?? []) {
|
|
327
|
+
if (typeof entry?.slug === 'string' && excluded.has(entry.slug)) {
|
|
328
|
+
warnings.push(`excluded article type "${entry.slug}" (excludeArticleTypes)`);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
303
331
|
const slug = categoryPath
|
|
304
332
|
? pathOrNull(entry?.slug, 'article type', problems)
|
|
305
333
|
: segmentOrNull(entry?.slug, 'article type', problems);
|
|
@@ -319,7 +347,21 @@ export function planFromCms(input) {
|
|
|
319
347
|
);
|
|
320
348
|
continue;
|
|
321
349
|
}
|
|
322
|
-
|
|
350
|
+
const opt = options[slug] ?? {};
|
|
351
|
+
if (opt.nestedSlugs === true && opt.detailPages === false) {
|
|
352
|
+
problems.push(`${slug}: nestedSlugs has no effect with detailPages: false`);
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (categoryPath && (opt.nestedSlugs === true || opt.detailPages === false)) {
|
|
356
|
+
problems.push(`${slug}: detailPages and nestedSlugs are not supported with tagInPath`);
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
articleTypes.push({
|
|
360
|
+
slug,
|
|
361
|
+
indexSlug,
|
|
362
|
+
...(opt.detailPages === false ? { detailPages: false } : {}),
|
|
363
|
+
...(opt.nestedSlugs === true ? { nestedSlugs: true } : {}),
|
|
364
|
+
});
|
|
323
365
|
}
|
|
324
366
|
/** @type {Map<string, string>} */
|
|
325
367
|
const used = new Map();
|
|
@@ -358,10 +400,17 @@ export function planFromCms(input) {
|
|
|
358
400
|
const indexRest = articlesSlug ? `${articlesSlug}/${type.indexSlug}` : type.indexSlug;
|
|
359
401
|
const articleRest = articlesSlug ? `${articlesSlug}/${type.slug}` : type.slug;
|
|
360
402
|
claimRest(used, indexRest, `${type.slug} index`, problems);
|
|
361
|
-
if (articleRest !== indexRest) {
|
|
403
|
+
if (articleRest !== indexRest && type.detailPages !== false) {
|
|
362
404
|
claimRest(used, articleRest, `${type.slug} articles`, problems);
|
|
363
405
|
}
|
|
364
|
-
|
|
406
|
+
if (type.detailPages !== false) {
|
|
407
|
+
claimRest(
|
|
408
|
+
used,
|
|
409
|
+
`${articleRest}/${type.nestedSlugs ? '[...slugs]' : '[article]'}`,
|
|
410
|
+
`${type.slug} article`,
|
|
411
|
+
problems,
|
|
412
|
+
);
|
|
413
|
+
}
|
|
365
414
|
}
|
|
366
415
|
|
|
367
416
|
if (problems.length > 0) {
|
|
@@ -372,6 +421,7 @@ export function planFromCms(input) {
|
|
|
372
421
|
const hasPeople = personTypes.length > 0 || Boolean(personBase);
|
|
373
422
|
return {
|
|
374
423
|
ok: true,
|
|
424
|
+
warnings,
|
|
375
425
|
peopleSlug,
|
|
376
426
|
tagsSlug,
|
|
377
427
|
articlesSlug,
|
|
@@ -434,6 +484,9 @@ export function sectionConfigFromPlan(hand, plan) {
|
|
|
434
484
|
if (hand.tagTypeRoutes === false) {
|
|
435
485
|
next.tagTypeRoutes = false;
|
|
436
486
|
}
|
|
487
|
+
if (Array.isArray(hand.excludeArticleTypes) && hand.excludeArticleTypes.length > 0) {
|
|
488
|
+
next.excludeArticleTypes = hand.excludeArticleTypes;
|
|
489
|
+
}
|
|
437
490
|
if (Array.isArray(hand.allowHandWrittenPages) && hand.allowHandWrittenPages.length > 0) {
|
|
438
491
|
next.allowHandWrittenPages = hand.allowHandWrittenPages;
|
|
439
492
|
}
|
|
@@ -496,3 +549,27 @@ export async function fetchContentSlugs(env, contentType, fields = ['slug', 'nam
|
|
|
496
549
|
}
|
|
497
550
|
return entries;
|
|
498
551
|
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Per-type options already in the hand-written config. `--from-cms` rewrites
|
|
555
|
+
* `articleTypes` from the CMS, so options live here and are carried over.
|
|
556
|
+
*
|
|
557
|
+
* @param {Record<string, unknown>} hand
|
|
558
|
+
* @returns {Record<string, { detailPages?: boolean, nestedSlugs?: boolean }>}
|
|
559
|
+
*/
|
|
560
|
+
export function articleTypeOptionsFromHand(hand) {
|
|
561
|
+
/** @type {Record<string, { detailPages?: boolean, nestedSlugs?: boolean }>} */
|
|
562
|
+
const options = {};
|
|
563
|
+
for (const type of Array.isArray(hand.articleTypes) ? hand.articleTypes : []) {
|
|
564
|
+
if (!type || typeof type !== 'object' || typeof type.slug !== 'string') {
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
const entry = {};
|
|
568
|
+
if (type.detailPages === false) entry.detailPages = false;
|
|
569
|
+
if (type.nestedSlugs === true) entry.nestedSlugs = true;
|
|
570
|
+
if (Object.keys(entry).length > 0) {
|
|
571
|
+
options[type.slug] = entry;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return options;
|
|
575
|
+
}
|
|
@@ -269,7 +269,8 @@ export function routeRestFromRel(rel) {
|
|
|
269
269
|
* marketing-routes.json lists `(cms-routes)` rests (route groups dropped, for
|
|
270
270
|
* example `"[tag]/[...slugs]"`) that may exist as hand-written pages. An entry
|
|
271
271
|
* also allows a page outside `(cms-routes)` with the same rest (`"resource-list-cards"`
|
|
272
|
-
* or `"src/app/resource-list-cards/page.tsx"`).
|
|
272
|
+
* or `"src/app/resource-list-cards/page.tsx"`). Every entry is `{ path, reason }`; a bare
|
|
273
|
+
* string is deprecated (warned, not failed). Not a way to add a marketing URL.
|
|
273
274
|
* To keep a custom tag listing or filter, use the `renderTagListing` route hook
|
|
274
275
|
* instead of hand-writing the page.
|
|
275
276
|
*
|
|
@@ -277,14 +278,55 @@ export function routeRestFromRel(rel) {
|
|
|
277
278
|
* @returns {Set<string>}
|
|
278
279
|
*/
|
|
279
280
|
export function handWrittenAllowlist(config) {
|
|
281
|
+
return new Set(parseAllowlist(config).entries.map((entry) => entry.rest));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Entries are `{ "path": "preview", "reason": "why this stays hand-written" }`. A bare
|
|
286
|
+
* string is the deprecated form: still honoured, but `warnings` names it. An object
|
|
287
|
+
* without a non-empty `reason` (or a `path`) is a hard error.
|
|
288
|
+
*
|
|
289
|
+
* @param {unknown} config
|
|
290
|
+
* @returns {{ entries: { rest: string, reason: string | null }[], warnings: string[] }}
|
|
291
|
+
*/
|
|
292
|
+
export function parseAllowlist(config) {
|
|
280
293
|
const raw = config && typeof config === 'object' ? config.allowHandWrittenPages : undefined;
|
|
281
294
|
if (raw === undefined) {
|
|
282
|
-
return
|
|
295
|
+
return { entries: [], warnings: [] };
|
|
296
|
+
}
|
|
297
|
+
if (!Array.isArray(raw)) {
|
|
298
|
+
throw new Error(
|
|
299
|
+
'marketing-routes.json allowHandWrittenPages must be an array of { path, reason } objects',
|
|
300
|
+
);
|
|
283
301
|
}
|
|
284
|
-
|
|
285
|
-
|
|
302
|
+
/** @type {{ rest: string, reason: string | null }[]} */
|
|
303
|
+
const entries = [];
|
|
304
|
+
/** @type {string[]} */
|
|
305
|
+
const warnings = [];
|
|
306
|
+
for (const item of raw) {
|
|
307
|
+
if (typeof item === 'string') {
|
|
308
|
+
if (item.length === 0) {
|
|
309
|
+
throw new Error('marketing-routes.json allowHandWrittenPages has an empty entry');
|
|
310
|
+
}
|
|
311
|
+
entries.push({ rest: cleanAllowEntry(item), reason: null });
|
|
312
|
+
warnings.push(
|
|
313
|
+
`allowHandWrittenPages entry "${item}" is a bare string (deprecated): use { "path": "${item}", "reason": "..." }`,
|
|
314
|
+
);
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
const entryPath = item && typeof item === 'object' ? item.path : undefined;
|
|
318
|
+
const reason = item && typeof item === 'object' ? item.reason : undefined;
|
|
319
|
+
if (typeof entryPath !== 'string' || entryPath.length === 0) {
|
|
320
|
+
throw new Error('marketing-routes.json allowHandWrittenPages entries need a non-empty "path"');
|
|
321
|
+
}
|
|
322
|
+
if (typeof reason !== 'string' || reason.trim().length === 0) {
|
|
323
|
+
throw new Error(
|
|
324
|
+
`marketing-routes.json allowHandWrittenPages entry "${entryPath}" needs a non-empty "reason"`,
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
entries.push({ rest: cleanAllowEntry(entryPath), reason: reason.trim() });
|
|
286
328
|
}
|
|
287
|
-
return
|
|
329
|
+
return { entries, warnings };
|
|
288
330
|
}
|
|
289
331
|
|
|
290
332
|
/**
|
|
@@ -366,6 +408,50 @@ export function isAllowlisted(allow, rest) {
|
|
|
366
408
|
return false;
|
|
367
409
|
}
|
|
368
410
|
|
|
411
|
+
/** Where a repo that has not migrated records why it has no marketing-routes.json. */
|
|
412
|
+
export const OPT_OUT_REL = 'src/lib/marketing-routes.opt-out.json';
|
|
413
|
+
const CONFIG_REL = 'src/lib/marketing-routes.json';
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* `route.ts` / `route.tsx` handlers under `src/app`. A handler under `(cms-routes)` is
|
|
417
|
+
* a marketing URL. One elsewhere only counts when its URL shape equals a generated
|
|
418
|
+
* marketing route (it would shadow a CMS page); api, sitemap, og and other fixed
|
|
419
|
+
* handlers never match a bracket route.
|
|
420
|
+
*
|
|
421
|
+
* @param {string} appRoot
|
|
422
|
+
* @returns {{ inside: string[], outside: { rel: string, rest: string }[] }}
|
|
423
|
+
*/
|
|
424
|
+
export function listRouteHandlers(appRoot) {
|
|
425
|
+
/** @type {string[]} */
|
|
426
|
+
const inside = [];
|
|
427
|
+
/** @type {{ rel: string, rest: string }[]} */
|
|
428
|
+
const outside = [];
|
|
429
|
+
const appDir = path.join(appRoot, 'src/app');
|
|
430
|
+
if (!fs.existsSync(appDir)) {
|
|
431
|
+
return { inside, outside };
|
|
432
|
+
}
|
|
433
|
+
walk(appDir, (file) => {
|
|
434
|
+
const base = path.basename(file);
|
|
435
|
+
if (base !== 'route.ts' && base !== 'route.tsx') {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const rel = path.relative(appRoot, file).split(path.sep).join('/');
|
|
439
|
+
if (rel.includes('/(cms-dev)/')) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const rest = routeRestFromRel(rel.replace(/\/route\.tsx?$/, '/page.ts'));
|
|
443
|
+
if (rest !== null) {
|
|
444
|
+
inside.push(rel);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
outside.push({
|
|
448
|
+
rel,
|
|
449
|
+
rest: appRestFromRel(rel.replace(/\/route\.tsx?$/, '/page.ts')),
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
return { inside, outside };
|
|
453
|
+
}
|
|
454
|
+
|
|
369
455
|
/**
|
|
370
456
|
* @param {string} appRoot
|
|
371
457
|
*/
|
|
@@ -377,11 +463,41 @@ export function checkMarketingRoutes(appRoot) {
|
|
|
377
463
|
const message = error instanceof Error ? error.message : String(error);
|
|
378
464
|
return { ok: false, severity: 'error', detail: `marketing-routes.json: ${message}` };
|
|
379
465
|
}
|
|
466
|
+
const optOutAbs = path.join(appRoot, OPT_OUT_REL);
|
|
380
467
|
if (!config) {
|
|
468
|
+
if (!fs.existsSync(optOutAbs)) {
|
|
469
|
+
return {
|
|
470
|
+
ok: false,
|
|
471
|
+
severity: 'error',
|
|
472
|
+
detail: `no ${CONFIG_REL}: run generate-marketing-routes --from-cms --write, or (repos not yet migrated only) add ${OPT_OUT_REL} with {"reason": "..."}`,
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
let reason = '';
|
|
476
|
+
try {
|
|
477
|
+
const parsed = JSON.parse(fs.readFileSync(optOutAbs, 'utf8'));
|
|
478
|
+
reason = typeof parsed?.reason === 'string' ? parsed.reason.trim() : '';
|
|
479
|
+
} catch (error) {
|
|
480
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
481
|
+
return { ok: false, severity: 'error', detail: `${OPT_OUT_REL}: ${message}` };
|
|
482
|
+
}
|
|
483
|
+
if (!reason) {
|
|
484
|
+
return {
|
|
485
|
+
ok: false,
|
|
486
|
+
severity: 'error',
|
|
487
|
+
detail: `${OPT_OUT_REL} needs a non-empty "reason" (why this repo has no marketing-routes.json yet)`,
|
|
488
|
+
};
|
|
489
|
+
}
|
|
381
490
|
return {
|
|
382
491
|
ok: true,
|
|
383
492
|
severity: 'warn',
|
|
384
|
-
detail:
|
|
493
|
+
detail: `marketing routes check skipped by ${OPT_OUT_REL}: ${reason}`,
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
if (fs.existsSync(optOutAbs)) {
|
|
497
|
+
return {
|
|
498
|
+
ok: false,
|
|
499
|
+
severity: 'error',
|
|
500
|
+
detail: `${OPT_OUT_REL} exists beside ${CONFIG_REL}: delete the opt-out, the repo is migrated`,
|
|
385
501
|
};
|
|
386
502
|
}
|
|
387
503
|
let allowed;
|
|
@@ -392,8 +508,10 @@ export function checkMarketingRoutes(appRoot) {
|
|
|
392
508
|
return { ok: false, severity: 'error', detail: message };
|
|
393
509
|
}
|
|
394
510
|
let handWritten;
|
|
511
|
+
let warnings;
|
|
395
512
|
try {
|
|
396
513
|
handWritten = handWrittenAllowlist(config);
|
|
514
|
+
warnings = parseAllowlist(config).warnings;
|
|
397
515
|
} catch (error) {
|
|
398
516
|
const message = error instanceof Error ? error.message : String(error);
|
|
399
517
|
return { ok: false, severity: 'error', detail: message };
|
|
@@ -401,26 +519,44 @@ export function checkMarketingRoutes(appRoot) {
|
|
|
401
519
|
const found = listMarketingPages(appRoot);
|
|
402
520
|
const extras = found.pages.filter((rest) => !allowed.has(rest) && !isAllowlisted(handWritten, rest));
|
|
403
521
|
const outside = found.outside.filter((rel) => !isAllowlisted(handWritten, appRestFromRel(rel)));
|
|
522
|
+
const handlers = listRouteHandlers(appRoot);
|
|
523
|
+
const allowedShapes = new Set([...allowed].map(restShape));
|
|
524
|
+
const handlerProblems = [
|
|
525
|
+
...handlers.inside.filter((rel) => {
|
|
526
|
+
const rest = routeRestFromRel(rel.replace(/\/route\.tsx?$/, '/page.ts')) ?? '';
|
|
527
|
+
return !isAllowlisted(handWritten, rest);
|
|
528
|
+
}),
|
|
529
|
+
...handlers.outside
|
|
530
|
+
.filter(
|
|
531
|
+
(item) =>
|
|
532
|
+
allowedShapes.has(restShape(item.rest)) && !isAllowlisted(handWritten, item.rest),
|
|
533
|
+
)
|
|
534
|
+
.map((item) => item.rel),
|
|
535
|
+
];
|
|
404
536
|
const drift = generatedDrift(appRoot, config);
|
|
405
537
|
/** @type {string[]} */
|
|
406
538
|
const problems = [
|
|
407
539
|
...outside,
|
|
408
540
|
...extras.map((rest) => `(cms-routes)/${rest ? `${rest}/` : ''}page`),
|
|
541
|
+
...handlerProblems,
|
|
409
542
|
...drift,
|
|
410
543
|
...supportDrift(appRoot, config),
|
|
411
544
|
...policyProblems(appRoot, allowed),
|
|
412
545
|
...proxyMarkdownProblems(appRoot),
|
|
413
546
|
];
|
|
547
|
+
const note = warnings.length > 0 ? ` [warning: ${warnings.join('; ')}]` : '';
|
|
414
548
|
if (problems.length > 0) {
|
|
415
549
|
return {
|
|
416
550
|
ok: false,
|
|
417
551
|
severity: 'error',
|
|
418
|
-
detail: `page files outside marketing-routes.json: ${problems.join('; ')}`,
|
|
552
|
+
detail: `page files outside marketing-routes.json: ${problems.join('; ')}${note}`,
|
|
553
|
+
warnings,
|
|
419
554
|
};
|
|
420
555
|
}
|
|
421
556
|
return {
|
|
422
557
|
ok: true,
|
|
423
|
-
detail: `${found.pages.length} cms page files match marketing-routes.json`,
|
|
558
|
+
detail: `${found.pages.length} cms page files match marketing-routes.json${note}`,
|
|
559
|
+
warnings,
|
|
424
560
|
};
|
|
425
561
|
}
|
|
426
562
|
|
|
@@ -535,7 +671,7 @@ function slugList(values) {
|
|
|
535
671
|
|
|
536
672
|
/**
|
|
537
673
|
* @param {Record<string, unknown>} config
|
|
538
|
-
* @returns {{ slug: string, indexPath: string, articlePath: string }[]}
|
|
674
|
+
* @returns {{ slug: string, indexPath: string, articlePath: string, detailPages?: false }[]}
|
|
539
675
|
*/
|
|
540
676
|
function articleRouteRecords(config) {
|
|
541
677
|
const articles = typeof config.articlesSlug === 'string' ? config.articlesSlug : '';
|
|
@@ -551,7 +687,12 @@ function articleRouteRecords(config) {
|
|
|
551
687
|
}
|
|
552
688
|
const indexPath = `/${underPrefix(articles, route.indexSlug)}/`;
|
|
553
689
|
const articlePath = `/${underPrefix(articles, route.slug)}/`;
|
|
554
|
-
return {
|
|
690
|
+
return {
|
|
691
|
+
slug: route.slug,
|
|
692
|
+
indexPath,
|
|
693
|
+
articlePath,
|
|
694
|
+
...(route.detailPages ? {} : { detailPages: false }),
|
|
695
|
+
};
|
|
555
696
|
});
|
|
556
697
|
}
|
|
557
698
|
|
|
@@ -573,10 +714,18 @@ export function renderMarketingSlugs(config) {
|
|
|
573
714
|
: `[\n${routes
|
|
574
715
|
.map(
|
|
575
716
|
(route) =>
|
|
576
|
-
` { slug: '${route.slug}', indexPath: '${route.indexPath}', articlePath: '${route.articlePath}' },`,
|
|
717
|
+
` { slug: '${route.slug}', indexPath: '${route.indexPath}', articlePath: '${route.articlePath}'${route.detailPages === false ? ', detailPages: false' : ''} },`,
|
|
577
718
|
)
|
|
578
719
|
.join('\n')}\n] as const`;
|
|
579
720
|
const base = (slug) => (slug ? `'/${slug}'` : "''");
|
|
721
|
+
const indexOnly = routes.some((route) => route.detailPages === false);
|
|
722
|
+
const detailSlugLine = indexOnly
|
|
723
|
+
? `/** Article types that have /{type}/{article}/ pages. Sitemap sources use this, not ARTICLE_TYPE_SLUGS. */
|
|
724
|
+
export const ARTICLE_DETAIL_TYPE_SLUGS = ${slugList(
|
|
725
|
+
routes.filter((route) => route.detailPages !== false).map((route) => route.slug),
|
|
726
|
+
)};
|
|
727
|
+
`
|
|
728
|
+
: '';
|
|
580
729
|
const shape = sectionShape(config);
|
|
581
730
|
const detailLines = shape.declared
|
|
582
731
|
? `export const PERSON_DETAIL_SLUG = '${shape.personBase}';
|
|
@@ -595,7 +744,7 @@ export const ARTICLES_BASE = ${base(articles)};
|
|
|
595
744
|
${detailLines}export const PERSON_TYPE_SLUGS = ${slugList(personTypes)};
|
|
596
745
|
export const TAG_TYPE_SLUGS = ${slugList(tagTypes)};
|
|
597
746
|
export const ARTICLE_TYPE_SLUGS = ${slugList(articleSlugs)};
|
|
598
|
-
export const ARTICLE_TYPE_ROUTES = ${routeLiteral};
|
|
747
|
+
${detailSlugLine}export const ARTICLE_TYPE_ROUTES = ${routeLiteral};
|
|
599
748
|
`;
|
|
600
749
|
}
|
|
601
750
|
|
|
@@ -927,7 +1076,10 @@ export function mustBeSsgOrStaticRoutes(config) {
|
|
|
927
1076
|
} else if (Array.isArray(config.articleTypes)) {
|
|
928
1077
|
for (const type of config.articleTypes) {
|
|
929
1078
|
const route = articleTypeRoute(type, config);
|
|
930
|
-
|
|
1079
|
+
const detail = articleDetailRest(underPrefix(articles, route.slug), route);
|
|
1080
|
+
if (detail) {
|
|
1081
|
+
push(detail);
|
|
1082
|
+
}
|
|
931
1083
|
}
|
|
932
1084
|
}
|
|
933
1085
|
const shape = isSectionConfig(config) ? sectionShape(config) : null;
|
|
@@ -1147,9 +1299,15 @@ function categoryPath(config) {
|
|
|
1147
1299
|
}
|
|
1148
1300
|
|
|
1149
1301
|
/**
|
|
1302
|
+
* Per-type options (object form of `articleTypes`):
|
|
1303
|
+
* - `detailPages: false` — index only. The index is served at `indexSlug`; no
|
|
1304
|
+
* `/{slug}/{article}/` or `/{indexSlug}/{article}/` page is generated.
|
|
1305
|
+
* - `nestedSlugs: true` — detail pages are `/{slug}/[...slugs]` (an article slug
|
|
1306
|
+
* such as `acme/launch`) instead of the single segment `/{slug}/[article]`.
|
|
1307
|
+
*
|
|
1150
1308
|
* @param {unknown} type
|
|
1151
1309
|
* @param {Record<string, unknown>} [config]
|
|
1152
|
-
* @returns {{ slug: string, indexSlug: string }}
|
|
1310
|
+
* @returns {{ slug: string, indexSlug: string, detailPages: boolean, nestedSlugs: boolean }}
|
|
1153
1311
|
*/
|
|
1154
1312
|
function articleTypeRoute(type, config = {}) {
|
|
1155
1313
|
const category = categoryPath(config);
|
|
@@ -1157,7 +1315,7 @@ function articleTypeRoute(type, config = {}) {
|
|
|
1157
1315
|
const slug = category
|
|
1158
1316
|
? requireRoutePath(type, 'articleTypes')
|
|
1159
1317
|
: requireSegment(type, 'articleTypes');
|
|
1160
|
-
return { slug, indexSlug: slug };
|
|
1318
|
+
return { slug, indexSlug: slug, detailPages: true, nestedSlugs: false };
|
|
1161
1319
|
}
|
|
1162
1320
|
const slug = category
|
|
1163
1321
|
? requireRoutePath(type?.slug, 'articleTypes.slug')
|
|
@@ -1169,12 +1327,49 @@ function articleTypeRoute(type, config = {}) {
|
|
|
1169
1327
|
`${slug} indexSlug must equal the article type slug when the category is in the path`,
|
|
1170
1328
|
);
|
|
1171
1329
|
}
|
|
1330
|
+
/**
|
|
1331
|
+
* @param {string} key
|
|
1332
|
+
*/
|
|
1333
|
+
const optional = (key) => {
|
|
1334
|
+
const value = type?.[key];
|
|
1335
|
+
if (value !== undefined && typeof value !== 'boolean') {
|
|
1336
|
+
throw new Error(`articleTypes.${key} for "${slug}" must be a boolean`);
|
|
1337
|
+
}
|
|
1338
|
+
return value;
|
|
1339
|
+
};
|
|
1340
|
+
const detailPages = optional('detailPages') !== false;
|
|
1341
|
+
const nestedSlugs = optional('nestedSlugs') === true;
|
|
1342
|
+
if ((category || config.tagInPath === true) && (!detailPages || nestedSlugs)) {
|
|
1343
|
+
throw new Error(
|
|
1344
|
+
`articleTypes "${slug}": detailPages and nestedSlugs are not supported with tagInPath`,
|
|
1345
|
+
);
|
|
1346
|
+
}
|
|
1347
|
+
if (!detailPages && nestedSlugs) {
|
|
1348
|
+
throw new Error(`articleTypes "${slug}": nestedSlugs has no effect with detailPages: false`);
|
|
1349
|
+
}
|
|
1172
1350
|
return {
|
|
1173
1351
|
slug,
|
|
1174
1352
|
indexSlug: category ? slug : requireSegment(rawIndex, 'articleTypes.indexSlug'),
|
|
1353
|
+
detailPages,
|
|
1354
|
+
nestedSlugs,
|
|
1175
1355
|
};
|
|
1176
1356
|
}
|
|
1177
1357
|
|
|
1358
|
+
/**
|
|
1359
|
+
* The detail route of a plain article type, with the real param name
|
|
1360
|
+
* (`[article]` or `[...slugs]`), or null for an index-only type.
|
|
1361
|
+
*
|
|
1362
|
+
* @param {string} articleRest `{articles}/{slug}`
|
|
1363
|
+
* @param {{ detailPages: boolean, nestedSlugs: boolean }} route
|
|
1364
|
+
* @returns {string | null}
|
|
1365
|
+
*/
|
|
1366
|
+
export function articleDetailRest(articleRest, route) {
|
|
1367
|
+
if (!route.detailPages) {
|
|
1368
|
+
return null;
|
|
1369
|
+
}
|
|
1370
|
+
return `${articleRest}/${route.nestedSlugs ? '[...slugs]' : '[article]'}`;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1178
1373
|
/**
|
|
1179
1374
|
* @param {string} prefix
|
|
1180
1375
|
* @param {string} segment
|
|
@@ -1240,7 +1435,10 @@ function addSectionRests(allowed, config) {
|
|
|
1240
1435
|
const indexRest = underPrefix(articles, route.indexSlug);
|
|
1241
1436
|
const articleRest = underPrefix(articles, route.slug);
|
|
1242
1437
|
allowed.add(indexRest);
|
|
1243
|
-
|
|
1438
|
+
const detail = articleDetailRest(articleRest, route);
|
|
1439
|
+
if (detail) {
|
|
1440
|
+
allowed.add(detail);
|
|
1441
|
+
}
|
|
1244
1442
|
}
|
|
1245
1443
|
}
|
|
1246
1444
|
|
|
@@ -1309,7 +1507,15 @@ function renderSectionRoutes(config, files) {
|
|
|
1309
1507
|
const indexRest = underPrefix(articles, route.indexSlug);
|
|
1310
1508
|
const articleRest = underPrefix(articles, route.slug);
|
|
1311
1509
|
files.set(indexRest, concreteArticleTypeIndex(indexRest, route.slug));
|
|
1312
|
-
|
|
1510
|
+
const detail = articleDetailRest(articleRest, route);
|
|
1511
|
+
if (detail) {
|
|
1512
|
+
files.set(
|
|
1513
|
+
detail,
|
|
1514
|
+
route.nestedSlugs
|
|
1515
|
+
? concreteNestedArticlePage(articleRest, route.slug)
|
|
1516
|
+
: concreteArticlePage(articleRest, route.slug),
|
|
1517
|
+
);
|
|
1518
|
+
}
|
|
1313
1519
|
}
|
|
1314
1520
|
}
|
|
1315
1521
|
|
|
@@ -1560,6 +1766,61 @@ ${page}
|
|
|
1560
1766
|
`;
|
|
1561
1767
|
}
|
|
1562
1768
|
|
|
1769
|
+
/**
|
|
1770
|
+
* Nested article slugs: `/{rest}/{client}/{case}/` as `[...slugs]`.
|
|
1771
|
+
*
|
|
1772
|
+
* @param {string} rest directory of the article, without `[...slugs]`
|
|
1773
|
+
* @param {string} typeSlug
|
|
1774
|
+
*/
|
|
1775
|
+
function concreteNestedArticlePage(rest, typeSlug) {
|
|
1776
|
+
const props = `PageProps<'/${rest}/[...slugs]'>`;
|
|
1777
|
+
const extract = openFn('async function extractDetails', [`props: ${props}`]);
|
|
1778
|
+
const metadata = openFn('export async function generateMetadata', [
|
|
1779
|
+
`props: ${props}`,
|
|
1780
|
+
'parent: ResolvingMetadata',
|
|
1781
|
+
]);
|
|
1782
|
+
const page = openFn('export default async function ', [`props: ${props}`]);
|
|
1783
|
+
return `${header()}import { joinCmsPathSegments } from '@se-studio/core-ui';
|
|
1784
|
+
import { notFoundIfImpossibleCmsSlug } from '@se-studio/core-ui/server';
|
|
1785
|
+
import type { ResolvingMetadata } from 'next';
|
|
1786
|
+
import { notFound } from 'next/navigation';
|
|
1787
|
+
import { generateArticleMetadata, generateArticlePage } from '@/lib/route-handlers';
|
|
1788
|
+
import { ARTICLE_DETAIL_ROUTE_CONFIG } from '@/lib/routeConfig';
|
|
1789
|
+
|
|
1790
|
+
const ARTICLE_TYPE = '${typeSlug}';
|
|
1791
|
+
|
|
1792
|
+
export function generateStaticParams() {
|
|
1793
|
+
return [];
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
${extract}
|
|
1797
|
+
const params = await props.params;
|
|
1798
|
+
const articleSlug = joinCmsPathSegments(params.slugs);
|
|
1799
|
+
if (!articleSlug) {
|
|
1800
|
+
notFound();
|
|
1801
|
+
}
|
|
1802
|
+
notFoundIfImpossibleCmsSlug(articleSlug);
|
|
1803
|
+
return { articleSlug, path: \`/${rest}/\${articleSlug}/\` };
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
${metadata}
|
|
1807
|
+
const { articleSlug, path } = await extractDetails(props);
|
|
1808
|
+
return await generateArticleMetadata(
|
|
1809
|
+
ARTICLE_TYPE,
|
|
1810
|
+
articleSlug,
|
|
1811
|
+
path,
|
|
1812
|
+
ARTICLE_DETAIL_ROUTE_CONFIG,
|
|
1813
|
+
parent,
|
|
1814
|
+
);
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
${page}
|
|
1818
|
+
const { articleSlug, path } = await extractDetails(props);
|
|
1819
|
+
return await generateArticlePage(ARTICLE_TYPE, articleSlug, path, ARTICLE_DETAIL_ROUTE_CONFIG);
|
|
1820
|
+
}
|
|
1821
|
+
`;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1563
1824
|
/**
|
|
1564
1825
|
* @param {string} segment
|
|
1565
1826
|
*/
|