@coze-arch/cli 0.0.1-alpha.26f31a → 0.0.1-alpha.285680

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 (98) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +30 -21
  2. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  3. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
  4. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  5. package/lib/__templates__/expo/README.md +4 -2
  6. package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
  7. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  8. package/lib/__templates__/expo/client/app/index.tsx +1 -1
  9. package/lib/__templates__/expo/client/app.config.ts +4 -3
  10. package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
  11. package/lib/__templates__/expo/client/components/ThemedView.tsx +1 -2
  12. package/lib/__templates__/expo/client/constants/theme.ts +23 -700
  13. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  14. package/lib/__templates__/expo/client/eslint.config.mjs +33 -10
  15. package/lib/__templates__/expo/client/hooks/{useColorScheme.ts → useColorScheme.tsx} +20 -6
  16. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  17. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  18. package/lib/__templates__/expo/client/package.json +36 -34
  19. package/lib/__templates__/expo/client/screens/{home → demo}/index.tsx +7 -3
  20. package/lib/__templates__/expo/client/screens/{home → demo}/styles.ts +10 -6
  21. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  22. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  23. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  24. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  25. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  26. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  27. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  28. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  29. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  30. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  31. package/lib/__templates__/expo/package.json +3 -0
  32. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  33. package/lib/__templates__/expo/pnpm-lock.yaml +1270 -2614
  34. package/lib/__templates__/expo/server/build.js +21 -0
  35. package/lib/__templates__/expo/server/package.json +4 -3
  36. package/lib/__templates__/expo/server/src/index.ts +3 -1
  37. package/lib/__templates__/expo/template.config.js +56 -0
  38. package/lib/__templates__/nextjs/.babelrc +15 -0
  39. package/lib/__templates__/nextjs/_npmrc +1 -0
  40. package/lib/__templates__/nextjs/next.config.ts +3 -1
  41. package/lib/__templates__/nextjs/package.json +9 -1
  42. package/lib/__templates__/nextjs/pnpm-lock.yaml +2606 -1723
  43. package/lib/__templates__/nextjs/src/app/globals.css +10 -2
  44. package/lib/__templates__/nextjs/src/app/layout.tsx +5 -14
  45. package/lib/__templates__/nextjs/src/app/page.tsx +17 -46
  46. package/lib/__templates__/nextjs/template.config.js +52 -11
  47. package/lib/__templates__/taro/.coze +14 -0
  48. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  49. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +13 -0
  50. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +17 -0
  51. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +58 -0
  52. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  53. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +1 -0
  54. package/lib/__templates__/taro/README.md +687 -0
  55. package/lib/__templates__/taro/_gitignore +40 -0
  56. package/lib/__templates__/taro/_npmrc +18 -0
  57. package/lib/__templates__/taro/babel.config.js +12 -0
  58. package/lib/__templates__/taro/config/dev.ts +9 -0
  59. package/lib/__templates__/taro/config/index.ts +173 -0
  60. package/lib/__templates__/taro/config/prod.ts +35 -0
  61. package/lib/__templates__/taro/eslint.config.mjs +57 -0
  62. package/lib/__templates__/taro/key/private.appid.key +0 -0
  63. package/lib/__templates__/taro/package.json +95 -0
  64. package/lib/__templates__/taro/pnpm-lock.yaml +22430 -0
  65. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  66. package/lib/__templates__/taro/project.config.json +15 -0
  67. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  68. package/lib/__templates__/taro/server/package.json +38 -0
  69. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  70. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  71. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  72. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  73. package/lib/__templates__/taro/server/src/main.ts +37 -0
  74. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  75. package/lib/__templates__/taro/src/app.config.ts +11 -0
  76. package/lib/__templates__/taro/src/app.css +52 -0
  77. package/lib/__templates__/taro/src/app.ts +14 -0
  78. package/lib/__templates__/taro/src/index.html +20 -0
  79. package/lib/__templates__/taro/src/network.ts +39 -0
  80. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  81. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  82. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  83. package/lib/__templates__/taro/src/utils/h5-styles.ts +22 -0
  84. package/lib/__templates__/taro/src/utils/wx-debug.ts +23 -0
  85. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  86. package/lib/__templates__/taro/template.config.js +68 -0
  87. package/lib/__templates__/taro/tsconfig.json +29 -0
  88. package/lib/__templates__/taro/types/global.d.ts +32 -0
  89. package/lib/__templates__/templates.json +32 -0
  90. package/lib/__templates__/vite/_npmrc +1 -0
  91. package/lib/__templates__/vite/package.json +7 -1
  92. package/lib/__templates__/vite/pnpm-lock.yaml +2328 -180
  93. package/lib/__templates__/vite/src/main.ts +17 -48
  94. package/lib/__templates__/vite/template.config.js +63 -6
  95. package/lib/cli.js +902 -123
  96. package/package.json +1 -1
  97. package/lib/__templates__/expo/client/app/home.tsx +0 -1
  98. package/lib/__templates__/expo/client/assets/images/coze-logo.png +0 -0
