@kardoe/quickback 0.4.3 → 0.5.1
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/commands/compile.js +5 -5
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/create.js +3 -3
- package/dist/commands/create.js.map +1 -1
- package/dist/index.js +29 -28
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +22 -2
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/async-utils.d.ts +6 -0
- package/dist/lib/async-utils.d.ts.map +1 -0
- package/dist/lib/async-utils.js +26 -0
- package/dist/lib/async-utils.js.map +1 -0
- package/dist/lib/file-loader.d.ts +9 -11
- package/dist/lib/file-loader.d.ts.map +1 -1
- package/dist/lib/file-loader.js +167 -157
- package/dist/lib/file-loader.js.map +1 -1
- package/dist/lib/file-writer.d.ts +4 -7
- package/dist/lib/file-writer.d.ts.map +1 -1
- package/dist/lib/file-writer.js +42 -32
- package/dist/lib/file-writer.js.map +1 -1
- package/package.json +12 -4
package/dist/lib/file-writer.js
CHANGED
|
@@ -3,31 +3,31 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Writes generated files to disk with smart merge strategies.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { promises as fs } from 'fs';
|
|
7
7
|
import { join, dirname } from 'path';
|
|
8
|
+
import { pathExists, runWithLimit } from './async-utils.js';
|
|
8
9
|
/**
|
|
9
10
|
* Clean and recreate output directory (used for testing only)
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const WRITE_CONCURRENCY = 16;
|
|
13
|
+
export async function cleanOutputDir(dir) {
|
|
14
|
+
if (await pathExists(dir)) {
|
|
15
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
await fs.mkdir(dir, { recursive: true });
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Write generated files to disk (overwrites all)
|
|
19
21
|
*/
|
|
20
|
-
export function writeFiles(outputDir, files) {
|
|
21
|
-
|
|
22
|
+
export async function writeFiles(outputDir, files) {
|
|
23
|
+
await runWithLimit(files, WRITE_CONCURRENCY, async (file) => {
|
|
22
24
|
const fullPath = join(outputDir, file.path);
|
|
23
25
|
const fileDir = dirname(fullPath);
|
|
24
26
|
// Ensure directory exists
|
|
25
|
-
|
|
26
|
-
mkdirSync(fileDir, { recursive: true });
|
|
27
|
-
}
|
|
27
|
+
await fs.mkdir(fileDir, { recursive: true });
|
|
28
28
|
// Write file
|
|
29
|
-
|
|
30
|
-
}
|
|
29
|
+
await fs.writeFile(fullPath, file.content, 'utf-8');
|
|
30
|
+
});
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Write generated files with smart merge strategy
|
|
@@ -37,43 +37,42 @@ export function writeFiles(outputDir, files) {
|
|
|
37
37
|
* - package.json: Merge dependencies
|
|
38
38
|
* - Config files: Overwrite
|
|
39
39
|
*/
|
|
40
|
-
export function writeFilesWithMerge(outputDir, files) {
|
|
41
|
-
|
|
40
|
+
export async function writeFilesWithMerge(outputDir, files) {
|
|
41
|
+
await runWithLimit(files, WRITE_CONCURRENCY, async (file) => {
|
|
42
42
|
const fullPath = join(outputDir, file.path);
|
|
43
43
|
const fileDir = dirname(fullPath);
|
|
44
44
|
// Ensure directory exists
|
|
45
|
-
|
|
46
|
-
mkdirSync(fileDir, { recursive: true });
|
|
47
|
-
}
|
|
45
|
+
await fs.mkdir(fileDir, { recursive: true });
|
|
48
46
|
// Check if this is a migration file
|
|
49
47
|
const isMigration = file.path.includes('/migrations/') ||
|
|
50
48
|
file.path.startsWith('drizzle/') ||
|
|
51
49
|
file.path.startsWith('supabase/migrations/');
|
|
52
|
-
if (isMigration &&
|
|
50
|
+
if (isMigration && await pathExists(fullPath)) {
|
|
53
51
|
// Skip existing migrations - don't overwrite
|
|
54
|
-
|
|
52
|
+
return;
|
|
55
53
|
}
|
|
56
54
|
// Check if this is package.json
|
|
57
|
-
if (file.path === 'package.json' &&
|
|
55
|
+
if (file.path === 'package.json' && await pathExists(fullPath)) {
|
|
58
56
|
// Merge package.json
|
|
59
|
-
const merged = mergePackageJson(fullPath, file.content);
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const merged = await mergePackageJson(fullPath, file.content);
|
|
58
|
+
await fs.writeFile(fullPath, merged, 'utf-8');
|
|
59
|
+
return;
|
|
62
60
|
}
|
|
63
61
|
// Default: write/overwrite
|
|
64
|
-
|
|
65
|
-
}
|
|
62
|
+
await fs.writeFile(fullPath, file.content, 'utf-8');
|
|
63
|
+
});
|
|
66
64
|
}
|
|
67
65
|
/**
|
|
68
66
|
* Merge generated package.json with existing one
|
|
69
67
|
* Preserves user's custom scripts, adds new dependencies
|
|
70
68
|
*/
|
|
71
|
-
function mergePackageJson(existingPath, newContent) {
|
|
69
|
+
async function mergePackageJson(existingPath, newContent) {
|
|
72
70
|
try {
|
|
73
|
-
const existing = JSON.parse(
|
|
71
|
+
const existing = JSON.parse(await fs.readFile(existingPath, 'utf-8'));
|
|
74
72
|
const generated = JSON.parse(newContent);
|
|
75
73
|
// Merge dependencies (generated takes precedence for versions)
|
|
76
74
|
const merged = {
|
|
75
|
+
...generated,
|
|
77
76
|
...existing,
|
|
78
77
|
name: generated.name || existing.name,
|
|
79
78
|
version: existing.version || generated.version,
|
|
@@ -89,6 +88,19 @@ function mergePackageJson(existingPath, newContent) {
|
|
|
89
88
|
...existing.devDependencies,
|
|
90
89
|
...generated.devDependencies,
|
|
91
90
|
},
|
|
91
|
+
peerDependencies: {
|
|
92
|
+
...existing.peerDependencies,
|
|
93
|
+
...generated.peerDependencies,
|
|
94
|
+
},
|
|
95
|
+
optionalDependencies: {
|
|
96
|
+
...existing.optionalDependencies,
|
|
97
|
+
...generated.optionalDependencies,
|
|
98
|
+
},
|
|
99
|
+
engines: {
|
|
100
|
+
...generated.engines,
|
|
101
|
+
...existing.engines,
|
|
102
|
+
},
|
|
103
|
+
packageManager: existing.packageManager ?? generated.packageManager,
|
|
92
104
|
};
|
|
93
105
|
return JSON.stringify(merged, null, 2);
|
|
94
106
|
}
|
|
@@ -100,11 +112,9 @@ function mergePackageJson(existingPath, newContent) {
|
|
|
100
112
|
/**
|
|
101
113
|
* Write a single file
|
|
102
114
|
*/
|
|
103
|
-
export function writeFile(filePath, content) {
|
|
115
|
+
export async function writeFile(filePath, content) {
|
|
104
116
|
const dir = dirname(filePath);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
writeFileSync(filePath, content, 'utf-8');
|
|
117
|
+
await fs.mkdir(dir, { recursive: true });
|
|
118
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
109
119
|
}
|
|
110
120
|
//# sourceMappingURL=file-writer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-writer.js","sourceRoot":"","sources":["../../src/lib/file-writer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"file-writer.js","sourceRoot":"","sources":["../../src/lib/file-writer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAS5D;;GAEG;AACH,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW;IAC9C,IAAI,MAAM,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,MAAM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C9E;YACD,eAAe,EAAE;gBACf,GAAG,QAAQ,CAAC,eAAe;gBAC3B,GAAG,SAAS,CAAC,eAAe;aAC7B;YACD,gBAAgB,EAAE;gBAChB,GAAG,QAAQ,CAAC,gBAAgB;gBAC5B,GAAG,SAAS,CAAC,gBAAgB;aAC9B;YACD,oBAAoB,EAAE;gBACpB,GAAG,QAAQ,CAAC,oBAAoB;gBAChC,GAAG,SAAS,CAAC,oBAAoB;aAClC;YACD,OAAO,EAAE;gBACP,GAAG,SAAS,CAAC,OAAO;gBACpB,GAAG,QAAQ,CAAC,OAAO;aACpB;YACD,cAAc,EAAE,QAAQ,CAAC,cAAc,IAAI,SAAS,CAAC,cAAc;SACpE,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;QACxC,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAgB,EAAE,OAAe;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE9B,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kardoe/quickback",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "CLI for Quickback - one-shot backend generator",
|
|
5
5
|
"author": "Paul Stenhouse",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"src/skill/**/*"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"prebuild": "npm run bundle:docs && npm run bundle:skill",
|
|
17
|
+
"prebuild": "npx tsx scripts/inject-version.ts && npm run bundle:docs && npm run bundle:skill",
|
|
18
18
|
"build": "tsc",
|
|
19
19
|
"dev": "tsc --watch",
|
|
20
20
|
"test": "bun test",
|
|
@@ -33,8 +33,16 @@
|
|
|
33
33
|
"@types/node": "^22.7.5",
|
|
34
34
|
"@types/prompts": "^2.4.9",
|
|
35
35
|
"bun-types": "^1.3.5",
|
|
36
|
-
"tsx": "^4.
|
|
37
|
-
"typescript": "^5.
|
|
36
|
+
"tsx": "^4.19.0",
|
|
37
|
+
"typescript": "^5.9.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"typescript": ">=5.0.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"typescript": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
38
46
|
},
|
|
39
47
|
"engines": {
|
|
40
48
|
"node": ">=18.0.0"
|