@kmlckj/licos-ai-cli 1.0.18 → 1.0.20

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.
Files changed (27) hide show
  1. package/lib/__templates__/expo/.licosproj/scripts/dev_build.sh +4 -1
  2. package/lib/__templates__/expo/client/app.config.ts +87 -87
  3. package/lib/__templates__/expo/package.json +1 -1
  4. package/lib/__templates__/expo/template.config.js +4 -7
  5. package/lib/__templates__/nextjs/next.config.ts +35 -35
  6. package/lib/__templates__/nextjs/package.json +1 -1
  7. package/lib/__templates__/nextjs/pnpm-lock.yaml +11549 -12072
  8. package/lib/__templates__/nextjs/scripts/prepare.sh +4 -1
  9. package/lib/__templates__/nextjs/src/server.ts +129 -129
  10. package/lib/__templates__/nextjs/template.config.js +4 -7
  11. package/lib/__templates__/nuxt-vue/nuxt.config.ts +180 -180
  12. package/lib/__templates__/nuxt-vue/package.json +1 -1
  13. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8586 -8283
  14. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +4 -1
  15. package/lib/__templates__/taro/.licosproj/scripts/dev_build.sh +4 -1
  16. package/lib/__templates__/taro/.licosproj/scripts/dev_run.sh +4 -1
  17. package/lib/__templates__/taro/config/index.ts +352 -352
  18. package/lib/__templates__/taro/package.json +2 -2
  19. package/lib/__templates__/taro/pnpm-lock.yaml +20848 -21212
  20. package/lib/__templates__/vite/package.json +1 -1
  21. package/lib/__templates__/vite/scripts/prepare.sh +4 -1
  22. package/lib/__templates__/vite/server/server.ts +1 -1
  23. package/lib/__templates__/vite/server/vite.ts +11 -3
  24. package/lib/__templates__/vite/template.config.js +4 -7
  25. package/lib/__templates__/vite/vite.config.ts +64 -64
  26. package/lib/cli.js +1 -1
  27. package/package.json +1 -1
@@ -36,7 +36,10 @@ if [ ! -f "package.json" ]; then
36
36
  exit 1
37
37
  fi
38
38
  # 步骤 2.1/2.2:安装项目依赖
39
- pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only
39
+ pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || {
40
+ echo "Primary registry install failed; retrying with npmjs registry..."
41
+ pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only
42
+ }
40
43
 
41
44
  echo "检查根目录 post_install.py"
42
45
  if [ -f "$PREVIEW_DIR/post_install.py" ]; then
