@shivaedev/create-app 0.23.0 → 0.25.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/CHANGELOG.md +66 -0
- package/README.md +12 -0
- package/dist/CreateAppError.d.ts +3 -2
- package/dist/CreateAppError.d.ts.map +1 -1
- package/dist/CreateAppError.js +5 -2
- package/dist/CreateAppError.js.map +1 -1
- package/dist/appFiles.d.ts.map +1 -1
- package/dist/appFiles.js +2 -3
- package/dist/appFiles.js.map +1 -1
- package/dist/cli.js +96 -89
- package/dist/generation.d.ts +1 -1
- package/dist/generation.d.ts.map +1 -1
- package/dist/generation.js +4 -5
- package/dist/generation.js.map +1 -1
- package/dist/initializeGit.d.ts +1 -1
- package/dist/initializeGit.d.ts.map +1 -1
- package/dist/initializeGit.js +10 -5
- package/dist/initializeGit.js.map +1 -1
- package/dist/pack.js +3 -1
- package/dist/pack.js.map +1 -1
- package/dist/packTemplate.d.ts.map +1 -1
- package/dist/packTemplate.js +11 -3
- package/dist/packTemplate.js.map +1 -1
- package/dist/template.d.ts +37 -1
- package/dist/template.d.ts.map +1 -1
- package/dist/template.js +15 -8
- package/dist/template.js.map +1 -1
- package/package.json +21 -22
- package/src/CreateAppError.ts +5 -2
- package/src/appFiles.ts +2 -4
- package/src/cli.ts +6 -3
- package/src/generation.ts +4 -5
- package/src/initializeGit.ts +11 -5
- package/src/pack.ts +8 -6
- package/src/packTemplate.ts +11 -3
- package/src/template.ts +19 -8
- package/template.json +1 -1
package/src/template.ts
CHANGED
|
@@ -8,24 +8,28 @@ export type Template = typeof Template.Type;
|
|
|
8
8
|
export const decodeTemplate = Schema.decodeUnknownSync(Schema.fromJsonString(Template));
|
|
9
9
|
|
|
10
10
|
export function appTemplate(template: Template, minimal = false): Template {
|
|
11
|
+
const minimalManifest = template.find((entry) => entry.path === "package.minimal.json");
|
|
11
12
|
const minimalBaseline = template.find((entry) => entry.path === "quality-baseline.minimal.jsonl");
|
|
12
|
-
const files = template.filter((entry) =>
|
|
13
|
+
const files = template.filter((entry) => !["quality-baseline.minimal.jsonl", "package.minimal.json"].includes(entry.path));
|
|
13
14
|
if (!minimal) {
|
|
14
15
|
return files;
|
|
15
16
|
}
|
|
16
17
|
return files
|
|
17
18
|
.filter((entry) => !entry.path.startsWith("src/modules/notes/"))
|
|
18
19
|
.map((entry) => {
|
|
20
|
+
if (entry.path === "package.json" && minimalManifest !== undefined) {
|
|
21
|
+
return { ...entry, content: minimalManifest.content };
|
|
22
|
+
}
|
|
19
23
|
if (entry.path === "quality-baseline.jsonl" && minimalBaseline !== undefined) {
|
|
20
24
|
return { ...entry, content: minimalBaseline.content };
|
|
21
25
|
}
|
|
22
|
-
if (!["src/server/modules.ts", "src/server/workerModules.ts", "src/client/modules.ts"].includes(entry.path)) {
|
|
26
|
+
if (!["src/modules.ts", "src/server/modules.ts", "src/server/workerModules.ts", "src/client/modules.ts"].includes(entry.path)) {
|
|
23
27
|
return entry;
|
|
24
28
|
}
|
|
25
29
|
const source = Buffer.from(entry.content, "base64")
|
|
26
30
|
.toString()
|
|
27
31
|
.replace(/^import .* from "#modules\/notes\/.*";\n/gmu, "")
|
|
28
|
-
.replace(/,?\s*\b(?:notesRegistration|notesWorker)\b/gu, "");
|
|
32
|
+
.replace(/,?\s*\b(?:noteQueue|notesModule|notesRegistration|notesWorker)\b/gu, "");
|
|
29
33
|
return { ...entry, content: Buffer.from(source).toString("base64") };
|
|
30
34
|
});
|
|
31
35
|
}
|
|
@@ -42,7 +46,7 @@ const Manifest = Schema.Struct({
|
|
|
42
46
|
type: Schema.String,
|
|
43
47
|
version: Schema.String,
|
|
44
48
|
});
|
|
45
|
-
const decodeManifest = Schema.decodeUnknownSync(Schema.fromJsonString(Manifest));
|
|
49
|
+
export const decodeManifest = Schema.decodeUnknownSync(Schema.fromJsonString(Manifest));
|
|
46
50
|
// Decoding does not keep input key order, so the generated manifest lists its fields in package.json order.
|
|
47
51
|
const manifestOrder = [
|
|
48
52
|
"name",
|
|
@@ -57,6 +61,10 @@ const manifestOrder = [
|
|
|
57
61
|
"engines",
|
|
58
62
|
] as const satisfies ReadonlyArray<keyof typeof Manifest.Type>;
|
|
59
63
|
|
|
64
|
+
export function manifestJson(manifest: typeof Manifest.Type) {
|
|
65
|
+
return `${JSON.stringify(Object.fromEntries(manifestOrder.map((key) => [key, manifest[key]])), null, "\t")}\n`;
|
|
66
|
+
}
|
|
67
|
+
|
|
60
68
|
export function registryDependencies(dependencies: Readonly<Record<string, string>>, versions: Readonly<Record<string, string>>) {
|
|
61
69
|
return Object.fromEntries(
|
|
62
70
|
Object.entries(dependencies).map(([name, version]) => {
|
|
@@ -72,16 +80,19 @@ export function registryDependencies(dependencies: Readonly<Record<string, strin
|
|
|
72
80
|
);
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
export function prepareManifest(source: string, versions: Readonly<Record<string, string
|
|
83
|
+
export function prepareManifest(source: string, versions: Readonly<Record<string, string>>, minimal = false) {
|
|
76
84
|
const manifest = decodeManifest(source);
|
|
77
85
|
const { "check:published": _check, ...scripts } = manifest.scripts;
|
|
78
86
|
const prepared = {
|
|
79
87
|
...manifest,
|
|
80
|
-
dependencies: registryDependencies(
|
|
88
|
+
dependencies: registryDependencies(
|
|
89
|
+
Object.fromEntries(Object.entries(manifest.dependencies).filter(([name]) => !minimal || name !== "@tanstack/react-table")),
|
|
90
|
+
versions,
|
|
91
|
+
),
|
|
81
92
|
devDependencies: registryDependencies(manifest.devDependencies, versions),
|
|
82
93
|
scripts: Object.fromEntries(Object.entries(scripts).map(([name, script]) => [name, script.replaceAll("--conditions=source ", "")])),
|
|
83
94
|
};
|
|
84
|
-
return
|
|
95
|
+
return manifestJson(prepared);
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
export function prepareFile(path: string, content: Buffer, versions: Readonly<Record<string, string>>) {
|
|
@@ -92,7 +103,7 @@ export function prepareFile(path: string, content: Buffer, versions: Readonly<Re
|
|
|
92
103
|
return Buffer.from(prepareManifest(content.toString(), versions));
|
|
93
104
|
}
|
|
94
105
|
if (["tsconfig.json", "vite.config.ts", "vitest.config.ts", "src/server/dev.ts"].includes(path)) {
|
|
95
|
-
return Buffer.from(content.toString().replaceAll('
|
|
106
|
+
return Buffer.from(content.toString().replaceAll('["source"]', "[]"));
|
|
96
107
|
}
|
|
97
108
|
return content;
|
|
98
109
|
}
|