@@ -0,0 +1,21 @@
1
+ import * as esbuild from 'esbuild';
2
+ import { createRequire } from 'module';
3
+
4
+ const require = createRequire(import.meta.url);
5
+ const pkg = require('./package.json');
6
+ const dependencies = pkg.dependencies || {};
7
+ const externalList = Object.keys(dependencies).filter(dep => dep !== 'dayjs');
8
+ try {
9
+ await esbuild.build({
10
+ entryPoints: ['src/index.ts'],
11
+ bundle: true,
12
+ platform: 'node',
13
+ format: 'esm',
14
+ outdir: 'dist',
15
+ external: externalList,
16
+ });
17
+ console.log('⚡ Build complete!');
18
+ } catch (e) {
19
+ console.error(e);
20
+ process.exit(1);
21
+ }
@@ -4,14 +4,14 @@
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "preinstall": "npx only-allow pnpm",
7
- "dev": "NODE_ENV=development tsx ./src/index.ts",
8
- "build": "pnpm exec esbuild src/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist",
7
+ "dev": "bash ../.cozeproj/scripts/server_dev_run.sh",
8
+ "build": "node build.js",
9
9
  "start": "NODE_ENV=production PORT=${PORT:-5000} node dist/index.js"
10
10
  },
11
11
  "dependencies": {
12
12
  "express": "^4.22.1",
13
13
  "cors": "^2.8.5",
14
- "coze-coding-dev-sdk": "^0.5.5",
14
+ "coze-coding-dev-sdk": "^0.7.10",
15
15
  "dayjs": "^1.11.19",
16
16
  "drizzle-orm": "^0.45.1",
17
17
  "drizzle-zod": "^0.8.3",
@@ -20,6 +20,7 @@
20
20
  "zod": "^4.2.1"
21
21
  },
22
22
  "devDependencies": {
23
+ "@types/cors": "^2.8.19",
23
24
  "@types/express": "^5.0.6",
24
25
  "tsx": "^4.21.0",
25
26
  "@types/multer": "^2.0.0",
@@ -6,9 +6,11 @@ const port = process.env.PORT || 9091;
6
6
 
7
7
  // Middleware
8
8
  app.use(cors());
9
- app.use(express.json());
9
+ app.use(express.json({ limit: '50mb' }));
10
+ app.use(express.urlencoded({ limit: '50mb', extended: true }));
10
11
 
11
12
  app.get('/api/v1/health', (req, res) => {
13
+ console.log('Health check success');
12
14
  res.status(200).json({ status: 'ok' });
13
15
  });
14
16
 
@@ -1,5 +1,8 @@
1
1
 
2
2
 
3
+ import { spawn } from 'child_process';
4
+ import { resolve, join, basename } from 'path';
5
+ import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
3
6
 
4
7
 
5
8
 
@@ -45,6 +48,59 @@ const config = {
45
48
  console.log(` - Framework: Expo`);
46
49
  console.log(` - Port: ${context.port}`);
47
50
  },
51
+ onComplete: async (_context, outputPath) => {
52
+ // Skip pnpm update in test environment to avoid monorepo workspace issues
53
+ if (process.env.NODE_ENV === 'test') {
54
+ console.log('⊘ Skipping dependency update in test environment');
55
+ return;
56
+ }
57
+
58
+ const cmd = 'pnpm';
59
+ const args = ['-r', 'up', 'coze-coding-dev-sdk@^0.7.0'];
60
+ console.log(
61
+ `\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
62
+ );
63
+
64
+ try {
65
+ const projectRoot = resolve(outputPath);
66
+
67
+ // Determine log directory
68
+ const logDir = process.env.COZE_LOG_DIR || resolve(__dirname, '../.log');
69
+ mkdirSync(logDir, { recursive: true });
70
+
71
+ // Use project name in log file to avoid conflicts
72
+ const projectName = basename(projectRoot);
73
+ const logFile = join(logDir, `${projectName}-init.log`);
74
+
75
+ // Write log header
76
+ const timestamp = new Date().toISOString();
77
+ appendFileSync(
78
+ logFile,
79
+ `\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
80
+ );
81
+
82
+ // Open log file for appending
83
+ const logFd = openSync(logFile, 'a');
84
+
85
+ // Spawn in detached mode
86
+ const child = spawn(cmd, args, {
87
+ cwd: projectRoot,
88
+ detached: true,
89
+ stdio: ['ignore', logFd, logFd],
90
+ });
91
+
92
+ child.unref();
93
+ closeSync(logFd);
94
+
95
+ console.log(
96
+ '✓ coze-coding-dev-sdk update triggered (running in background)',
97
+ );
98
+ console.log(` Log file: ${logFile}`);
99
+ } catch (error) {
100
+ console.error('✗ Failed to trigger coze-coding-dev-sdk update:', error);
101
+ console.log(' You can manually run: pnpm update coze-coding-dev-sdk');
102
+ }
103
+ },
48
104
  };