@@ -1,87 +1,87 @@
1
- import { ExpoConfig, ConfigContext } from 'expo/config';
2
-
3
- const appName = process.env.LICOS_PROJECT_NAME || process.env.EXPO_PUBLIC_LICOS_PROJECT_NAME || '应用';
4
- const projectId = process.env.LICOS_PROJECT_ID || process.env.EXPO_PUBLIC_LICOS_PROJECT_ID;
5
- const slugAppName = projectId ? `app${projectId}` : 'myapp';
6
-
7
- const normalizeBaseUrl = (value?: string) => {
8
- const trimmed = value?.trim();
9
- if (!trimmed || trimmed === '/') {
10
- return undefined;
11
- }
12
- return `/${trimmed.replace(/^\/+|\/+$/g, '')}`;
13
- };
14
-
15
- const baseUrl = normalizeBaseUrl(process.env.BASE_PATH || process.env.EXPO_PUBLIC_BASE_PATH);
16
-
17
- export default ({ config }: ConfigContext): ExpoConfig => {
18
- return {
19
- ...config,
20
- "name": appName,
21
- "slug": slugAppName,
22
- "version": "1.0.0",
23
- "orientation": "portrait",
24
- "icon": "./assets/images/icon.png",
25
- "scheme": "myapp",
26
- "userInterfaceStyle": "automatic",
27
- "newArchEnabled": true,
28
- "ios": {
29
- "supportsTablet": true
30
- },
31
- "android": {
32
- "adaptiveIcon": {
33
- "foregroundImage": "./assets/images/adaptive-icon.png",
34
- "backgroundColor": "#ffffff"
35
- },
36
- "package": `com.anonymous.x${projectId || '0'}`
37
- },
38
- "web": {
39
- "bundler": "metro",
40
- "output": "single",
41
- "favicon": "./assets/images/favicon.png"
42
- },
43
- "plugins": [
44
- process.env.EXPO_PUBLIC_BACKEND_BASE_URL ? [
45
- "expo-router",
46
- {
47
- "origin": process.env.EXPO_PUBLIC_BACKEND_BASE_URL
48
- }
49
- ] : 'expo-router',
50
- [
51
- "expo-splash-screen",
52
- {
53
- "image": "./assets/images/splash-icon.png",
54
- "imageWidth": 200,
55
- "resizeMode": "contain",
56
- "backgroundColor": "#ffffff"
57
- }
58
- ],
59
- [
60
- "expo-image-picker",
61
- {
62
- "photosPermission": `允许${appName}访问您的相册,以便您上传或保存图片。`,
63
- "cameraPermission": `允许${appName}使用您的相机,以便您直接拍摄照片上传。`,
64
- "microphonePermission": `允许${appName}访问您的麦克风,以便您拍摄带有声音的视频。`
65
- }
66
- ],
67
- [
68
- "expo-location",
69
- {
70
- "locationWhenInUsePermission": `${appName}需要访问您的位置以提供周边服务及导航功能。`
71
- }
72
- ],
73
- [
74
- "expo-camera",
75
- {
76
- "cameraPermission": `${appName}需要访问相机以拍摄照片和视频。`,
77
- "microphonePermission": `${appName}需要访问麦克风以录制视频声音。`,
78
- "recordAudioAndroid": true
79
- }
80
- ]
81
- ],
82
- "experiments": {
83
- "typedRoutes": true,
84
- ...(baseUrl ? { "baseUrl": baseUrl } : {})
85
- }
86
- }
87
- }
1
+ import { ExpoConfig, ConfigContext } from 'expo/config';
2
+
3
+ const appName = process.env.LICOS_PROJECT_NAME || process.env.EXPO_PUBLIC_LICOS_PROJECT_NAME || '应用';
4
+ const projectId = process.env.LICOS_PROJECT_ID || process.env.EXPO_PUBLIC_LICOS_PROJECT_ID;
5
+ const slugAppName = projectId ? `app${projectId}` : 'myapp';
6
+
7
+ const normalizeBaseUrl = (value?: string) => {
8
+ const trimmed = value?.trim();
9
+ if (!trimmed || trimmed === '/') {
10
+ return undefined;
11
+ }
12
+ return `/${trimmed.replace(/^\/+|\/+$/g, '')}`;
13
+ };
14
+
15
+ const baseUrl = normalizeBaseUrl(process.env.BASE_PATH || process.env.EXPO_PUBLIC_BASE_PATH);
16
+
17
+ export default ({ config }: ConfigContext): ExpoConfig => {
18
+ return {
19
+ ...config,
20
+ "name": appName,
21
+ "slug": slugAppName,
22
+ "version": "1.0.0",
23
+ "orientation": "portrait",
24
+ "icon": "./assets/images/icon.png",
25
+ "scheme": "myapp",
26
+ "userInterfaceStyle": "automatic",
27
+ "newArchEnabled": true,
28
+ "ios": {
29
+ "supportsTablet": true
30
+ },
31
+ "android": {
32
+ "adaptiveIcon": {
33
+ "foregroundImage": "./assets/images/adaptive-icon.png",
34
+ "backgroundColor": "#ffffff"
35
+ },
36
+ "package": `com.anonymous.x${projectId || '0'}`
37
+ },
38
+ "web": {
39
+ "bundler": "metro",
40
+ "output": "single",
41
+ "favicon": "./assets/images/favicon.png"
42
+ },
43
+ "plugins": [
44
+ process.env.EXPO_PUBLIC_BACKEND_BASE_URL ? [
45
+ "expo-router",
46
+ {
47
+ "origin": process.env.EXPO_PUBLIC_BACKEND_BASE_URL
48
+ }
49
+ ] : 'expo-router',
50
+ [
51
+ "expo-splash-screen",
52
+ {
53
+ "image": "./assets/images/splash-icon.png",
54
+ "imageWidth": 200,
55
+ "resizeMode": "contain",
56
+ "backgroundColor": "#ffffff"
57
+ }
58
+ ],
59
+ [
60
+ "expo-image-picker",
61
+ {
62
+ "photosPermission": `允许${appName}访问您的相册,以便您上传或保存图片。`,
63
+ "cameraPermission": `允许${appName}使用您的相机,以便您直接拍摄照片上传。`,
64
+ "microphonePermission": `允许${appName}访问您的麦克风,以便您拍摄带有声音的视频。`
65
+ }
66
+ ],
67
+ [
68
+ "expo-location",
69
+ {
70
+ "locationWhenInUsePermission": `${appName}需要访问您的位置以提供周边服务及导航功能。`
71
+ }
72
+ ],
73
+ [
74
+ "expo-camera",
75
+ {
76
+ "cameraPermission": `${appName}需要访问相机以拍摄照片和视频。`,
77
+ "microphonePermission": `${appName}需要访问麦克风以录制视频声音。`,
78
+ "recordAudioAndroid": true
79
+ }
80
+ ]
81
+ ],
82
+ "experiments": {
83
+ "typedRoutes": true,
84
+ ...(baseUrl ? { "baseUrl": baseUrl } : {})
85
+ }
86
+ }
87
+ }
@@ -6,7 +6,7 @@
6
6
  "dev": "bash .licosproj/scripts/dev_run.sh",
