@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
|
@@ -12,28 +12,19 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@kmlckj/licos-platform-sdk": "0.6.3",
|
|
15
|
-
"@aws-sdk/client-s3": "^3.958.0",
|
|
16
|
-
"@aws-sdk/lib-storage": "^3.958.0",
|
|
17
15
|
"@nestjs/common": "^10.4.15",
|
|
18
16
|
"@nestjs/core": "^10.4.15",
|
|
19
17
|
"@nestjs/platform-express": "^10.4.15",
|
|
20
|
-
"better-sqlite3": "^11.9.1",
|
|
21
18
|
"dotenv": "^17.2.3",
|
|
22
|
-
"
|
|
23
|
-
"drizzle-orm": "^0.45.1",
|
|
24
|
-
"drizzle-zod": "^0.8.3",
|
|
25
|
-
"express": "5.2.1",
|
|
26
|
-
"pg": "^8.16.3",
|
|
19
|
+
"express": "5.2.1",
|
|
27
20
|
"rxjs": "^7.8.1",
|
|
28
21
|
"zod": "^4.3.5"
|
|
29
22
|
},
|
|
30
23
|
"devDependencies": {
|
|
31
24
|
"@nestjs/cli": "^10.4.9",
|
|
32
25
|
"@nestjs/schematics": "^10.2.3",
|
|
33
|
-
"@types/
|
|
34
|
-
"@types/
|
|
35
|
-
"@types/node": "^22.10.2",
|
|
36
|
-
"drizzle-kit": "^0.31.8",
|
|
26
|
+
"@types/express": "5.0.6",
|
|
27
|
+
"@types/node": "^22.10.2",
|
|
37
28
|
"typescript": "^5.7.2"
|
|
38
29
|
}
|
|
39
30
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { NestFactory } from '@nestjs/core';
|
|
2
2
|
import { AppModule } from '@/app.module';
|
|
3
3
|
import * as express from 'express';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
4
6
|
import { HttpStatusInterceptor } from '@/interceptors/http-status.interceptor';
|
|
5
7
|
|
|
6
8
|
function parsePort(): number {
|
|
@@ -26,6 +28,21 @@ async function bootstrap() {
|
|
|
26
28
|
app.use(express.json({ limit: '50mb' }));
|
|
27
29
|
app.use(express.urlencoded({ limit: '50mb', extended: true }));
|
|
28
30
|
|
|
31
|
+
const staticDir = path.resolve(__dirname, '../../dist-web');
|
|
32
|
+
const indexHtml = path.join(staticDir, 'index.html');
|
|
33
|
+
if (fs.existsSync(indexHtml)) {
|
|
34
|
+
app.use(express.static(staticDir));
|
|
35
|
+
app.use((req, res, next) => {
|
|
36
|
+
if (req.path.startsWith('/api')) {
|
|
37
|
+
return next();
|
|
38
|
+
}
|
|
39
|
+
if (req.method === 'GET' && req.accepts('html')) {
|
|
40
|
+
return res.sendFile(indexHtml);
|
|
41
|
+
}
|
|
42
|
+
return next();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
29
46
|
// 全局拦截器:统一将 POST 请求的 201 状态码改为 200
|
|
30
47
|
app.useGlobalInterceptors(new HttpStatusInterceptor());
|
|
31
48
|
// 1. 开启优雅关闭 Hooks (关键!)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const IS_H5_ENV =
|
|
1
|
+
export const IS_H5_ENV = LICOS_TARO_ENV === 'h5';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@tarojs/taro" />
|
|
2
2
|
|
|
3
3
|
declare const PROJECT_DOMAIN: string | undefined;
|
|
4
|
-
declare const
|
|
4
|
+
declare const LICOS_TARO_ENV: "weapp" | "h5" | "tt" | string | undefined;
|
|
5
5
|
|
|
6
6
|
declare module '*.png';
|
|
7
7
|
declare module '*.gif';
|
|
@@ -29,4 +29,3 @@ declare namespace NodeJS {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
@@ -9,6 +9,7 @@ echo "Installing dependencies..."
|
|
|
9
9
|
pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
10
10
|
|
|
11
11
|
echo "Building frontend with Vite..."
|
|
12
|
+
export VITE_BASE_PATH="${VITE_BASE_PATH:-${BASE_PATH:-/}}"
|
|
12
13
|
pnpm vite build
|
|
13
14
|
|
|
14
15
|
echo "Bundling server with tsup..."
|
|
@@ -5,8 +5,6 @@ import type { Application, Request, Response } from 'express';
|
|
|
5
5
|
import express from 'express';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import fs from 'fs';
|
|
8
|
-
import { createServer as createViteServer } from 'vite';
|
|
9
|
-
import viteConfig from '../vite.config';
|
|
10
8
|
|
|
11
9
|
const isDev = process.env.LICOS_PROJECT_ENV !== 'PROD';
|
|
12
10
|
|
|
@@ -14,6 +12,11 @@ const isDev = process.env.LICOS_PROJECT_ENV !== 'PROD';
|
|
|
14
12
|
* 集成 Vite 开发服务器(中间件模式)
|
|
15
13
|
*/
|
|
16
14
|
export async function setupViteMiddleware(app: Application) {
|
|
15
|
+
const [{ createServer: createViteServer }, { default: viteConfig }] = await Promise.all([
|
|
16
|
+
import('vite'),
|
|
17
|
+
import('../vite.config'),
|
|
18
|
+
]);
|
|
19
|
+
|
|
17
20
|
const vite = await createViteServer({
|
|
18
21
|
...viteConfig,
|
|
19
22
|
server: {
|
package/lib/cli.js
CHANGED
|
@@ -2109,7 +2109,7 @@ const EventBuilder = {
|
|
|
2109
2109
|
};
|
|
2110
2110
|
|
|
2111
2111
|
var name = "@kmlckj/licos-ai-cli";
|
|
2112
|
-
var version = "0.0.
|
|
2112
|
+
var version = "0.0.34";
|
|
2113
2113
|
var description = "LICOS AI coding workspace CLI - project template engine and dev tools";
|
|
2114
2114
|
var license = "MIT";
|
|
2115
2115
|
var author = "kmlckj";
|
|
@@ -5940,6 +5940,10 @@ const getCommandConfig = (
|
|
|
5940
5940
|
throw new Error(`Unknown command: ${commandName}`);
|
|
5941
5941
|
}
|
|
5942
5942
|
|
|
5943
|
+
if (commandName === 'build' && Array.isArray(commandConfig)) {
|
|
5944
|
+
return commandConfig;
|
|
5945
|
+
}
|
|
5946
|
+
|
|
5943
5947
|
if (!commandConfig || commandConfig.length === 0) {
|
|
5944
5948
|
throw new Error(
|
|
5945
5949
|
`Command '${commandName}' is not configured in .licos file.\n` +
|
|
@@ -7003,6 +7007,21 @@ const executeRun = async (
|
|
|
7003
7007
|
const config = await loadLicosConfig();
|
|
7004
7008
|
const commandArgs = getCommandConfig(config, commandName);
|
|
7005
7009
|
|
|
7010
|
+
if (commandName === 'build' && commandArgs.length === 0) {
|
|
7011
|
+
const buildDuration = Date.now() - buildStartTime;
|
|
7012
|
+
logger.info('Build command is empty; skipping build step');
|
|
7013
|
+
reportCommandComplete(commandName, true, Date.now() - cmdStartTime, {
|
|
7014
|
+
args: JSON.stringify(options),
|
|
7015
|
+
categories: {
|
|
7016
|
+
fixDuration: String(fixDuration),
|
|
7017
|
+
buildDuration: String(buildDuration),
|
|
7018
|
+
exitCode: '0',
|
|
7019
|
+
projectType,
|
|
7020
|
+
},
|
|
7021
|
+
});
|
|
7022
|
+
return;
|
|
7023
|
+
}
|
|
7024
|
+
|
|
7006
7025
|
// 3. 准备日志
|
|
7007
7026
|
const logFilePath = resolveLogFilePath(options.logFile);
|
|
7008
7027
|
const logStream = createLogStream(logFilePath);
|