create-gitcms 0.1.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.
Files changed (86) hide show
  1. package/README.md +49 -0
  2. package/dist/args.d.ts +14 -0
  3. package/dist/args.d.ts.map +1 -0
  4. package/dist/args.js +119 -0
  5. package/dist/args.js.map +1 -0
  6. package/dist/cli.d.ts +4 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +529 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/core/content-detection.d.ts +2 -0
  11. package/dist/core/content-detection.d.ts.map +1 -0
  12. package/dist/core/content-detection.js +2 -0
  13. package/dist/core/content-detection.js.map +1 -0
  14. package/dist/core/filesystem.d.ts +11 -0
  15. package/dist/core/filesystem.d.ts.map +1 -0
  16. package/dist/core/filesystem.js +93 -0
  17. package/dist/core/filesystem.js.map +1 -0
  18. package/dist/core/framework-detection.d.ts +17 -0
  19. package/dist/core/framework-detection.d.ts.map +1 -0
  20. package/dist/core/framework-detection.js +60 -0
  21. package/dist/core/framework-detection.js.map +1 -0
  22. package/dist/core/frontmatter-inference.d.ts +2 -0
  23. package/dist/core/frontmatter-inference.d.ts.map +1 -0
  24. package/dist/core/frontmatter-inference.js +2 -0
  25. package/dist/core/frontmatter-inference.js.map +1 -0
  26. package/dist/core/git.d.ts +4 -0
  27. package/dist/core/git.d.ts.map +1 -0
  28. package/dist/core/git.js +45 -0
  29. package/dist/core/git.js.map +1 -0
  30. package/dist/core/gitcms-config.d.ts +153 -0
  31. package/dist/core/gitcms-config.d.ts.map +1 -0
  32. package/dist/core/gitcms-config.js +436 -0
  33. package/dist/core/gitcms-config.js.map +1 -0
  34. package/dist/core/mode-resolution.d.ts +22 -0
  35. package/dist/core/mode-resolution.d.ts.map +1 -0
  36. package/dist/core/mode-resolution.js +136 -0
  37. package/dist/core/mode-resolution.js.map +1 -0
  38. package/dist/core/paths.d.ts +6 -0
  39. package/dist/core/paths.d.ts.map +1 -0
  40. package/dist/core/paths.js +19 -0
  41. package/dist/core/paths.js.map +1 -0
  42. package/dist/core/planner.d.ts +8 -0
  43. package/dist/core/planner.d.ts.map +1 -0
  44. package/dist/core/planner.js +295 -0
  45. package/dist/core/planner.js.map +1 -0
  46. package/dist/core/site-roots.d.ts +5 -0
  47. package/dist/core/site-roots.d.ts.map +1 -0
  48. package/dist/core/site-roots.js +32 -0
  49. package/dist/core/site-roots.js.map +1 -0
  50. package/dist/core/sitemap-discovery.d.ts +2 -0
  51. package/dist/core/sitemap-discovery.d.ts.map +1 -0
  52. package/dist/core/sitemap-discovery.js +2 -0
  53. package/dist/core/sitemap-discovery.js.map +1 -0
  54. package/dist/core/vendor/content-detection.d.ts +51 -0
  55. package/dist/core/vendor/content-detection.d.ts.map +1 -0
  56. package/dist/core/vendor/content-detection.js +462 -0
  57. package/dist/core/vendor/content-detection.js.map +1 -0
  58. package/dist/core/vendor/frontmatter-inference.d.ts +5 -0
  59. package/dist/core/vendor/frontmatter-inference.d.ts.map +1 -0
  60. package/dist/core/vendor/frontmatter-inference.js +234 -0
  61. package/dist/core/vendor/frontmatter-inference.js.map +1 -0
  62. package/dist/core/vendor/paths.d.ts +3 -0
  63. package/dist/core/vendor/paths.d.ts.map +1 -0
  64. package/dist/core/vendor/paths.js +23 -0
  65. package/dist/core/vendor/paths.js.map +1 -0
  66. package/dist/core/vendor/sitemap.d.ts +10 -0
  67. package/dist/core/vendor/sitemap.d.ts.map +1 -0
  68. package/dist/core/vendor/sitemap.js +162 -0
  69. package/dist/core/vendor/sitemap.js.map +1 -0
  70. package/dist/core/writer.d.ts +4 -0
  71. package/dist/core/writer.d.ts.map +1 -0
  72. package/dist/core/writer.js +45 -0
  73. package/dist/core/writer.js.map +1 -0
  74. package/dist/index.d.ts +5 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +5 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/prompts.d.ts +12 -0
  79. package/dist/prompts.d.ts.map +1 -0
  80. package/dist/prompts.js +41 -0
  81. package/dist/prompts.js.map +1 -0
  82. package/dist/types.d.ts +74 -0
  83. package/dist/types.d.ts.map +1 -0
  84. package/dist/types.js +2 -0
  85. package/dist/types.js.map +1 -0
  86. package/package.json +54 -0
