Skip to content

Commit 6ccdf9c

Browse files
committed
embed standalone-ui from src into cli dist...
(prior embedding wasn't working)
1 parent e308519 commit 6ccdf9c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
}
1919
},
2020
"scripts": {
21-
"build": "rm -rf dist && npm run build:express && tsc && npm run embed:studio-ui-src && npm run embed:express && npm run embed:templates",
21+
"build": "rm -rf dist && npm run build:express && tsc && npm run embed:studio-ui-src && npm run embed:express && npm run embed:templates && npm run embed:standalone-ui",
2222
"build:express": "cd ../express && npm run build",
2323
"embed:studio-ui-src": "mkdir -p dist/studio-ui-src && cp -r ../studio-ui/src/* dist/studio-ui-src/ && cp ../studio-ui/package.json dist/studio-ui-src/ && cp ../studio-ui/vite.config.ts dist/studio-ui-src/ && cp ../studio-ui/tsconfig.json dist/studio-ui-src/ && cp ../studio-ui/index.html dist/studio-ui-src/ && cp ../../vite.config.base.js dist/studio-ui-src/ && sed -i 's|../../vite.config.base.js|./vite.config.base.js|' dist/studio-ui-src/vite.config.ts && sed -i 's|resolve(__dirname, \\.\\., \\.\\.)|resolve(__dirname)|' dist/studio-ui-src/vite.config.ts && sed -i 's|/src/main.ts|./main.ts|' dist/studio-ui-src/index.html",
2424
"embed:express": "mkdir -p dist/express-assets && cp -r ../express/dist/* dist/express-assets/ && cp -r ../express/assets dist/express-assets/",
2525
"embed:templates": "mkdir -p dist/templates && cp -r templates/.skuilder dist/templates/",
26+
"embed:standalone-ui": "mkdir -p dist/standalone-ui-template && cp -r ../standalone-ui/src dist/standalone-ui-template/ && cp ../standalone-ui/package.json dist/standalone-ui-template/ && cp ../standalone-ui/tsconfig.json dist/standalone-ui-template/ && cp ../standalone-ui/vite.config.ts dist/standalone-ui-template/ && (cp ../standalone-ui/.gitignore dist/standalone-ui-template/ 2>/dev/null || true)",
2627
"dev": "tsc --watch",
2728
"lint": "npx eslint .",
2829
"lint:fix": "npx eslint . --fix",
@@ -45,7 +46,6 @@
4546
"@vue-skuilder/db": "workspace:*",
4647
"@vue-skuilder/edit-ui": "workspace:*",
4748
"@vue-skuilder/mcp": "workspace:*",
48-
"@vue-skuilder/standalone-ui": "^0.1.8-1",
4949
"chalk": "^5.3.0",
5050
"commander": "^11.0.0",
5151
"fs-extra": "^11.2.0",

packages/cli/src/utils/template.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ const __filename = fileURLToPath(import.meta.url);
1010
const __dirname = path.dirname(__filename);
1111

1212
/**
13-
* Find the standalone-ui package in node_modules
13+
* Find the standalone-ui template (embedded in CLI dist or from node_modules)
1414
*/
1515
export async function findStandaloneUiPath(): Promise<string> {
16-
// Start from CLI package root and work upward
17-
let currentDir = path.join(__dirname, '..', '..');
16+
// First try to find embedded template in CLI dist
17+
const embeddedTemplatePath = path.join(__dirname, '..', 'standalone-ui-template');
18+
if (existsSync(embeddedTemplatePath)) {
19+
return embeddedTemplatePath;
20+
}
1821

22+
// Fallback: search for standalone-ui package in node_modules (for development)
23+
let currentDir = path.join(__dirname, '..', '..');
1924
while (currentDir !== path.dirname(currentDir)) {
2025
const nodeModulesPath = path.join(currentDir, 'node_modules', '@vue-skuilder', 'standalone-ui');
2126
if (existsSync(nodeModulesPath)) {
@@ -25,7 +30,7 @@ export async function findStandaloneUiPath(): Promise<string> {
2530
}
2631

2732
throw new Error(
28-
'Could not find @vue-skuilder/standalone-ui package. Please ensure it is installed.'
33+
'Could not find standalone-ui template. Please ensure @vue-skuilder/cli is properly built.'
2934
);
3035
}
3136

0 commit comments

Comments
 (0)