@easy-web/core 1.9.0 → 1.10.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 +27 -3
- package/dist/contracts/capabilities.d.ts +3 -0
- package/dist/contracts/capabilities.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/ordering.d.ts +6 -0
- package/dist/contracts/ordering.d.ts.map +1 -0
- package/dist/contracts/ordering.js +22 -0
- package/dist/contracts/ordering.js.map +1 -0
- package/dist/contracts/traits.d.ts +4 -0
- package/dist/contracts/traits.d.ts.map +1 -1
- package/dist/contracts/traits.js +3 -1
- package/dist/contracts/traits.js.map +1 -1
- package/dist/recipes/content-site.d.ts.map +1 -1
- package/dist/recipes/content-site.js +213 -42
- package/dist/recipes/content-site.js.map +1 -1
- package/dist/recipes/shell-recipe.d.ts +3 -0
- package/dist/recipes/shell-recipe.d.ts.map +1 -1
- package/dist/recipes/shell-recipe.js +116 -6
- package/dist/recipes/shell-recipe.js.map +1 -1
- package/dist/seo/index.d.ts +5 -0
- package/dist/seo/index.d.ts.map +1 -1
- package/dist/seo/index.js +7 -3
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/rendered-sitemap-alternates.d.ts +7 -0
- package/dist/seo/rendered-sitemap-alternates.d.ts.map +1 -0
- package/dist/seo/rendered-sitemap-alternates.js +232 -0
- package/dist/seo/rendered-sitemap-alternates.js.map +1 -0
- package/package.json +1 -1
- package/src/contracts/__tests__/content-composition.test.ts +17 -0
- package/src/contracts/__tests__/ordering.test.ts +34 -0
- package/src/contracts/capabilities.ts +4 -0
- package/src/contracts/index.ts +1 -0
- package/src/contracts/ordering.ts +33 -0
- package/src/contracts/traits.ts +4 -1
- package/src/recipes/__tests__/content-site.test.ts +91 -2
- package/src/recipes/__tests__/shell-recipe.test.ts +31 -0
- package/src/recipes/content-site.ts +216 -48
- package/src/recipes/shell-recipe.ts +120 -6
- package/src/seo/__tests__/integration.test.ts +28 -0
- package/src/seo/__tests__/rendered-sitemap-alternates.test.ts +127 -0
- package/src/seo/__tests__/sitemap-options.test.ts +7 -7
- package/src/seo/index.ts +17 -3
- package/src/seo/rendered-sitemap-alternates.ts +231 -0
- package/src/type-tests/contracts.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rendered-sitemap-alternates.js","sourceRoot":"","sources":["../../src/seo/rendered-sitemap-alternates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQxE,SAAS,UAAU,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC7I,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACpH,CAAC;AA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,EAAE,EAAE,CACxD,yCAAyC,SAAS,CAAC,IAAI,CAAC,WAAW,SAAS,CAAC,IAAI,CAAC,KAAK,CAC1F,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACX,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,QAAQ,CAAC,CAAC;YAC5D,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACrC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YACzB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,GAAG,EAAE,CAAC,CAAC;QACpG,CAAC;QACD,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
contentCompositionSchema,
|
|
5
5
|
contentTypeDefinitionSchema,
|
|
6
6
|
moneyTraitSchema,
|
|
7
|
+
optionalOrderTraitSchema,
|
|
8
|
+
orderTraitSchema,
|
|
7
9
|
presentationBindings,
|
|
8
10
|
} from '../index.js';
|
|
9
11
|
|
|
@@ -156,6 +158,21 @@ describe('content trait data schemas', () => {
|
|
|
156
158
|
expect(unselected.success).toBe(false);
|
|
157
159
|
});
|
|
158
160
|
|
|
161
|
+
it('keeps the published order trait required and exposes a finite optional entry shape', () => {
|
|
162
|
+
// Given / When
|
|
163
|
+
const valid = [-12, 0, 24].map((order) => optionalOrderTraitSchema.safeParse({ order }));
|
|
164
|
+
const invalidValues: readonly unknown[] = [NaN, Infinity, -Infinity, 1.5, '2'];
|
|
165
|
+
|
|
166
|
+
// Then
|
|
167
|
+
expect(orderTraitSchema.safeParse({}).success).toBe(false);
|
|
168
|
+
expect(orderTraitSchema.parse({ order: -12 })).toEqual({ order: -12 });
|
|
169
|
+
expect(optionalOrderTraitSchema.parse({})).toEqual({});
|
|
170
|
+
expect(valid.every((result) => result.success)).toBe(true);
|
|
171
|
+
expect(invalidValues.every((order) => !optionalOrderTraitSchema.safeParse({ order }).success)).toBe(true);
|
|
172
|
+
expect(invalidValues.every((order) => !orderTraitSchema.safeParse({ order }).success)).toBe(true);
|
|
173
|
+
expect(composeContentTraitSchema(['order']).safeParse({}).success).toBe(false);
|
|
174
|
+
});
|
|
175
|
+
|
|
159
176
|
it.each([
|
|
160
177
|
['EUR', true],
|
|
161
178
|
['usd', false],
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { compareContentOrder } from '../ordering.js';
|
|
3
|
+
|
|
4
|
+
describe('compareContentOrder', () => {
|
|
5
|
+
it('orders finite values ascending and leaves missing values last', () => {
|
|
6
|
+
const entries = [
|
|
7
|
+
{ order: 5, slug: 'last', id: 'last' },
|
|
8
|
+
{ slug: 'missing', id: 'missing' },
|
|
9
|
+
{ order: 0, slug: 'zero', id: 'zero' },
|
|
10
|
+
{ order: -5, slug: 'first', id: 'first' },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
expect(entries.toSorted((left, right) => compareContentOrder(left, right, 'en')).map(({ id }) => id))
|
|
14
|
+
.toEqual(['first', 'zero', 'last', 'missing']);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('breaks ties by locale-explicit slug and then ordinal ID, independent of input order', () => {
|
|
18
|
+
const entries = [
|
|
19
|
+
{ order: 1, slug: 'entry', id: 'z-id' },
|
|
20
|
+
{ order: 1, slug: 'zebra', id: 'zebra' },
|
|
21
|
+
{ order: 1, slug: 'entry', id: 'a-id' },
|
|
22
|
+
{ order: 1, slug: 'alpha', id: 'alpha' },
|
|
23
|
+
];
|
|
24
|
+
const compare = (left: typeof entries[number], right: typeof entries[number]) => compareContentOrder(left, right, 'en');
|
|
25
|
+
|
|
26
|
+
expect(entries.toSorted(compare).map(({ id }) => id)).toEqual(['alpha', 'a-id', 'z-id', 'zebra']);
|
|
27
|
+
expect([...entries].reverse().toSorted(compare).map(({ id }) => id)).toEqual(['alpha', 'a-id', 'z-id', 'zebra']);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it.each([NaN, Infinity, -Infinity, 1.5])('rejects invalid numeric order %s', (order) => {
|
|
31
|
+
expect(() => compareContentOrder({ order, slug: 'entry', id: 'entry' }, { slug: 'other', id: 'other' }, 'en'))
|
|
32
|
+
.toThrow('finite integer');
|
|
33
|
+
});
|
|
34
|
+
});
|
package/src/contracts/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HasOptionalOrder, HasSlug } from './capabilities.js';
|
|
2
|
+
|
|
3
|
+
export interface OrderedContentEntry extends HasOptionalOrder, HasSlug {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function compareIdentifiers(left: string, right: string): number {
|
|
8
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function assertValidOrder(order: number | undefined): void {
|
|
12
|
+
if (order !== undefined && (!Number.isFinite(order) || !Number.isInteger(order))) {
|
|
13
|
+
throw new TypeError('Content order must be a finite integer');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function compareContentOrder(
|
|
18
|
+
left: OrderedContentEntry,
|
|
19
|
+
right: OrderedContentEntry,
|
|
20
|
+
locale: string,
|
|
21
|
+
): number {
|
|
22
|
+
assertValidOrder(left.order);
|
|
23
|
+
assertValidOrder(right.order);
|
|
24
|
+
|
|
25
|
+
if (left.order === undefined && right.order !== undefined) return 1;
|
|
26
|
+
if (left.order !== undefined && right.order === undefined) return -1;
|
|
27
|
+
if (left.order !== undefined && right.order !== undefined && left.order !== right.order) {
|
|
28
|
+
return left.order < right.order ? -1 : 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const slugOrder = left.slug.localeCompare(right.slug, locale);
|
|
32
|
+
return slugOrder === 0 ? compareIdentifiers(left.id, right.id) : slugOrder;
|
|
33
|
+
}
|
package/src/contracts/traits.ts
CHANGED
|
@@ -24,7 +24,8 @@ const summaryShape = { summary: z.string().min(1) };
|
|
|
24
24
|
const bodyShape = { body: z.string().min(1) };
|
|
25
25
|
const imageShape = { image: imageSchema };
|
|
26
26
|
const photosShape = { photos: z.array(imageSchema).readonly() };
|
|
27
|
-
const orderShape = { order: z.number().int() };
|
|
27
|
+
const orderShape = { order: z.number().finite().int() };
|
|
28
|
+
const optionalOrderShape = { order: z.number().finite().int().optional() };
|
|
28
29
|
const taxonomyShape = { taxonomy: z.array(z.string().min(1)).readonly() };
|
|
29
30
|
const publicationShape = { publishDate: z.date(), modifiedDate: z.date().optional() };
|
|
30
31
|
const scheduleShape = { startDate: z.date(), endDate: z.date().optional() };
|
|
@@ -60,6 +61,7 @@ export const bodyTraitSchema = z.object(bodyShape).strict().readonly();
|
|
|
60
61
|
export const imageTraitSchema = z.object(imageShape).strict().readonly();
|
|
61
62
|
export const photosTraitSchema = z.object(photosShape).strict().readonly();
|
|
62
63
|
export const orderTraitSchema = z.object(orderShape).strict().readonly();
|
|
64
|
+
export const optionalOrderTraitSchema = z.object(optionalOrderShape).strict().readonly();
|
|
63
65
|
export const taxonomyTraitSchema = z.object(taxonomyShape).strict().readonly();
|
|
64
66
|
export const publicationTraitSchema = z.object(publicationShape).strict().readonly();
|
|
65
67
|
export const scheduleTraitSchema = z.object(scheduleShape).strict().readonly();
|
|
@@ -75,6 +77,7 @@ export type BodyTrait = z.infer<typeof bodyTraitSchema>;
|
|
|
75
77
|
export type ImageTrait = z.infer<typeof imageTraitSchema>;
|
|
76
78
|
export type PhotosTrait = z.infer<typeof photosTraitSchema>;
|
|
77
79
|
export type OrderTrait = z.infer<typeof orderTraitSchema>;
|
|
80
|
+
export type OptionalOrderTrait = z.infer<typeof optionalOrderTraitSchema>;
|
|
78
81
|
export type TaxonomyTrait = z.infer<typeof taxonomyTraitSchema>;
|
|
79
82
|
export type PublicationTrait = z.infer<typeof publicationTraitSchema>;
|
|
80
83
|
export type ScheduleTrait = z.infer<typeof scheduleTraitSchema>;
|
|
@@ -11,6 +11,18 @@ const type = {
|
|
|
11
11
|
const composition = { contentLocales: ['en'], contentTypes: [type] };
|
|
12
12
|
|
|
13
13
|
describe('content site recipes', () => {
|
|
14
|
+
it.each([{ traits: ['title', 'slug', 'body'] }, { traits: type.traits }])('declares the first trait-schema runtime with traits $traits', async ({ traits }) => {
|
|
15
|
+
const { content } = createContentSiteRecipes({ ...composition, contentTypes: [{ ...type, traits }] });
|
|
16
|
+
const output = await content.generate({ options: {}, capabilities: [], contributions: [] });
|
|
17
|
+
const manifest = JSON.parse(String(output.files.find(({ path }) => path === 'package.json')?.content));
|
|
18
|
+
expect(manifest.dependencies).toEqual({
|
|
19
|
+
'@easy-web/core': '^1.6.0',
|
|
20
|
+
...(traits.includes('image') ? { sharp: '^0.35.0' } : {}),
|
|
21
|
+
});
|
|
22
|
+
expect(content.compatibleRuntimeRange).toBe(manifest.dependencies['@easy-web/core']);
|
|
23
|
+
expect(content.outputContributions).toContainEqual(expect.objectContaining({ kind: 'dependency', target: 'package.json' }));
|
|
24
|
+
});
|
|
25
|
+
|
|
14
26
|
it('resolves content roles, rendering bindings and routes with shell navigation', async () => {
|
|
15
27
|
const recipes = createContentSiteRecipes(composition);
|
|
16
28
|
const graph = resolveCapabilityGraph([recipes.content, recipes.shell]);
|
|
@@ -24,16 +36,43 @@ describe('content site recipes', () => {
|
|
|
24
36
|
const content = await recipes.content.generate({ options: {}, capabilities: [], contributions: [] });
|
|
25
37
|
expect(content.files.find(({ path }) => path === 'src/content/definitions.ts')?.content).toContain('image()');
|
|
26
38
|
expect(content.files.find(({ path }) => path === 'src/lib/content/entries.ts')?.content).toContain("assertImplements<Entry['data'], HasTitle & HasSlug & HasSummary & HasImage>()");
|
|
39
|
+
expect(content.files.find(({ path }) => path === 'src/pages/entries/index.astro')?.content)
|
|
40
|
+
.toContain('.map(toItem).sort((left, right) => left.href < right.href');
|
|
27
41
|
});
|
|
28
42
|
|
|
29
43
|
it('omits optional image/summary fields and navigation rather than inventing capabilities', async () => {
|
|
30
44
|
const recipes = createContentSiteRecipes({ ...composition, contentTypes: [{ ...type, traits: ['title', 'slug', 'body'], bindings: ['list', 'detail'] }] });
|
|
31
45
|
const content = await recipes.content.generate({ options: {}, capabilities: [], contributions: [] });
|
|
46
|
+
const list = String(content.files.find(({ path }) => path === 'src/pages/entries/index.astro')?.content);
|
|
32
47
|
expect(content.files.some(({ path }) => path.endsWith('.svg'))).toBe(false);
|
|
33
48
|
expect(content.files.find(({ path }) => path === 'src/lib/content/entries.ts')?.content).not.toContain('data.summary');
|
|
49
|
+
expect(list).toContain('.map(toItem).sort((left, right) => left.href');
|
|
50
|
+
expect(list).not.toContain('compareContentOrder');
|
|
34
51
|
expect(recipes.content.outputContributions.some(({ id }) => id.endsWith('.navigation'))).toBe(false);
|
|
35
52
|
});
|
|
36
53
|
|
|
54
|
+
it('generates optional ordered entries, locale-aware list comparison and the required runtime floor', async () => {
|
|
55
|
+
const orderedComposition = {
|
|
56
|
+
...composition,
|
|
57
|
+
contentTypes: [{ ...type, traits: ['title', 'slug', 'body', 'order'] }],
|
|
58
|
+
};
|
|
59
|
+
const { content } = createContentSiteRecipes(orderedComposition);
|
|
60
|
+
const output = await content.generate({ options: {}, capabilities: [], contributions: [] });
|
|
61
|
+
const definitions = String(output.files.find(({ path }) => path === 'src/content/definitions.ts')?.content);
|
|
62
|
+
const adapter = String(output.files.find(({ path }) => path === 'src/lib/content/entries.ts')?.content);
|
|
63
|
+
const list = String(output.files.find(({ path }) => path === 'src/pages/entries/index.astro')?.content);
|
|
64
|
+
const manifest = JSON.parse(String(output.files.find(({ path }) => path === 'package.json')?.content));
|
|
65
|
+
|
|
66
|
+
expect(definitions).toContain('optionalOrderTraitSchema');
|
|
67
|
+
expect(adapter).toContain('HasOptionalOrder');
|
|
68
|
+
expect(list).toContain("import { compareContentOrder } from '@easy-web/core/contracts'");
|
|
69
|
+
expect(list).toContain('compareContentOrder(');
|
|
70
|
+
expect(list).toContain('"en"');
|
|
71
|
+
expect(list).not.toContain('.map(toItem).sort((left, right) => left.href');
|
|
72
|
+
expect(manifest.dependencies['@easy-web/core']).toBe('^1.10.0');
|
|
73
|
+
expect(content.compatibleRuntimeRange).toBe('^1.10.0');
|
|
74
|
+
});
|
|
75
|
+
|
|
37
76
|
it('uses bracket access for kebab-case collection IDs and nested route imports', async () => {
|
|
38
77
|
const recipes = createContentSiteRecipes({ ...composition, contentTypes: [{ ...type, id: 'example-entry', routes: { en: '/library/entries' } }] });
|
|
39
78
|
const content = await recipes.content.generate({ options: {}, capabilities: [], contributions: [] });
|
|
@@ -59,8 +98,58 @@ describe('content site recipes', () => {
|
|
|
59
98
|
expect(() => createContentSiteRecipes({ ...composition, contentTypes: [type, { ...type, id: 'other', primary: false, routes: { en: '/entries/example/' } }] })).toThrow('overlap');
|
|
60
99
|
});
|
|
61
100
|
|
|
62
|
-
it('rejects
|
|
101
|
+
it('rejects unsupported locale sets and empty content selections', () => {
|
|
63
102
|
expect(generatedContentCompositionSchema.safeParse({ contentLocales: ['en'], contentTypes: [] }).success).toBe(false);
|
|
64
|
-
expect(generatedContentCompositionSchema.safeParse({
|
|
103
|
+
expect(generatedContentCompositionSchema.safeParse({
|
|
104
|
+
contentLocales: ['de', 'fr'], contentTypes: [{ ...type, labels: { de: 'Einträge', fr: 'Entrées' }, routes: { de: '/beitraege/', fr: '/entrees/' } }],
|
|
105
|
+
}).success).toBe(false);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('generates localized collections, routes and translation-aware links for the DE/EN pair', async () => {
|
|
109
|
+
const bilingual = {
|
|
110
|
+
contentLocales: ['de', 'en'],
|
|
111
|
+
contentTypes: [{
|
|
112
|
+
...type,
|
|
113
|
+
labels: { de: 'Beiträge', en: 'Entries' },
|
|
114
|
+
routes: { de: '/beitraege/', en: '/entries/' },
|
|
115
|
+
traits: ['title', 'slug', 'summary', 'body'],
|
|
116
|
+
}],
|
|
117
|
+
};
|
|
118
|
+
const recipes = createContentSiteRecipes(bilingual);
|
|
119
|
+
const content = await recipes.content.generate({ options: {}, capabilities: [], contributions: [] });
|
|
120
|
+
const paths = content.files.map(({ path }) => path);
|
|
121
|
+
expect(paths).toEqual(expect.arrayContaining([
|
|
122
|
+
'src/content/entries/de/example.md', 'src/content/entries/en/example.md',
|
|
123
|
+
'src/pages/beitraege/index.astro', 'src/pages/beitraege/[slug].astro',
|
|
124
|
+
'src/pages/entries/index.astro', 'src/pages/entries/[slug].astro',
|
|
125
|
+
]));
|
|
126
|
+
const german = content.files.find(({ path }) => path === 'src/content/entries/de/example.md')!.content;
|
|
127
|
+
const english = content.files.find(({ path }) => path === 'src/content/entries/en/example.md')!.content;
|
|
128
|
+
expect(german).toContain('"locale": "de"');
|
|
129
|
+
expect(german).toContain('"translationKey": "example"');
|
|
130
|
+
expect(german).toContain('Beiträge - Beispiel');
|
|
131
|
+
expect(english).toContain('Entries - Example');
|
|
132
|
+
const definitions = content.files.find(({ path }) => path === 'src/content/definitions.ts')!.content;
|
|
133
|
+
expect(definitions).toContain('locale: z.enum(["de","en"])');
|
|
134
|
+
expect(definitions).toContain('translationKey: z.string().min(1)');
|
|
135
|
+
const detail = content.files.find(({ path }) => path === 'src/pages/beitraege/[slug].astro')!.content;
|
|
136
|
+
expect(detail).toContain('candidate.data.translationKey === entry.data.translationKey');
|
|
137
|
+
expect(detail).toContain('routeBases[candidate.data.locale] + \'/\' + candidate.data.slug + \'/\'');
|
|
138
|
+
expect(detail).toContain('locale={"de"}');
|
|
139
|
+
const list = content.files.find(({ path }) => path === 'src/pages/entries/index.astro')!.content;
|
|
140
|
+
expect(list).toContain('data.locale === "en"');
|
|
141
|
+
expect(list).toContain('locale={"en"}');
|
|
142
|
+
expect(list.indexOf('.sort((left, right) => left.data.slug')).toBeLessThan(list.indexOf('.map((entry) => toItem(entry, "en", sitePrefix))'));
|
|
143
|
+
expect(recipes.content.compatibleRuntimeRange).toBe('^1.10.0');
|
|
144
|
+
expect(recipes.shell.outputContributions).toContainEqual(expect.objectContaining({ target: '/en/' }));
|
|
145
|
+
expect(recipes.content.outputContributions).toContainEqual(expect.objectContaining({ target: '/beitraege/[slug]' }));
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('preserves the single-locale runtime minimum', async () => {
|
|
149
|
+
const { content } = createContentSiteRecipes(composition);
|
|
150
|
+
const output = await content.generate({ options: {}, capabilities: [], contributions: [] });
|
|
151
|
+
const manifest = JSON.parse(String(output.files.find(({ path }) => path === 'package.json')?.content));
|
|
152
|
+
expect(manifest.dependencies['@easy-web/core']).toBe('^1.6.0');
|
|
153
|
+
expect(content.compatibleRuntimeRange).toBe('^1.6.0');
|
|
65
154
|
});
|
|
66
155
|
});
|
|
@@ -74,4 +74,35 @@ describe('shell recipe', () => {
|
|
|
74
74
|
|
|
75
75
|
expect(workspace.content).toBe('allowBuilds:\n esbuild: true\n sharp: true\n');
|
|
76
76
|
});
|
|
77
|
+
|
|
78
|
+
it('keeps the shell-only runtime floor independent of content generation', () => {
|
|
79
|
+
const manifest = JSON.parse(buildShellFiles({}).find(({ path }) => path === 'package.json')!.content);
|
|
80
|
+
expect(manifest.dependencies['@easy-web/core']).toBe('^1.5.0');
|
|
81
|
+
expect(manifest.dependencies['@easy-web/cms-adapters']).toBeUndefined();
|
|
82
|
+
expect(manifest.dependencies.sharp).toBeUndefined();
|
|
83
|
+
expect(shellRecipe.compatibleRuntimeRange).toBe('^1.5.0');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('opts only localized content shells into manual routes and rendered sitemap alternates', () => {
|
|
87
|
+
const files = buildShellFiles({ defaultLocale: 'de' }, [], {
|
|
88
|
+
contentLocales: ['de', 'en'],
|
|
89
|
+
navigationByLocale: { de: [{ label: 'Beiträge', href: '/beitraege/' }], en: [{ label: 'Entries', href: '/entries/' }] },
|
|
90
|
+
localizedPaths: [{ de: '/', en: '/en/' }, { de: '/beitraege/', en: '/entries/' }],
|
|
91
|
+
});
|
|
92
|
+
const config = files.find(({ path }) => path === 'astro.config.mjs')!.content;
|
|
93
|
+
const layout = files.find(({ path }) => path === 'src/layouts/Base.astro')!.content;
|
|
94
|
+
const root = files.find(({ path }) => path === 'src/pages/index.astro')!.content;
|
|
95
|
+
const englishHome = files.find(({ path }) => path === 'src/pages/en/index.astro')!.content;
|
|
96
|
+
expect(config).toContain('i18n: { defaultLocale: "de", locales: ["de","en"] }');
|
|
97
|
+
expect(config).toContain('"synchronizeRenderedAlternates":true');
|
|
98
|
+
expect(config).toContain('"de":"de","en":"en"');
|
|
99
|
+
expect(layout).toContain('<html lang={currentLang}>');
|
|
100
|
+
expect(layout).toContain('navigationByLocale[currentLang]');
|
|
101
|
+
expect(layout).toContain('alternates={alternates}');
|
|
102
|
+
expect(layout).toContain('import.meta.env.BASE_URL');
|
|
103
|
+
expect(root).toContain('Willkommen');
|
|
104
|
+
expect(root).toContain('getAlternateLinks');
|
|
105
|
+
expect(englishHome).toContain('Welcome');
|
|
106
|
+
expect(files.find(({ path }) => path === 'src/lib/localized-paths.ts')?.content).toContain('"/beitraege/"');
|
|
107
|
+
});
|
|
77
108
|
});
|