Skip to content

Commit ad7d5f3

Browse files
committed
fix: moving the UI into a module that is invoked by the CLI
1 parent c489673 commit ad7d5f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+816
-108
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ my-app
66
**/node_modules
77
**/dist
88
.vinxi
9-
**/bin-dist
10-
9+
**/lib-dist
1110
.vscode
1211

1312
.nx/cache

cli/add-on-developer/bin/add-on-developer.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

cli/add-on-developer/tsconfig.bin.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"create-tsrouter-app": "workspace:*",
3030
"@tanstack/cta-cli": "workspace:*",
3131
"@tanstack/cta-engine": "workspace:*",
32-
"@tanstack/cta-mcp": "workspace:*"
32+
"@tanstack/cta-mcp": "workspace:*",
33+
"@tanstack/cta-ui": "workspace:*"
3334
}
3435
},
3536
"workspaces": [

packages/cta-cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"dependencies": {
3333
"@tanstack/cta-engine": "workspace:*",
3434
"@tanstack/cta-mcp": "workspace:*",
35+
"@tanstack/cta-ui": "workspace:*",
3536
"@clack/prompts": "^0.10.0",
3637
"chalk": "^5.4.1",
3738
"commander": "^13.1.0"

packages/cta-cli/src/cli.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616

1717
import { runMCPServer } from '@tanstack/cta-mcp'
1818

19+
import { launchUI } from '@tanstack/cta-ui'
20+
1921
import { normalizeOptions, promptForOptions } from './options.js'
2022

2123
import { createUIEnvironment } from './ui-environment.js'
@@ -79,12 +81,20 @@ export function cli({
7981
)
8082
})
8183

82-
program
83-
.command('update-add-on')
84+
const addOnCommand = program.command('add-on')
85+
86+
addOnCommand
87+
.command('update')
8488
.description('Create or update an add-on from the current project')
8589
.action(async () => {
8690
await initAddOn('add-on', environment)
8791
})
92+
addOnCommand
93+
.command('ui')
94+
.description('Show the add-on developer UI')
95+
.action(async () => {
96+
launchUI()
97+
})
8898

8999
program
90100
.command('update-starter')
File renamed without changes.
File renamed without changes.

packages/cta-ui/lib/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { dirname, resolve } from 'node:path'
2+
import { fileURLToPath } from 'node:url'
3+
4+
export function launchUI() {
5+
const projectPath = process.cwd()
6+
7+
process.env.PROJECT_PATH = projectPath
8+
9+
const configPath = resolve(
10+
dirname(fileURLToPath(import.meta.url)),
11+
'../app.config.js',
12+
)
13+
14+
const developerPath = resolve(dirname(fileURLToPath(import.meta.url)), '..')
15+
16+
process.chdir(developerPath)
17+
18+
import(configPath).then(async (config) => {
19+
const out = await config.default
20+
await out.dev()
21+
})
22+
}

0 commit comments

Comments
 (0)