@tanstack/cta-cli 0.10.0-alpha.16
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/LICENSE +21 -0
- package/dist/cli.js +149 -0
- package/dist/index.js +1 -0
- package/dist/options.js +358 -0
- package/dist/types/cli.d.ts +7 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/options.d.ts +7 -0
- package/dist/types/types.d.ts +16 -0
- package/dist/types/ui-environment.d.ts +2 -0
- package/dist/types.js +1 -0
- package/dist/ui-environment.js +49 -0
- package/package.json +42 -0
- package/src/cli.ts +260 -0
- package/src/index.ts +1 -0
- package/src/options.ts +452 -0
- package/src/types.ts +17 -0
- package/src/ui-environment.ts +64 -0
- package/tsconfig.json +17 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PackageManager, TemplateOptions } from '@tanstack/cta-engine'
|
|
2
|
+
|
|
3
|
+
export interface CliOptions {
|
|
4
|
+
template?: TemplateOptions
|
|
5
|
+
framework?: string
|
|
6
|
+
tailwind?: boolean
|
|
7
|
+
packageManager?: PackageManager
|
|
8
|
+
toolchain?: string
|
|
9
|
+
projectName?: string
|
|
10
|
+
git?: boolean
|
|
11
|
+
addOns?: Array<string> | boolean
|
|
12
|
+
listAddOns?: boolean
|
|
13
|
+
mcp?: boolean
|
|
14
|
+
mcpSse?: boolean
|
|
15
|
+
starter?: string
|
|
16
|
+
targetDir?: string
|
|
17
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cancel,
|
|
3
|
+
confirm,
|
|
4
|
+
intro,
|
|
5
|
+
isCancel,
|
|
6
|
+
log,
|
|
7
|
+
outro,
|
|
8
|
+
spinner,
|
|
9
|
+
} from '@clack/prompts'
|
|
10
|
+
import chalk from 'chalk'
|
|
11
|
+
|
|
12
|
+
import { createDefaultEnvironment } from '@tanstack/cta-engine'
|
|
13
|
+
|
|
14
|
+
import type { Environment } from '@tanstack/cta-engine'
|
|
15
|
+
|
|
16
|
+
export function createUIEnvironment(): Environment {
|
|
17
|
+
const defaultEnvironment = createDefaultEnvironment()
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
...defaultEnvironment,
|
|
21
|
+
intro: (message: string) => {
|
|
22
|
+
intro(message)
|
|
23
|
+
},
|
|
24
|
+
outro: (message: string) => {
|
|
25
|
+
outro(message)
|
|
26
|
+
},
|
|
27
|
+
info: (title?: string, message?: string) => {
|
|
28
|
+
console.log('info', title, message)
|
|
29
|
+
log.info(
|
|
30
|
+
`${title ? chalk.red(title) : ''}${message ? chalk.green(message) : ''}`,
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
error: (title?: string, message?: string) => {
|
|
34
|
+
console.log('error', title, message)
|
|
35
|
+
log.error(`${title ? `${title}: ` : ''}${message}`)
|
|
36
|
+
},
|
|
37
|
+
warn: (title?: string, message?: string) => {
|
|
38
|
+
console.log('warn', title, message)
|
|
39
|
+
log.warn(`${title ? `${title}: ` : ''}${message}`)
|
|
40
|
+
},
|
|
41
|
+
confirm: async (message: string) => {
|
|
42
|
+
console.log('confirm', message)
|
|
43
|
+
const shouldContinue = await confirm({
|
|
44
|
+
message,
|
|
45
|
+
})
|
|
46
|
+
if (isCancel(shouldContinue)) {
|
|
47
|
+
cancel('Operation cancelled.')
|
|
48
|
+
process.exit(0)
|
|
49
|
+
}
|
|
50
|
+
return shouldContinue
|
|
51
|
+
},
|
|
52
|
+
spinner: () => {
|
|
53
|
+
const s = spinner()
|
|
54
|
+
return {
|
|
55
|
+
start: (message: string) => {
|
|
56
|
+
s.start(message)
|
|
57
|
+
},
|
|
58
|
+
stop: (message: string) => {
|
|
59
|
+
s.stop(message)
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ES2020",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"rootDir": "./src",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationDir": "./dist/types"
|
|
14
|
+
},
|
|
15
|
+
"include": ["./src/**/*.ts"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|