@better-t-stack/template-generator 3.14.0 → 3.14.2
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/dist/core/template-reader.d.mts +2 -1
- package/dist/core/template-reader.d.mts.map +1 -1
- package/dist/core/template-reader.mjs +3 -2832
- package/dist/fs-writer.d.mts +1 -1
- package/dist/fs-writer.d.mts.map +1 -1
- package/dist/fs-writer.mjs +19 -5
- package/dist/fs-writer.mjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +20187 -20195
- package/dist/index.mjs.map +1 -1
- package/dist/is-binary-path-BN88l03c.mjs +282 -0
- package/dist/is-binary-path-BN88l03c.mjs.map +1 -0
- package/dist/template-reader-DOXCnctl.mjs +2564 -0
- package/dist/template-reader-DOXCnctl.mjs.map +1 -0
- package/dist/{types-BubFnV2d.d.mts → types-CSDwmt8U.d.mts} +2 -1
- package/dist/types-CSDwmt8U.d.mts.map +1 -0
- package/package.json +4 -3
- package/templates-binary/addons/pwa/apps/web/next/public/favicon/apple-touch-icon.png +0 -0
- package/templates-binary/addons/pwa/apps/web/next/public/favicon/favicon-96x96.png +0 -0
- package/templates-binary/addons/pwa/apps/web/next/public/favicon/web-app-manifest-192x192.png +0 -0
- package/templates-binary/addons/pwa/apps/web/next/public/favicon/web-app-manifest-512x512.png +0 -0
- package/templates-binary/addons/pwa/apps/web/vite/public/logo.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/android-icon-background.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/android-icon-foreground.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/android-icon-monochrome.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/favicon.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/icon.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/partial-react-logo.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/react-logo.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/react-logo@2x.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/react-logo@3x.png +0 -0
- package/templates-binary/frontend/native/base/assets/images/splash-icon.png +0 -0
- package/templates-binary/frontend/nuxt/public/favicon.ico +0 -0
- package/templates-binary/frontend/react/next/src/app/favicon.ico +0 -0
- package/templates-binary/frontend/react/react-router/public/favicon.ico +0 -0
- package/templates-binary/frontend/svelte/static/favicon.png +0 -0
- package/dist/core/template-reader.mjs.map +0 -1
- package/dist/types-BubFnV2d.d.mts.map +0 -1
package/dist/fs-writer.d.mts
CHANGED
package/dist/fs-writer.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-writer.d.mts","names":[],"sources":["../src/fs-writer.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"fs-writer.d.mts","names":[],"sources":["../src/fs-writer.ts"],"sourcesContent":[],"mappings":";;;iBASsB,qBAAA,OAA4B,mCAAmC;iBA2B/D,kBAAA,OACd,0EAGL"}
|
package/dist/fs-writer.mjs
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
+
import { t as getBinaryTemplatesRoot } from "./template-reader-DOXCnctl.mjs";
|
|
1
2
|
import { dirname, join } from "pathe";
|
|
2
3
|
import * as fs from "node:fs/promises";
|
|
3
4
|
|
|
4
5
|
//#region src/fs-writer.ts
|
|
6
|
+
const BINARY_FILE_MARKER = "[Binary file]";
|
|
5
7
|
async function writeTreeToFilesystem(tree, destDir) {
|
|
6
8
|
for (const child of tree.root.children) await writeNode(child, destDir, "");
|
|
7
9
|
}
|
|
8
10
|
async function writeNode(node, baseDir, relativePath) {
|
|
9
11
|
const fullPath = join(baseDir, relativePath, node.name);
|
|
12
|
+
const nodePath = relativePath ? join(relativePath, node.name) : node.name;
|
|
10
13
|
if (node.type === "file") {
|
|
11
|
-
|
|
14
|
+
const fileNode = node;
|
|
12
15
|
await fs.mkdir(dirname(fullPath), { recursive: true });
|
|
13
|
-
|
|
16
|
+
if (fileNode.content === BINARY_FILE_MARKER && fileNode.sourcePath) await copyBinaryFile(fileNode.sourcePath, fullPath);
|
|
17
|
+
else if (fileNode.content !== BINARY_FILE_MARKER) await fs.writeFile(fullPath, fileNode.content, "utf-8");
|
|
14
18
|
} else {
|
|
15
19
|
await fs.mkdir(fullPath, { recursive: true });
|
|
16
|
-
for (const child of node.children) await writeNode(child, baseDir,
|
|
20
|
+
for (const child of node.children) await writeNode(child, baseDir, nodePath);
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
async function writeSelectedFiles(tree, destDir, filter) {
|
|
@@ -24,13 +28,23 @@ async function writeSelectedFiles(tree, destDir, filter) {
|
|
|
24
28
|
async function writeSelectedNode(node, baseDir, relativePath, filter, writtenFiles) {
|
|
25
29
|
const nodePath = relativePath ? `${relativePath}/${node.name}` : node.name;
|
|
26
30
|
if (node.type === "file") {
|
|
27
|
-
if (filter(nodePath)
|
|
31
|
+
if (filter(nodePath)) {
|
|
32
|
+
const fileNode = node;
|
|
28
33
|
await fs.mkdir(dirname(join(baseDir, nodePath)), { recursive: true });
|
|
29
|
-
await
|
|
34
|
+
if (fileNode.content === BINARY_FILE_MARKER && fileNode.sourcePath) await copyBinaryFile(fileNode.sourcePath, join(baseDir, nodePath));
|
|
35
|
+
else if (fileNode.content !== BINARY_FILE_MARKER) await fs.writeFile(join(baseDir, nodePath), fileNode.content, "utf-8");
|
|
30
36
|
writtenFiles.push(nodePath);
|
|
31
37
|
}
|
|
32
38
|
} else for (const child of node.children) await writeSelectedNode(child, baseDir, nodePath, filter, writtenFiles);
|
|
33
39
|
}
|
|
40
|
+
async function copyBinaryFile(templatePath, destPath) {
|
|
41
|
+
const sourcePath = join(getBinaryTemplatesRoot(), templatePath);
|
|
42
|
+
try {
|
|
43
|
+
await fs.copyFile(sourcePath, destPath);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.warn(`Failed to copy binary file: ${templatePath}`, error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
34
48
|
|
|
35
49
|
//#endregion
|
|
36
50
|
export { writeSelectedFiles, writeTreeToFilesystem };
|
package/dist/fs-writer.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-writer.mjs","names":["writtenFiles: string[]"],"sources":["../src/fs-writer.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport { join, dirname } from \"pathe\";\n\nimport type { VirtualFileTree, VirtualNode, VirtualFile, VirtualDirectory } from \"./types\";\n\nexport async function writeTreeToFilesystem(tree: VirtualFileTree, destDir: string): Promise<void> {\n for (const child of tree.root.children) {\n await writeNode(child, destDir, \"\");\n }\n}\n\nasync function writeNode(node: VirtualNode, baseDir: string, relativePath: string): Promise<void> {\n const fullPath = join(baseDir, relativePath, node.name);\n\n if (node.type === \"file\") {\n
|
|
1
|
+
{"version":3,"file":"fs-writer.mjs","names":["writtenFiles: string[]"],"sources":["../src/fs-writer.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport { join, dirname } from \"pathe\";\n\nimport type { VirtualFileTree, VirtualNode, VirtualFile, VirtualDirectory } from \"./types\";\n\nimport { getBinaryTemplatesRoot } from \"./core/template-reader\";\n\nconst BINARY_FILE_MARKER = \"[Binary file]\";\n\nexport async function writeTreeToFilesystem(tree: VirtualFileTree, destDir: string): Promise<void> {\n for (const child of tree.root.children) {\n await writeNode(child, destDir, \"\");\n }\n}\n\nasync function writeNode(node: VirtualNode, baseDir: string, relativePath: string): Promise<void> {\n const fullPath = join(baseDir, relativePath, node.name);\n const nodePath = relativePath ? join(relativePath, node.name) : node.name;\n\n if (node.type === \"file\") {\n const fileNode = node as VirtualFile;\n await fs.mkdir(dirname(fullPath), { recursive: true });\n\n if (fileNode.content === BINARY_FILE_MARKER && fileNode.sourcePath) {\n await copyBinaryFile(fileNode.sourcePath, fullPath);\n } else if (fileNode.content !== BINARY_FILE_MARKER) {\n await fs.writeFile(fullPath, fileNode.content, \"utf-8\");\n }\n } else {\n await fs.mkdir(fullPath, { recursive: true });\n for (const child of (node as VirtualDirectory).children) {\n await writeNode(child, baseDir, nodePath);\n }\n }\n}\n\nexport async function writeSelectedFiles(\n tree: VirtualFileTree,\n destDir: string,\n filter: (filePath: string) => boolean,\n): Promise<string[]> {\n const writtenFiles: string[] = [];\n await writeSelectedNode(tree.root, destDir, \"\", filter, writtenFiles);\n return writtenFiles;\n}\n\nasync function writeSelectedNode(\n node: VirtualNode,\n baseDir: string,\n relativePath: string,\n filter: (filePath: string) => boolean,\n writtenFiles: string[],\n): Promise<void> {\n const nodePath = relativePath ? `${relativePath}/${node.name}` : node.name;\n\n if (node.type === \"file\") {\n if (filter(nodePath)) {\n const fileNode = node as VirtualFile;\n await fs.mkdir(dirname(join(baseDir, nodePath)), { recursive: true });\n\n if (fileNode.content === BINARY_FILE_MARKER && fileNode.sourcePath) {\n await copyBinaryFile(fileNode.sourcePath, join(baseDir, nodePath));\n } else if (fileNode.content !== BINARY_FILE_MARKER) {\n await fs.writeFile(join(baseDir, nodePath), fileNode.content, \"utf-8\");\n }\n writtenFiles.push(nodePath);\n }\n } else {\n for (const child of (node as VirtualDirectory).children) {\n await writeSelectedNode(child, baseDir, nodePath, filter, writtenFiles);\n }\n }\n}\n\nasync function copyBinaryFile(templatePath: string, destPath: string): Promise<void> {\n const templatesRoot = getBinaryTemplatesRoot();\n const sourcePath = join(templatesRoot, templatePath);\n\n try {\n await fs.copyFile(sourcePath, destPath);\n } catch (error) {\n console.warn(`Failed to copy binary file: ${templatePath}`, error);\n }\n}\n"],"mappings":";;;;;AAOA,MAAM,qBAAqB;AAE3B,eAAsB,sBAAsB,MAAuB,SAAgC;AACjG,MAAK,MAAM,SAAS,KAAK,KAAK,SAC5B,OAAM,UAAU,OAAO,SAAS,GAAG;;AAIvC,eAAe,UAAU,MAAmB,SAAiB,cAAqC;CAChG,MAAM,WAAW,KAAK,SAAS,cAAc,KAAK,KAAK;CACvD,MAAM,WAAW,eAAe,KAAK,cAAc,KAAK,KAA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AO;AACd,UAAQ,KAAK,+BAA+B,gBAAgB,MAAM"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as VirtualFileTree, i as VirtualFile, n as GeneratorResult, o as VirtualNode, r as VirtualDirectory, t as GeneratorOptions } from "./types-
|
|
1
|
+
import { a as VirtualFileTree, i as VirtualFile, n as GeneratorResult, o as VirtualNode, r as VirtualDirectory, t as GeneratorOptions } from "./types-CSDwmt8U.mjs";
|
|
2
2
|
import * as memfs0 from "memfs";
|
|
3
3
|
import Handlebars from "handlebars";
|
|
4
4
|
import { ProjectConfig } from "@better-t-stack/types";
|
|
@@ -7,8 +7,9 @@ import { ProjectConfig } from "@better-t-stack/types";
|
|
|
7
7
|
declare class VirtualFileSystem {
|
|
8
8
|
private _fs;
|
|
9
9
|
private _vol;
|
|
10
|
+
private _sourcePathMap;
|
|
10
11
|
constructor();
|
|
11
|
-
writeFile(filePath: string, content: string): void;
|
|
12
|
+
writeFile(filePath: string, content: string, sourcePath?: string): void;
|
|
12
13
|
readFile(filePath: string): string | undefined;
|
|
13
14
|
exists(path: string): boolean;
|
|
14
15
|
fileExists(filePath: string): boolean;
|
|
@@ -46,7 +47,7 @@ declare function generateVirtualProject(options: GeneratorOptions): Promise<Gene
|
|
|
46
47
|
//#endregion
|
|
47
48
|
//#region src/templates.generated.d.ts
|
|
48
49
|
declare const EMBEDDED_TEMPLATES: Map<string, string>;
|
|
49
|
-
declare const TEMPLATE_COUNT =
|
|
50
|
+
declare const TEMPLATE_COUNT = 408;
|
|
50
51
|
//#endregion
|
|
51
52
|
//#region src/utils/add-deps.d.ts
|
|
52
53
|
declare const dependencyVersionMap: {
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/virtual-fs.ts","../src/core/template-processor.ts","../src/template-handlers/utils.ts","../src/generator.ts","../src/templates.generated.ts","../src/utils/add-deps.ts"],"sourcesContent":[],"mappings":";;;;;;cAOa,iBAAA;;;;;EAAA,QAAA,CAAA,QAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/virtual-fs.ts","../src/core/template-processor.ts","../src/template-handlers/utils.ts","../src/generator.ts","../src/templates.generated.ts","../src/utils/add-deps.ts"],"sourcesContent":[],"mappings":";;;;;;cAOa,iBAAA;;;;;EAAA,SAAA,CAAA,QAAA,EAAiB,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EA6Ea,QAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAkCX,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAgB,UAcrC,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAA,eAGJ,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAA,KAAA,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;2CAnDoC;ECzE3B,SAAA,CAAA,QAAA,EAAA,MAAqB,EAAA,IAAA,EAAA,OAA2B,EAAA,MAAa,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAI7D,WAAA,CAAA,CAAA,EAAY,MAAA,EAAA;EAIZ,iBAAA,CAAA,CAAA,EAAiB,MAAA,EAAA;EAUjB,YAAA,CAAA,CAAA,EAAA,MAAkB;;6BDyFF;;EEhHpB,SAAA,CAAA,CAAA,EFgHoC,MAAA,CAcrC,ME9HmB;WF8HnB,MAAA,CAGJ;;;EGxGe,QAAA,YAAA;EAAgC,QAAA,aAAA;;;;iBFpBtC,qBAAA,2BAAgD;iBAIhD,YAAA;iBAIA,iBAAA;iBAUA,kBAAA,6CAGL;;;KC1BC,YAAA,GAAe;;;iBCyBL,sBAAA,UAAgC,mBAAmB,QAAQ;;;cC5BpE,oBAAoB;cAk3vBpB,cAAA;;;cCx2vBA;;ELNA,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