49
105
 
50
106
  export default config;
@@ -0,0 +1,15 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "next/babel",
5
+ {
6
+ "preset-react": {
7
+ "development": true
8
+ }
9
+ }
10
+ ]
11
+ ],
12
+ "plugins": [
13
+ "@react-dev-inspector/babel-plugin"
14
+ ]
15
+ }
@@ -1,3 +1,4 @@
1
+ loglevel=error
1
2
  registry=https://registry.npmmirror.com
2
3
 
3
4
  strictStorePkgContentCheck=false
@@ -1,13 +1,15 @@
1
1
  import type { NextConfig } from 'next';
2
+ import path from 'path';
2
3
 
3
4
  const nextConfig: NextConfig = {
5
+ // outputFileTracingRoot: path.resolve(__dirname, '../../'),
4
6
  /* config options here */
5
7
  allowedDevOrigins: ['*.dev.coze.site'],
6
8
  images: {
7
9
  remotePatterns: [
8
10
  {
9
11
  protocol: 'https',
10
- hostname: 'lf3-static.bytednsdoc.com',
12
+ hostname: 'lf-coze-web-cdn.coze.cn',
11
13
  pathname: '/**',
12
14
  },
13
15
  ],
@@ -43,7 +43,7 @@
43
43
  "class-variance-authority": "^0.7.1",
44
44
  "clsx": "^2.1.1",
45
45
  "cmdk": "^1.1.1",
46
- "coze-coding-dev-sdk": "^0.5.2",
46
+ "coze-coding-dev-sdk": "^0.7.3",
47
47
  "date-fns": "^4.1.0",
48
48
  "drizzle-kit": "^0.31.8",
49
49
  "drizzle-orm": "^0.45.1",
@@ -67,6 +67,8 @@
67
67
  "zod": "^4.3.5"
68
68
  },
69
69
  "devDependencies": {
70
+ "@react-dev-inspector/babel-plugin": "^2.0.1",
71
+ "@react-dev-inspector/middleware": "^2.0.1",
70
72
  "@tailwindcss/postcss": "^4",
71
73
  "@types/node": "^20",
72
74
  "@types/pg": "^8.16.0",
@@ -75,6 +77,7 @@
75
77
  "eslint": "^9",
76
78
  "eslint-config-next": "16.1.1",
77
79
  "only-allow": "^1.2.2",
80
+ "react-dev-inspector": "^2.0.1",
78
81
  "shadcn": "latest",
79
82
  "tailwindcss": "^4",
80
83
  "typescript": "^5"
@@ -82,5 +85,10 @@
82
85
  "packageManager": "pnpm@9.0.0",
83
86
  "engines": {
84
87
  "pnpm": ">=9.0.0"
88
+ },
89
+ "pnpm": {
90
+ "overrides": {
91
+ "esbuild": "^0.25.12"
92
+ }
85
93
  }
86
94
  }