7
7
  "build": "bash .licosproj/scripts/prod_build.sh",
8
8
  "start": "bash .licosproj/scripts/prod_run.sh",
9
- "ensure:deps": "node -e \"const fs=require('fs'); const bins=['client/node_modules/.bin/expo','server/node_modules/.bin/tsx','server/node_modules/.bin/tsc']; process.exit(bins.every((p)=>fs.existsSync(p)||fs.existsSync(p+'.cmd'))?0:1)\" || pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only",
9
+ "ensure:deps": "node -e \"const fs=require('fs'); const bins=['client/node_modules/.bin/expo','server/node_modules/.bin/tsx','server/node_modules/.bin/tsc']; process.exit(bins.every((p)=>fs.existsSync(p)||fs.existsSync(p+'.cmd'))?0:1)\" || pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only",
10
10
  "prebuild": "pnpm run ensure:deps",
11
11
  "predev": "pnpm run ensure:deps",
12
12
  "preinstall": "node -e \"const ua=process.env.npm_config_user_agent||''; if(!ua.includes('pnpm')){console.error('Use pnpm to install dependencies.'); process.exit(1)}\"",
@@ -62,13 +62,10 @@ const config = {
62
62
  return;
63
63
  }
64
64
 
65
- const cmd = 'pnpm';
65
+ const cmd = 'bash';
66
66
  const args = [
67
- 'install',
68
- '--registry=https://registry.npmmirror.com',
69
- '--prefer-frozen-lockfile',
70
- '--prefer-offline',
71
- '--reporter=append-only',
67
+ '-lc',
68
+ 'pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only',
72
69
  ];
