kofi-stack-template-generator 2.0.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/.turbo/turbo-build.log +20 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.js +744 -0
- package/package.json +29 -0
- package/scripts/generate-templates.js +104 -0
- package/src/core/index.ts +7 -0
- package/src/core/template-processor.ts +127 -0
- package/src/core/virtual-fs.ts +189 -0
- package/src/generator.ts +429 -0
- package/src/index.ts +19 -0
- package/src/templates.generated.ts +39 -0
- package/templates/base/_gitignore.hbs +45 -0
- package/templates/base/biome.json.hbs +34 -0
- package/templates/convex/_env.local.hbs +52 -0
- package/templates/convex/convex/auth.ts.hbs +7 -0
- package/templates/convex/convex/http.ts.hbs +8 -0
- package/templates/convex/convex/schema.ts.hbs +15 -0
- package/templates/convex/convex/users.ts.hbs +13 -0
- package/templates/integrations/posthog/src/components/providers/posthog-provider.tsx.hbs +17 -0
- package/templates/monorepo/package.json.hbs +29 -0
- package/templates/monorepo/pnpm-workspace.yaml.hbs +3 -0
- package/templates/monorepo/turbo.json.hbs +42 -0
- package/templates/packages/config-biome/biome.json.hbs +4 -0
- package/templates/packages/config-biome/package.json.hbs +6 -0
- package/templates/packages/config-typescript/base.json.hbs +17 -0
- package/templates/packages/config-typescript/nextjs.json.hbs +7 -0
- package/templates/packages/config-typescript/package.json.hbs +10 -0
- package/templates/packages/ui/components.json.hbs +20 -0
- package/templates/packages/ui/package.json.hbs +34 -0
- package/templates/packages/ui/src/index.ts.hbs +3 -0
- package/templates/packages/ui/src/lib/utils.ts.hbs +6 -0
- package/templates/packages/ui/tsconfig.json.hbs +22 -0
- package/templates/web/components.json.hbs +20 -0
- package/templates/web/next.config.ts.hbs +9 -0
- package/templates/web/package.json.hbs +62 -0
- package/templates/web/postcss.config.mjs.hbs +5 -0
- package/templates/web/src/app/globals.css.hbs +122 -0
- package/templates/web/src/app/layout.tsx.hbs +55 -0
- package/templates/web/src/app/page.tsx.hbs +74 -0
- package/templates/web/src/components/providers/convex-provider.tsx.hbs +18 -0
- package/templates/web/src/lib/auth.ts.hbs +23 -0
- package/templates/web/src/lib/utils.ts.hbs +6 -0
- package/templates/web/tsconfig.json.hbs +23 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
> kofi-stack-template-generator@2.0.0 build /Users/theodenanyoh/Documents/Krumalabs/create-kofi-stack-v2/packages/template-generator
|
|
3
|
+
> pnpm run prebuild && tsup src/index.ts --format esm --dts
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> kofi-stack-template-generator@2.0.0 prebuild /Users/theodenanyoh/Documents/Krumalabs/create-kofi-stack-v2/packages/template-generator
|
|
7
|
+
> node scripts/generate-templates.js
|
|
8
|
+
|
|
9
|
+
Generating templates.generated.ts...
|
|
10
|
+
Generated templates.generated.ts with 32 templates
|
|
11
|
+
CLI Building entry: src/index.ts
|
|
12
|
+
CLI Using tsconfig: tsconfig.json
|
|
13
|
+
CLI tsup v8.5.1
|
|
14
|
+
CLI Target: es2022
|
|
15
|
+
ESM Build start
|
|
16
|
+
DTS Build start
|
|
17
|
+
ESM dist/index.js 38.86 KB
|
|
18
|
+
ESM ⚡️ Build success in 277ms
|
|
19
|
+
DTS ⚡️ Build success in 472ms
|
|
20
|
+
DTS dist/index.d.ts 2.96 KB
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ProjectConfig, VirtualFileTree, GeneratorResult } from 'kofi-stack-types';
|
|
2
|
+
export { GeneratorResult, ProjectConfig, VirtualDirectory, VirtualFile, VirtualFileTree } from 'kofi-stack-types';
|
|
3
|
+
import { createFsFromVolume } from 'memfs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Virtual filesystem using memfs for in-memory file operations.
|
|
7
|
+
* This allows us to generate the entire project tree without disk I/O,
|
|
8
|
+
* enabling browser compatibility and faster generation.
|
|
9
|
+
*/
|
|
10
|
+
declare class VirtualFileSystem {
|
|
11
|
+
private volume;
|
|
12
|
+
private fs;
|
|
13
|
+
private binarySourcePaths;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Write a file to the virtual filesystem
|
|
17
|
+
*/
|
|
18
|
+
writeFile(filePath: string, content: string | Buffer): void;
|
|
19
|
+
/**
|
|
20
|
+
* Read a file from the virtual filesystem
|
|
21
|
+
*/
|
|
22
|
+
readFile(filePath: string): string | Buffer;
|
|
23
|
+
/**
|
|
24
|
+
* Check if a path exists
|
|
25
|
+
*/
|
|
26
|
+
exists(filePath: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if path is a file
|
|
29
|
+
*/
|
|
30
|
+
fileExists(filePath: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if path is a directory
|
|
33
|
+
*/
|
|
34
|
+
directoryExists(filePath: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Create directory recursively
|
|
37
|
+
*/
|
|
38
|
+
mkdir(dirPath: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Delete a file
|
|
41
|
+
*/
|
|
42
|
+
deleteFile(filePath: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* List directory contents
|
|
45
|
+
*/
|
|
46
|
+
listDir(dirPath: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Track source path for binary files (for later copying)
|
|
49
|
+
*/
|
|
50
|
+
setBinarySourcePath(virtualPath: string, sourcePath: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Get source path for binary file
|
|
53
|
+
*/
|
|
54
|
+
getBinarySourcePath(virtualPath: string): string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Convert the virtual filesystem to a tree structure
|
|
57
|
+
*/
|
|
58
|
+
toTree(config: ProjectConfig): VirtualFileTree;
|
|
59
|
+
private buildTree;
|
|
60
|
+
private countNodes;
|
|
61
|
+
/**
|
|
62
|
+
* Get the raw memfs instance for advanced operations
|
|
63
|
+
*/
|
|
64
|
+
getRawFs(): ReturnType<typeof createFsFromVolume>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Generate a virtual project based on the provided configuration.
|
|
69
|
+
* Returns a VirtualFileTree that can be written to disk.
|
|
70
|
+
*/
|
|
71
|
+
declare function generateVirtualProject(config: ProjectConfig): Promise<GeneratorResult>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Check if a file is binary based on extension
|
|
75
|
+
*/
|
|
76
|
+
declare function isBinaryFile(filename: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Process a Handlebars template string with the given config context
|
|
79
|
+
*/
|
|
80
|
+
declare function processTemplateString(template: string, config: ProjectConfig): string;
|
|
81
|
+
/**
|
|
82
|
+
* Transform a template filename to the final output filename
|
|
83
|
+
* - Remove .hbs extension
|
|
84
|
+
* - Convert _gitignore to .gitignore
|
|
85
|
+
* - Process filename through Handlebars if it contains {{ }}
|
|
86
|
+
*/
|
|
87
|
+
declare function transformFilename(filename: string, config: ProjectConfig): string;
|
|
88
|
+
/**
|
|
89
|
+
* Check if a template file should be processed
|
|
90
|
+
* Some files are conditionally included based on config
|
|
91
|
+
*/
|
|
92
|
+
declare function shouldIncludeFile(templatePath: string, config: ProjectConfig): boolean;
|
|
93
|
+
|
|
94
|
+
export { VirtualFileSystem, generateVirtualProject, isBinaryFile, processTemplateString, shouldIncludeFile, transformFilename };
|