@kmlckj/licos-ai-cli 0.0.32 → 0.0.34
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/lib/__templates__/expo/.licosproj/scripts/prod_build.sh +39 -0
- package/lib/__templates__/expo/server/src/index.ts +12 -0
- package/lib/__templates__/native-static/.licos +2 -2
- package/lib/__templates__/nuxt-vue/nuxt.config.ts +26 -24
- package/lib/__templates__/nuxt-vue/package.json +20 -14
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +451 -460
- package/lib/__templates__/nuxt-vue/scripts/build.sh +10 -0
- package/lib/__templates__/nuxt-vue/scripts/start.sh +10 -0
- package/lib/__templates__/taro/.licosproj/scripts/deploy_run.sh +1 -1
- package/lib/__templates__/taro/AGENTS.md +7 -0
- package/lib/__templates__/taro/README.md +4 -3
- package/lib/__templates__/taro/config/index.ts +1 -1
- package/lib/__templates__/taro/eslint.config.mjs +1 -1
- package/lib/__templates__/taro/package.json +2 -1
- package/lib/__templates__/taro/pnpm-lock.yaml +42 -1978
- package/lib/__templates__/taro/server/package.json +3 -12
- package/lib/__templates__/taro/server/src/main.ts +17 -0
- package/lib/__templates__/taro/src/presets/env.ts +1 -1
- package/lib/__templates__/taro/types/global.d.ts +1 -2
- package/lib/__templates__/vite/scripts/build.sh +1 -0
- package/lib/__templates__/vite/server/vite.ts +5 -2
- package/lib/cli.js +20 -1
- package/package.json +1 -1
|
@@ -40,6 +40,45 @@ fi
|
|
|
40
40
|
info "==================== 依赖安装完成!====================\n"
|
|
41
41
|
|
|
42
42
|
info "==================== dist打包 ===================="
|
|
43
|
+
info "开始执行:expo export --platform web (client)"
|
|
44
|
+
rm -rf "$ROOT_DIR/server/public"
|
|
45
|
+
(pushd "$ROOT_DIR/client" > /dev/null && pnpm expo export --platform web --output-dir ../server/public; popd > /dev/null) || error "client web 打包失败"
|
|
46
|
+
|
|
47
|
+
BASE_URL="${BASE_PATH:-/}"
|
|
48
|
+
if [ "${BASE_URL}" != "/" ]; then
|
|
49
|
+
BASE_URL="/$(printf '%s' "${BASE_URL}" | sed 's#^/*##; s#/*$##')/"
|
|
50
|
+
fi
|
|
51
|
+
if [ "${BASE_URL}" != "/" ]; then
|
|
52
|
+
info "重写 Expo Web 静态资源前缀:${BASE_URL}"
|
|
53
|
+
BASE_URL="${BASE_URL}" python3 - <<'PY'
|
|
54
|
+
import os
|
|
55
|
+
from pathlib import Path
|
|
56
|
+
|
|
57
|
+
base = os.environ["BASE_URL"]
|
|
58
|
+
public_dir = Path("server/public")
|
|
59
|
+
replacements = [
|
|
60
|
+
('"/_expo/', f'"{base}_expo/'),
|
|
61
|
+
("'/_expo/", f"'{base}_expo/"),
|
|
62
|
+
('"/assets/', f'"{base}assets/'),
|
|
63
|
+
("'/assets/", f"'{base}assets/"),
|
|
64
|
+
('"/favicon.ico"', f'"{base}favicon.ico"'),
|
|
65
|
+
("'/favicon.ico'", f"'{base}favicon.ico'"),
|
|
66
|
+
("url(/assets/", f"url({base}assets/"),
|
|
67
|
+
('url("/assets/', f'url("{base}assets/'),
|
|
68
|
+
("url('/assets/", f"url('{base}assets/"),
|
|
69
|
+
]
|
|
70
|
+
for path in public_dir.rglob("*"):
|
|
71
|
+
if path.suffix not in {".html", ".js", ".css"}:
|
|
72
|
+
continue
|
|
73
|
+
text = path.read_text(encoding="utf-8")
|
|
74
|
+
updated = text
|
|
75
|
+
for old, new in replacements:
|
|
76
|
+
updated = updated.replace(old, new)
|
|
77
|
+
if updated != text:
|
|
78
|
+
path.write_text(updated, encoding="utf-8")
|
|
79
|
+
PY
|
|
80
|
+
fi
|
|
81
|
+
|
|
43
82
|
info "开始执行:pnpm run build (server)"
|
|
44
83
|
(pushd "$ROOT_DIR/server" > /dev/null && pnpm run build; popd > /dev/null) || error "dist打包失败"
|
|
45
84
|
info "==================== dist打包完成!====================\n"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import express from "express";
|
|
2
2
|
import cors from "cors";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
3
5
|
|
|
4
6
|
const app = express();
|
|
5
7
|
const port = process.env.PORT || 5001;
|
|
@@ -14,6 +16,16 @@ app.get('/api/v1/health', (req, res) => {
|
|
|
14
16
|
res.status(200).json({ status: 'ok' });
|
|
15
17
|
});
|
|
16
18
|
|
|
19
|
+
const publicDir = path.resolve(process.cwd(), "public");
|
|
20
|
+
if (fs.existsSync(publicDir)) {
|
|
21
|
+
app.use(express.static(publicDir));
|
|
22
|
+
app.get("*", (req, res, next) => {
|
|
23
|
+
if (req.path.startsWith("/api/")) {
|
|
24
|
+
return next();
|
|
25
|
+
}
|
|
26
|
+
res.sendFile(path.join(publicDir, "index.html"));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
17
29
|
|
|
18
30
|
app.listen(port, () => {
|
|
19
31
|
console.log(`Server listening at http://localhost:${port}/`);
|
|
@@ -3,9 +3,9 @@ entrypoint = "index.html"
|
|
|
3
3
|
requires = ["python-3.12"]
|
|
4
4
|
|
|
5
5
|
[dev]
|
|
6
|
-
build = []
|
|
6
|
+
build = ["sh", "-lc", "true"]
|
|
7
7
|
run = ["python", "-m", "http.server", "5000", "--bind", "0.0.0.0"]
|
|
8
8
|
|
|
9
9
|
[deploy]
|
|
10
|
-
build = []
|
|
10
|
+
build = ["sh", "-lc", "true"]
|
|
11
11
|
run = ["python", "-m", "http.server", "5000", "--bind", "0.0.0.0"]
|
|
@@ -11,6 +11,11 @@ function normalizeBaseURL(value?: string): string {
|
|
|
11
11
|
return `/${trimmed.replace(/^\/+|\/+$/g, '')}/`;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
const publicBaseURL =
|
|
15
|
+
process.env.LICOS_PROJECT_ENV === 'PROD'
|
|
16
|
+
? normalizeBaseURL(process.env.NUXT_PUBLIC_BASE_URL || process.env.BASE_PATH)
|
|
17
|
+
: '/';
|
|
18
|
+
|
|
14
19
|
export default defineNuxtConfig({
|
|
15
20
|
compatibilityDate: '2025-07-15',
|
|
16
21
|
// Disable devtools in CI/test environments (prevents hanging in headless mode)
|
|
@@ -21,8 +26,10 @@ export default defineNuxtConfig({
|
|
|
21
26
|
|
|
22
27
|
// App head configuration
|
|
23
28
|
app: {
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
// The cluster ingress rewrites /p/{projectId}/... to backend /...
|
|
30
|
+
// Keep Nuxt's server base at / and prefix only generated asset URLs.
|
|
31
|
+
baseURL: '/',
|
|
32
|
+
buildAssetsDir: publicBaseURL === '/' ? '/_nuxt/' : `${publicBaseURL}_nuxt/`,
|
|
26
33
|
head: {
|
|
27
34
|
title: '新应用 | LICOS AI',
|
|
28
35
|
titleTemplate: '%s | LICOS AI',
|
|
@@ -63,15 +70,17 @@ export default defineNuxtConfig({
|
|
|
63
70
|
},
|
|
64
71
|
|
|
65
72
|
// Nuxt modules
|
|
66
|
-
|
|
67
|
-
modules:
|
|
68
|
-
process.env.CI === 'true'
|
|
69
|
-
? ['@nuxtjs/tailwindcss']
|
|
70
|
-
: ['@nuxt/image', '@nuxtjs/tailwindcss'],
|
|
73
|
+
modules: ['@nuxt/image', '@nuxtjs/tailwindcss'],
|
|
71
74
|
|
|
72
75
|
// Global CSS
|
|
73
76
|
css: [resolve(__dirname, 'assets/css/main.css')],
|
|
74
77
|
|
|
78
|
+
runtimeConfig: {
|
|
79
|
+
public: {
|
|
80
|
+
baseURL: publicBaseURL,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
|
|
75
84
|
// Development server configuration
|
|
76
85
|
devServer: {
|
|
77
86
|
port: parseInt(process.env.PORT || '<%= port %>', 10),
|
|
@@ -115,23 +124,16 @@ export default defineNuxtConfig({
|
|
|
115
124
|
},
|
|
116
125
|
},
|
|
117
126
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
protocol: 'https',
|
|
129
|
-
hostname: 'placeholder.local',
|
|
130
|
-
pathname: '/**',
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
},
|
|
134
|
-
}),
|
|
127
|
+
image: {
|
|
128
|
+
domains: ['placeholder.local'],
|
|
129
|
+
remotePatterns: [
|
|
130
|
+
{
|
|
131
|
+
protocol: 'https',
|
|
132
|
+
hostname: 'placeholder.local',
|
|
133
|
+
pathname: '/**',
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
135
137
|
|
|
136
138
|
// Security headers (Content Security Policy)
|
|
137
139
|
nitro: {
|
|
@@ -18,20 +18,26 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@kmlckj/licos-platform-sdk": "0.6.3",
|
|
21
|
-
"@nuxt/image": "
|
|
22
|
-
"nuxt": "
|
|
23
|
-
"tailwind-merge": "
|
|
24
|
-
"vue": "
|
|
25
|
-
"vue-router": "
|
|
26
|
-
},
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@nuxtjs/tailwindcss": "
|
|
29
|
-
"@types/node": "
|
|
30
|
-
"autoprefixer": "
|
|
31
|
-
"postcss": "
|
|
32
|
-
"tailwindcss": "
|
|
33
|
-
"typescript": "
|
|
34
|
-
},
|
|
21
|
+
"@nuxt/image": "2.0.0",
|
|
22
|
+
"nuxt": "4.3.1",
|
|
23
|
+
"tailwind-merge": "2.6.0",
|
|
24
|
+
"vue": "3.5.30",
|
|
25
|
+
"vue-router": "4.6.4"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@nuxtjs/tailwindcss": "6.14.0",
|
|
29
|
+
"@types/node": "20.19.25",
|
|
30
|
+
"autoprefixer": "10.4.20",
|
|
31
|
+
"postcss": "8.4.49",
|
|
32
|
+
"tailwindcss": "3.4.17",
|
|
33
|
+
"typescript": "5.9.3"
|
|
34
|
+
},
|
|
35
|
+
"pnpm": {
|
|
36
|
+
"overrides": {
|
|
37
|
+
"ipx": "3.1.1",
|
|
38
|
+
"sharp": "0.34.5"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
35
41
|
"packageManager": "pnpm@9.0.0",
|
|
36
42
|
"engines": {
|
|
37
43
|
"pnpm": ">=9.0.0"
|