73
70
  console.log(
74
71
  `\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
@@ -104,7 +101,7 @@ const config = {
104
101
  console.log(` Log file: ${logFile}`);
105
102
  } catch (error) {
106
103
  console.error('✗ Failed to trigger pnpm install:', error);
107
- console.log(' You can manually run: pnpm install --registry=https://registry.npmmirror.com');
104
+ console.log(' You can manually run: pnpm install --registry=https://registry.npmmirror.com || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile');
108
105
  }
109
106
  },
110
107
  };
@@ -1,35 +1,35 @@
1
- import type { NextConfig } from 'next';
2
-
3
- function normalizeBasePath(value?: string): string | undefined {
4
- const trimmed = value?.trim();
5
- if (!trimmed || trimmed === '/') return undefined;
6
- return `/${trimmed.replace(/^\/+|\/+$/g, '')}`;
7
- }
8
-
9
- function isProdProjectEnv(value?: string): boolean {
10
- const normalized = value?.trim().toLowerCase();
11
- return normalized === 'prod' || normalized === 'production' || normalized === 'release';
12
- }
13
-
14
- const deployBasePath = process.env.BASE_PATH;
15
- const shouldUseBasePath = isProdProjectEnv(process.env.LICOS_PROJECT_ENV) && Boolean(deployBasePath);
16
-
17
- const basePath = shouldUseBasePath ? normalizeBasePath(deployBasePath) : undefined;
18
-
19
- const nextConfig: NextConfig = {
20
- ...(basePath ? { basePath } : {}),
21
- // outputFileTracingRoot: path.resolve(__dirname, '../../'), // Uncomment and add 'import path from "path"' if needed
22
- /* config options here */
23
- allowedDevOrigins: ['*.dev.licos.local'],
24
- images: {
25
- remotePatterns: [
26
- {
27
- protocol: 'https',
28
- hostname: '*',
29
- pathname: '/**',
30
- },
31
- ],
32
- },
33
- };
34
-
35
- export default nextConfig;
1
+ import type { NextConfig } from 'next';
2
+
3
+ function normalizeBasePath(value?: string): string | undefined {
4
+ const trimmed = value?.trim();
5
+ if (!trimmed || trimmed === '/') return undefined;
6
+ return `/${trimmed.replace(/^\/+|\/+$/g, '')}`;
7
+ }
8
+
9
+ function isProdProjectEnv(value?: string): boolean {
10
+ const normalized = value?.trim().toLowerCase();
11
+ return normalized === 'prod' || normalized === 'production' || normalized === 'release';
12
+ }
13
+
14
+ const deployBasePath = process.env.BASE_PATH;
15
+ const shouldUseBasePath = isProdProjectEnv(process.env.LICOS_PROJECT_ENV) && Boolean(deployBasePath);
16
+
17
+ const basePath = shouldUseBasePath ? normalizeBasePath(deployBasePath) : undefined;
18
+
19
+ const nextConfig: NextConfig = {
20
+ ...(basePath ? { basePath } : {}),
21
+ // outputFileTracingRoot: path.resolve(__dirname, '../../'), // Uncomment and add 'import path from "path"' if needed
22
+ /* config options here */
23
+ allowedDevOrigins: ['*.dev.licos.local'],
24
+ images: {
25
+ remotePatterns: [
26
+ {
27
+ protocol: 'https',
28
+ hostname: '*',
29
+ pathname: '/**',
30
+ },
31
+ ],
32
+ },
33
+ };
34
+
35
+ export default nextConfig;
@@ -5,7 +5,7 @@
5
5
  "scripts": {
6
6
  "build": "bash ./scripts/build.sh",
7
7
  "dev": "bash ./scripts/dev.sh",
8
- "ensure:deps": "node -e \"const fs=require('fs'); const bins=['node_modules/.bin/next','node_modules/.bin/tsx','node_modules/.bin/tsup','node_modules/.bin/eslint','node_modules/.bin/tsc']; process.exit(bins.every((p)=>fs.existsSync(p)||fs.existsSync(p+'.cmd'))?0:1)\" || pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only",
8
+ "ensure:deps": "node -e \"const fs=require('fs'); const bins=['node_modules/.bin/next','node_modules/.bin/tsx','node_modules/.bin/tsup','node_modules/.bin/eslint','node_modules/.bin/tsc']; process.exit(bins.every((p)=>fs.existsSync(p)||fs.existsSync(p+'.cmd'))?0:1)\" || pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only",
9
9
  "prebuild": "pnpm run ensure:deps",
10
10
  "predev": "pnpm run ensure:deps",
11
11
  "preinstall": "node -e \"const ua=process.env.npm_config_user_agent||''; if(!ua.includes('pnpm')){console.error('Use pnpm to install dependencies.'); process.exit(1)}\"",