nucleus-core-ts 0.9.93 → 0.9.97
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/bin/cli.ts +25 -18
- package/dist/bin/cli.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/src/Client/ApiCaller/system-tables.d.ts +3 -0
- package/infra/scripts/generate-project.ts +213 -194
- package/package.json +1 -1
package/bin/cli.ts
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* Nucleus CLI — unified entry point for all nucleus-core-ts commands.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* npx nucleus-core-ts scaffold — Interactive project scaffolding
|
|
7
|
+
* npx nucleus-core-ts generate — Generate schema from config.json
|
|
8
|
+
* npx nucleus-core-ts help — Show available commands
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { join } from 'path'
|
|
11
|
+
import { join, dirname } from 'path'
|
|
12
|
+
import { fileURLToPath } from 'url'
|
|
13
|
+
import { spawn } from 'child_process'
|
|
12
14
|
|
|
13
15
|
const BOLD = '\x1b[1m'
|
|
14
16
|
const CYAN = '\x1b[36m'
|
|
@@ -16,7 +18,10 @@ const DIM = '\x1b[2m'
|
|
|
16
18
|
const RED = '\x1b[31m'
|
|
17
19
|
const RESET = '\x1b[0m'
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
22
|
+
const __dirname = dirname(__filename)
|
|
23
|
+
const rootDir = join(__dirname, '..')
|
|
24
|
+
|
|
20
25
|
const firstArg = process.argv[2] ?? ''
|
|
21
26
|
const looksLikeFile = firstArg.endsWith('.json') || firstArg.startsWith('./') || firstArg.startsWith('/')
|
|
22
27
|
const command = looksLikeFile ? 'generate' : firstArg
|
|
@@ -39,30 +44,32 @@ ${BOLD}Examples:${RESET}
|
|
|
39
44
|
`)
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
async function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
async function runGenerate(args: string[]) {
|
|
48
|
+
return new Promise<void>((res) => {
|
|
49
|
+
const proc = spawn('bun', ['run', join(rootDir, 'scripts', 'generate-schema.ts'), ...args], {
|
|
50
|
+
cwd: process.cwd(),
|
|
51
|
+
stdio: 'inherit',
|
|
52
|
+
})
|
|
53
|
+
proc.on('close', (code) => {
|
|
54
|
+
process.exit(code ?? 1)
|
|
55
|
+
})
|
|
48
56
|
})
|
|
49
|
-
const exitCode = await proc.exited
|
|
50
|
-
process.exit(exitCode)
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
const rootDir = join(import.meta.dir, '..')
|
|
54
|
-
|
|
55
59
|
switch (command) {
|
|
56
60
|
case 'scaffold':
|
|
57
61
|
case 'init':
|
|
58
|
-
case 'new':
|
|
59
|
-
await
|
|
62
|
+
case 'new': {
|
|
63
|
+
const { scaffold } = await import(join(rootDir, 'infra', 'scripts', 'generate-project.ts'))
|
|
64
|
+
const infraDir = join(rootDir, 'infra')
|
|
65
|
+
await scaffold(infraDir)
|
|
60
66
|
break
|
|
67
|
+
}
|
|
61
68
|
|
|
62
69
|
case 'generate':
|
|
63
70
|
case 'gen': {
|
|
64
71
|
const genArgs = looksLikeFile ? process.argv.slice(2) : process.argv.slice(3)
|
|
65
|
-
await
|
|
72
|
+
await runGenerate(genArgs)
|
|
66
73
|
break
|
|
67
74
|
}
|
|
68
75
|
|
package/dist/bin/cli.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Nucleus CLI — unified entry point for all nucleus-core-ts commands.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* npx nucleus-core-ts scaffold — Interactive project scaffolding
|
|
7
|
+
* npx nucleus-core-ts generate — Generate schema from config.json
|
|
8
|
+
* npx nucleus-core-ts help — Show available commands
|
|
9
9
|
*/
|
|
10
10
|
export {};
|