@@ -0,0 +1,93 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { toPosixPath } from './paths.js';
4
+ const WALK_IGNORED_DIRECTORIES = new Set([
5
+ '.git',
6
+ 'node_modules',
7
+ '.next',
8
+ '.nuxt',
9
+ '.astro',
10
+ '.svelte-kit',
11
+ '.turbo',
12
+ '.cache',
13
+ 'dist',
14
+ 'build',
15
+ 'out',
16
+ '.output',
17
+ ]);
18
+ export async function ensureDirectoryExists(directoryPath) {
19
+ const stat = await fs.stat(directoryPath);
20
+ if (!stat.isDirectory()) {
21
+ throw new Error(`Path is not a directory: ${directoryPath}`);
22
+ }
23
+ }
24
+ export async function isGitRepository(repoRoot) {
25
+ const gitDir = path.join(repoRoot, '.git');
26
+ try {
27
+ const stat = await fs.stat(gitDir);
28
+ return stat.isDirectory() || stat.isFile();
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ }
34
+ export async function pathExists(targetPath) {
35
+ try {
36
+ await fs.access(targetPath);
37
+ return true;
38
+ }
39
+ catch {
40
+ return false;
41
+ }
42
+ }
43
+ export async function walkRepositoryFiles(repoRoot) {
44
+ const files = [];
45
+ async function walk(relativeDir) {
46
+ const absoluteDir = relativeDir ? path.join(repoRoot, relativeDir) : repoRoot;
47
+ const entries = await fs.readdir(absoluteDir, { withFileTypes: true });
48
+ for (const entry of entries) {
49
+ const nextRelative = relativeDir
50
+ ? path.join(relativeDir, entry.name)
51
+ : entry.name;
52
+ if (entry.isDirectory()) {
53
+ if (WALK_IGNORED_DIRECTORIES.has(entry.name.toLowerCase())) {
54
+ continue;
55
+ }
56
+ await walk(nextRelative);
57
+ continue;
58
+ }
59
+ if (!entry.isFile()) {
60
+ continue;
61
+ }
62
+ files.push(toPosixPath(nextRelative));
63
+ }
64
+ }
65
+ await walk('');
66
+ return files.sort((a, b) => a.localeCompare(b));
67
+ }
68
+ export async function listImmediateChildren(directoryPath) {
69
+ const entries = await fs.readdir(directoryPath, { withFileTypes: true });
70
+ const fileNames = [];
71
+ const directoryNames = [];
72
+ for (const entry of entries) {
73
+ if (entry.isDirectory()) {
74
+ directoryNames.push(entry.name);
75
+ continue;
76
+ }
77
+ if (entry.isFile()) {
78
+ fileNames.push(entry.name);
79
+ }
80
+ }
81
+ return {
82
+ fileNames,
83
+ directoryNames,
84
+ };
85
+ }
86
+ export async function readFileUtf8(filePath) {
87
+ return fs.readFile(filePath, 'utf8');
88
+ }
89
+ export async function writeFileUtf8(filePath, content) {
90
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
91
+ await fs.writeFile(filePath, content, 'utf8');
92
+ }
93
+ //# sourceMappingURL=filesystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../src/core/filesystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACjC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IACvC,MAAM;IACN,cAAc;IACd,OAAO;IACP,OAAO;IACP,QAAQ;IACR,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,KAAK;IACL,SAAS;CACV,CAAC,CAAA;AAEF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,aAAqB;IAC/D,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IACzC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,4BAA4B,aAAa,EAAE,CAAC,CAAA;IAC9D,CAAC;AACH,CAAC;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C;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB,EAAE,OAAe;IACnE,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC3D,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAC/C,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare function detectFrameworkForSite(repoRoot: string, siteRoot: string): Promise<{
2
+ framework: null;
3
+ confidence: "low";
4
+ detectedBy: null;
5
+ suggestedMediaPath: null;
6
+ } | {
7
+ framework: NonNullable<"astro" | "nextjs" | "tanstack-start" | "gatsby" | "hugo" | "jekyll" | "eleventy" | "vuepress" | "docusaurus" | "nuxtjs" | "mkdocs" | "svelte" | "other" | null | undefined>;
8
+ confidence: "high";
9
+ detectedBy: string;
10
+ suggestedMediaPath: string;
11
+ } | {
12
+ framework: NonNullable<"astro" | "nextjs" | "tanstack-start" | "gatsby" | "hugo" | "jekyll" | "eleventy" | "vuepress" | "docusaurus" | "nuxtjs" | "mkdocs" | "svelte" | "other" | null | undefined>;
13
+ confidence: "medium";
14
+ detectedBy: string;
15
+ suggestedMediaPath: string;
16
+ }>;
17
+ //# sourceMappingURL=framework-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-detection.d.ts","sourceRoot":"","sources":["../../src/core/framework-detection.ts"],"names":[],"mappings":"AAKA,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;GA+D9E"}
@@ -0,0 +1,60 @@
1
+ import { SSG_CONFIGS } from './gitcms-config.js';
2
+ import { listImmediateChildren, pathExists } from './filesystem.js';
3
+ import { joinRepoRelative, normalizeSiteRoot } from './paths.js';
4
+ export async function detectFrameworkForSite(repoRoot, siteRoot) {
5
+ const cleanSiteRoot = normalizeSiteRoot(siteRoot);
6
+ const siteAbsolutePath = joinRepoRelative(repoRoot, cleanSiteRoot);
7
+ const rootExists = await pathExists(siteAbsolutePath);
8
+ if (!rootExists) {
9
+ return {
10
+ framework: null,
11
+ confidence: 'low',
12
+ detectedBy: null,
13
+ suggestedMediaPath: null,
14
+ };
15
+ }
16
+ const children = await listImmediateChildren(siteAbsolutePath);
17
+ const rootFiles = new Set(children.fileNames);
18
+ const rootDirectories = new Set(children.directoryNames);
19
+ for (const config of SSG_CONFIGS) {
20
+ for (const configFile of config.rootConfigFiles) {
21
+ if (rootFiles.has(configFile)) {
22
+ return {
23
+ framework: config.framework,
24
+ confidence: 'high',
25
+ detectedBy: configFile,
26
+ suggestedMediaPath: config.mediaPath,
27
+ };
28
+ }
29
+ }
30
+ for (const nestedPath of config.nestedConfigFiles) {
31
+ const firstSegment = nestedPath.split('/')[0];
32
+ if (firstSegment && rootDirectories.has(firstSegment)) {
33
+ return {
34
+ framework: config.framework,
35
+ confidence: 'medium',
36
+ detectedBy: `${firstSegment}/`,
37
+ suggestedMediaPath: config.mediaPath,
38
+ };
39
+ }
40
+ }
41
+ }
42
+ // Special case for TanStack Start in this codebase pattern.
43
+ // It is part of Config schema but currently not in SSG_CONFIGS.
44
+ if (rootFiles.has('vite.config.ts')
45
+ && (rootFiles.has('app.config.ts') || rootDirectories.has('src'))) {
46
+ return {
47
+ framework: 'tanstack-start',
48
+ confidence: 'medium',
49
+ detectedBy: 'vite.config.ts',
50
+ suggestedMediaPath: 'public',
51
+ };
52
+ }
53
+ return {
54
+ framework: null,
55
+ confidence: 'low',
56
+ detectedBy: null,
57
+ suggestedMediaPath: null,
58
+ };
59
+ }
60
+ //# sourceMappingURL=framework-detection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-detection.js","sourceRoot":"","sources":["../../src/core/framework-detection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,qBA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C,CAAA;YAC7C,IAAI,YAAY,IAAI,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;gBACtD,OAAO;oBACL,SAAS,EAAE,MAAM,CAAC,SAAS;oBAC3B,UAAU,EAAE,QAAQ;oBACpB,UAAU,EAAE,GAAG,YAAY,GAAG;oBAC9B,kBAAkB,EAAE,MAAM,CAAC,SAAS;iBACR,CAAA;YAChC,CAAC;QACH,CAAC;IACH,CAAC;IAED,4DAA4D;IAC5D,gEAAgE;IAChE,IACE,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC;WAC5B,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EACjE,CAAC;QACD,OAAO;YACL,SAAS,EAAE,gBAAgB;YAC3B,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,gBAAgB;YAC5B,kBAAkB,EAAE,QAAQ;SACA,CAAA;IAChC,CAAC;IAED,OAAO;QACL,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,IAAI;QAChB,kBAAkB,EAAE,IAAI;KACI,CAAA;AAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { humanizeFieldName, inferFieldType, inferSchemaFromFrontmatter, type InferredFieldType, } from './vendor/frontmatter-inference.js';
2
+ //# sourceMappingURL=frontmatter-inference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter-inference.d.ts","sourceRoot":"","sources":["../../src/core/frontmatter-inference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,0BAA0B,EAC1B,KAAK,iBAAiB,GACvB,MAAM,mCAAmC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { humanizeFieldName, inferFieldType, inferSchemaFromFrontmatter, } from './vendor/frontmatter-inference.js';
2
+ //# sourceMappingURL=frontmatter-inference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter-inference.js","sourceRoot":"","sources":["../../src/core/frontmatter-inference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,0BAA0B,GAE3B,MAAM,mCAAmC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export declare function getCurrentBranch(repoRoot: string): Promise<string | null>;
2
+ export declare function getRemoteDefaultBranch(repoRoot: string): Promise<string | null>;
3
+ export declare function resolveSuggestedDefaultBranch(repoRoot: string): Promise<string | null>;
4
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/core/git.ts"],"names":[],"mappings":"AAaA,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,0BAQtD;AAED,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,0BAgB5D;AAED,wBAAsB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,0BAQnE"}
@@ -0,0 +1,45 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ const execFileAsync = promisify(execFile);
4
+ async function runGitCommand(args, cwd) {
5
+ const result = await execFileAsync('git', args, {
6
+ cwd,
7
+ encoding: 'utf8',
8
+ });
9
+ return result.stdout.trim();
10
+ }
11
+ export async function getCurrentBranch(repoRoot) {
12
+ try {
13
+ const branch = await runGitCommand(['rev-parse', '--abbrev-ref', 'HEAD'], repoRoot);
14
+ if (!branch || branch === 'HEAD')
15
+ return null;
16
+ return branch;
17
+ }
18
+ catch {
19
+ return null;
20
+ }
21
+ }
22
+ export async function getRemoteDefaultBranch(repoRoot) {
23
+ try {
24
+ const symbolic = await runGitCommand(['symbolic-ref', '--short', 'refs/remotes/origin/HEAD'], repoRoot);
25
+ if (!symbolic)
26
+ return null;
27
+ const slashIndex = symbolic.indexOf('/');
28
+ if (slashIndex === -1)
29
+ return symbolic;
30
+ return symbolic.slice(slashIndex + 1);
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ export async function resolveSuggestedDefaultBranch(repoRoot) {
37
+ const remoteBranch = await getRemoteDefaultBranch(repoRoot);
38
+ if (remoteBranch)
39
+ return remoteBranch;
40
+ const currentBranch = await getCurrentBranch(repoRoot);
41
+ if (currentBranch)
42
+ return currentBranch;
43
+ return null;
44
+ }
45
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/core/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAEzC,KAAK,UAAU,aAAa,CAAC,IAAmB,EAAE,GAAW;IAC3D,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE;QAC9C,GAAG;QACH,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;AAC7B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,QAAgB;IACrD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAA;QACnF,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,IAAI,CAAA;QAC7C,OAAO,MAAM,CAAA;IACf,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,QAAgB;IAC3D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,aAAa,CAClC,CAAC,cAAc,EAAE,SAAS,EAAE,0BAA0B,CAAC,EACvD,QAAQ,CACT,CAAA;QAED,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAA;QAE1B,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACxC,IAAI,UAAU,KAAK,CAAC,CAAC;YAAE,OAAO,QAAQ,CAAA;QAEtC,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,QAAgB;IAClE,MAAM,YAAY,GAAG,MAAM,sBAAsB,CAAC,QAAQ,CAAC,CAAA;IAC3D,IAAI,YAAY;QAAE,OAAO,YAAY,CAAA;IAErC,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACtD,IAAI,aAAa;QAAE,OAAO,aAAa,CAAA;IAEvC,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,153 @@
1
+ import { z } from 'zod';
2
+ export declare const FilenamePatternTokenSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ type: z.ZodLiteral<"text">;
4
+ value: z.ZodString;
5
+ }, z.core.$strip>, z.ZodObject<{
6
+ type: z.ZodLiteral<"field">;
7
+ field: z.ZodString;
8
+ formatter: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>], "type">;
10
+ export type FilenamePatternToken = z.infer<typeof FilenamePatternTokenSchema>;
11
+ export declare const CollectionTypeSchema: z.ZodEnum<{
12
+ flat: "flat";
13
+ grouped: "grouped";
14
+ }>;
15
+ export declare const SiteI18nSchema: z.ZodObject<{
16
+ enabled: z.ZodOptional<z.ZodBoolean>;
17
+ locales: z.ZodArray<z.ZodString>;
18
+ default_locale: z.ZodString;
19
+ prefix_default_locale: z.ZodOptional<z.ZodBoolean>;
20
+ }, z.core.$strip>;
21
+ export declare const CollectionI18nSchema: z.ZodObject<{
22
+ enabled: z.ZodOptional<z.ZodBoolean>;
23
+ strategy: z.ZodOptional<z.ZodEnum<{
24
+ path: "path";
25
+ }>>;
26
+ locale_paths: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
27
+ translation_key_field: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ export declare const CollectionSchema: z.ZodObject<{
30
+ file_extension: z.ZodEnum<{
31
+ ".md": ".md";
32
+ ".mdx": ".mdx";
33
+ }>;
34
+ filename_pattern: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
35
+ type: z.ZodLiteral<"text">;
36
+ value: z.ZodString;
37
+ }, z.core.$strip>, z.ZodObject<{
38
+ type: z.ZodLiteral<"field">;
39
+ field: z.ZodString;
40
+ formatter: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>], "type">>;
42
+ git_path: z.ZodString;
43
+ collection_type: z.ZodOptional<z.ZodEnum<{
44
+ flat: "flat";
45
+ grouped: "grouped";
46
+ }>>;
47
+ frontmatter_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
48
+ metadata_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodAny>>>;
49
+ name: z.ZodString;
50
+ label: z.ZodOptional<z.ZodString>;
51
+ description: z.ZodOptional<z.ZodString>;
52
+ i18n: z.ZodOptional<z.ZodObject<{
53
+ enabled: z.ZodOptional<z.ZodBoolean>;
54
+ strategy: z.ZodOptional<z.ZodEnum<{
55
+ path: "path";
56
+ }>>;
57
+ locale_paths: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
58
+ translation_key_field: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strip>>;
60
+ }, z.core.$strip>;
61
+ export type Collection = z.infer<typeof CollectionSchema>;
62
+ export declare const FrontmatterFormatSchema: z.ZodEnum<{
63
+ yaml: "yaml";
64
+ toml: "toml";
65
+ json: "json";
66
+ }>;
67
+ export type FrontmatterFormat = z.infer<typeof FrontmatterFormatSchema>;
68
+ export declare const PublishingModeSchema: z.ZodEnum<{
69
+ direct_publish: "direct_publish";
70
+ editorial_workflow: "editorial_workflow";
71
+ }>;
72
+ export type PublishingMode = z.infer<typeof PublishingModeSchema>;
73
+ export declare const ConfigSchema: z.ZodObject<{
74
+ version: z.ZodOptional<z.ZodString>;
75
+ collections: z.ZodArray<z.ZodObject<{
76
+ file_extension: z.ZodEnum<{
77
+ ".md": ".md";
78
+ ".mdx": ".mdx";
79
+ }>;
80
+ filename_pattern: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
81
+ type: z.ZodLiteral<"text">;
82
+ value: z.ZodString;
83
+ }, z.core.$strip>, z.ZodObject<{
84
+ type: z.ZodLiteral<"field">;
85
+ field: z.ZodString;
86
+ formatter: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strip>], "type">>;
88
+ git_path: z.ZodString;
89
+ collection_type: z.ZodOptional<z.ZodEnum<{
90
+ flat: "flat";
91
+ grouped: "grouped";
92
+ }>>;
93
+ frontmatter_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
94
+ metadata_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodAny>>>;
95
+ name: z.ZodString;
96
+ label: z.ZodOptional<z.ZodString>;
97
+ description: z.ZodOptional<z.ZodString>;
98
+ i18n: z.ZodOptional<z.ZodObject<{
99
+ enabled: z.ZodOptional<z.ZodBoolean>;
100
+ strategy: z.ZodOptional<z.ZodEnum<{
101
+ path: "path";
102
+ }>>;
103
+ locale_paths: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
104
+ translation_key_field: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>>;
106
+ }, z.core.$strip>>;
107
+ media_path: z.ZodString;
108
+ website_url: z.ZodString;
109
+ ssg_framework: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
110
+ astro: "astro";
111
+ nextjs: "nextjs";
112
+ "tanstack-start": "tanstack-start";
113
+ gatsby: "gatsby";
114
+ hugo: "hugo";
115
+ jekyll: "jekyll";
116
+ eleventy: "eleventy";
117
+ vuepress: "vuepress";
118
+ docusaurus: "docusaurus";
119
+ nuxtjs: "nuxtjs";
120
+ mkdocs: "mkdocs";
121
+ svelte: "svelte";
122
+ other: "other";
123
+ }>>>;
124
+ default_branch: z.ZodOptional<z.ZodString>;
125
+ frontmatter_format: z.ZodOptional<z.ZodEnum<{
126
+ yaml: "yaml";
127
+ toml: "toml";
128
+ json: "json";
129
+ }>>;
130
+ publishing_mode: z.ZodOptional<z.ZodEnum<{
131
+ direct_publish: "direct_publish";
132
+ editorial_workflow: "editorial_workflow";
133
+ }>>;
134
+ sitemap_url: z.ZodOptional<z.ZodString>;
135
+ i18n: z.ZodOptional<z.ZodObject<{
136
+ enabled: z.ZodOptional<z.ZodBoolean>;
137
+ locales: z.ZodArray<z.ZodString>;
138
+ default_locale: z.ZodString;
139
+ prefix_default_locale: z.ZodOptional<z.ZodBoolean>;
140
+ }, z.core.$strip>>;
141
+ }, z.core.$strip>;
142
+ export type Config = z.infer<typeof ConfigSchema>;
143
+ export type SSGFramework = Config['ssg_framework'];
144
+ export interface SSGConfig {
145
+ framework: NonNullable<SSGFramework>;
146
+ rootConfigFiles: Array<string>;
147
+ nestedConfigFiles: Array<string>;
148
+ contentPaths: Array<string>;
149
+ mediaPath: string;
150
+ }
151
+ export declare const SSG_CONFIGS: Array<SSGConfig>;
152
+ export declare function serializeConfigToGitcmsMd(config: Config): string;
153
+ //# sourceMappingURL=gitcms-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitcms-config.d.ts","sourceRoot":"","sources":["../../src/core/gitcms-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwBvB,eAAO,MAAM,0BAA0B;;;;;;;2BAGrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;A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