@jjlmoya/utils-pets 1.6.0 → 1.9.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/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from './tool/petAge';
|
|
|
2
2
|
export * from './tool/petRation';
|
|
3
3
|
|
|
4
4
|
export { petsCategory } from './category';
|
|
5
|
-
export
|
|
5
|
+
export const PetsCategorySEO = () => import('./category/seo.astro').then((m) => m.default);
|
|
6
6
|
|
|
7
7
|
export type {
|
|
8
8
|
KnownLocale,
|
|
@@ -17,4 +17,4 @@ export type {
|
|
|
17
17
|
PetCategoryEntry,
|
|
18
18
|
} from './types';
|
|
19
19
|
|
|
20
|
-
export { ALL_TOOLS } from './tools';
|
|
20
|
+
export { ALL_ENTRIES, ALL_TOOLS } from './tools';
|
|
@@ -14,7 +14,8 @@ import type { UtilitySEOContent } from "@jjlmoya/utils-shared";
|
|
|
14
14
|
export async function getStaticPaths() {
|
|
15
15
|
const paths = [];
|
|
16
16
|
|
|
17
|
-
for (const { entry, Component } of ALL_TOOLS) {
|
|
17
|
+
for (const { entry, Component: lazyComp } of ALL_TOOLS) {
|
|
18
|
+
const { default: Component } = await lazyComp();
|
|
18
19
|
const localeEntries = Object.entries(entry.i18n) as [
|
|
19
20
|
KnownLocale,
|
|
20
21
|
() => Promise<ToolLocaleContent>,
|
|
@@ -52,8 +53,6 @@ export async function getStaticPaths() {
|
|
|
52
53
|
return paths;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
type ToolComponent = (props: { ui: Record<string, string> }) => unknown;
|
|
56
|
-
|
|
57
56
|
interface NavItem {
|
|
58
57
|
id: string;
|
|
59
58
|
title: string;
|
|
@@ -62,7 +61,7 @@ interface NavItem {
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
interface Props {
|
|
65
|
-
Component:
|
|
64
|
+
Component: unknown;
|
|
66
65
|
locale: KnownLocale;
|
|
67
66
|
content: ToolLocaleContent;
|
|
68
67
|
localeUrls: Partial<Record<KnownLocale, string>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { ALL_TOOLS } from '../tools';
|
|
3
|
+
import type { ToolLocaleContent } from '../types';
|
|
4
|
+
|
|
5
|
+
describe('Slug Language Code Format Validation', () => {
|
|
6
|
+
ALL_TOOLS.forEach((tool) => {
|
|
7
|
+
describe(`Tool: ${tool.entry.id}`, () => {
|
|
8
|
+
it('slug should not end with 2-letter language codes like -ja, -ru, -ko', async () => {
|
|
9
|
+
const locales = Object.keys(tool.entry.i18n);
|
|
10
|
+
|
|
11
|
+
for (const locale of locales) {
|
|
12
|
+
const loader = tool.entry.i18n[locale as keyof typeof tool.entry.i18n];
|
|
13
|
+
const content = (await loader?.()) as ToolLocaleContent;
|
|
14
|
+
|
|
15
|
+
expect(
|
|
16
|
+
content.slug,
|
|
17
|
+
`Tool "${tool.entry.id}" locale "${locale}" slug ("${content.slug}") cannot end with a 2-letter language code (e.g., -ja, -ru, -ko).`,
|
|
18
|
+
).not.toMatch(/-[a-z]{2}$/);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
package/src/tool/petAge/index.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { PetToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
|
|
2
|
-
import PetAgeCalculator from './component.astro';
|
|
3
|
-
import PetAgeSEO from './seo.astro';
|
|
4
|
-
import PetAgeBibliography from './bibliography.astro';
|
|
5
2
|
|
|
6
3
|
export interface PetAgeUI {
|
|
7
4
|
[key: string]: string;
|
|
@@ -66,11 +63,10 @@ export const petAge: PetToolEntry<PetAgeUI> = {
|
|
|
66
63
|
},
|
|
67
64
|
};
|
|
68
65
|
|
|
69
|
-
export { PetAgeCalculator, PetAgeSEO, PetAgeBibliography };
|
|
70
66
|
|
|
71
67
|
export const PET_AGE_TOOL: ToolDefinition = {
|
|
72
68
|
entry: petAge,
|
|
73
|
-
Component:
|
|
74
|
-
SEOComponent:
|
|
75
|
-
BibliographyComponent:
|
|
69
|
+
Component: () => import('./component.astro'),
|
|
70
|
+
SEOComponent: () => import('./seo.astro'),
|
|
71
|
+
BibliographyComponent: () => import('./bibliography.astro'),
|
|
76
72
|
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { PetToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
|
|
2
|
-
import PetRationCalculator from './component.astro';
|
|
3
|
-
import PetRationSEO from './seo.astro';
|
|
4
|
-
import PetRationBibliography from './bibliography.astro';
|
|
5
2
|
|
|
6
3
|
export interface PetRationUI {
|
|
7
4
|
[key: string]: string;
|
|
@@ -65,11 +62,10 @@ export const petRation: PetToolEntry<PetRationUI> = {
|
|
|
65
62
|
},
|
|
66
63
|
};
|
|
67
64
|
|
|
68
|
-
export { PetRationCalculator, PetRationSEO, PetRationBibliography };
|
|
69
65
|
|
|
70
66
|
export const PET_RATION_TOOL: ToolDefinition = {
|
|
71
67
|
entry: petRation,
|
|
72
|
-
Component:
|
|
73
|
-
SEOComponent:
|
|
74
|
-
BibliographyComponent:
|
|
68
|
+
Component: () => import('./component.astro'),
|
|
69
|
+
SEOComponent: () => import('./seo.astro'),
|
|
70
|
+
BibliographyComponent: () => import('./bibliography.astro'),
|
|
75
71
|
};
|