@coze-arch/cli 0.0.1-alpha.ecba20 → 0.0.1-alpha.ecccee

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 (114) hide show
  1. package/lib/__templates__/expo/.coze +1 -1
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +19 -82
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +78 -88
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
  6. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  7. package/lib/__templates__/expo/README.md +26 -16
  8. package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
  9. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  10. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  11. package/lib/__templates__/expo/client/app.config.ts +65 -60
  12. package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
  13. package/lib/__templates__/expo/client/components/ThemedView.tsx +1 -2
  14. package/lib/__templates__/expo/client/constants/theme.ts +25 -698
  15. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  16. package/lib/__templates__/expo/client/eslint.config.mjs +33 -10
  17. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  18. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  19. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  20. package/lib/__templates__/expo/client/package.json +36 -33
  21. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  22. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  23. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  24. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  25. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  26. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  27. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  28. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  29. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  30. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  31. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  32. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  33. package/lib/__templates__/expo/package.json +3 -0
  34. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  35. package/lib/__templates__/expo/pnpm-lock.yaml +1346 -2612
  36. package/lib/__templates__/expo/server/build.js +21 -0
  37. package/lib/__templates__/expo/server/package.json +11 -7
  38. package/lib/__templates__/expo/server/src/index.ts +10 -2
  39. package/lib/__templates__/expo/template.config.js +57 -0
  40. package/lib/__templates__/nextjs/.coze +1 -0
  41. package/lib/__templates__/nextjs/_npmrc +1 -0
  42. package/lib/__templates__/nextjs/next.config.ts +11 -0
  43. package/lib/__templates__/nextjs/package.json +10 -2
  44. package/lib/__templates__/nextjs/pnpm-lock.yaml +1686 -1810
  45. package/lib/__templates__/nextjs/scripts/dev.sh +1 -1
  46. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  47. package/lib/__templates__/nextjs/src/app/globals.css +10 -2
  48. package/lib/__templates__/nextjs/src/app/layout.tsx +1 -14
  49. package/lib/__templates__/nextjs/src/app/page.tsx +18 -48
  50. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  51. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  52. package/lib/__templates__/nextjs/template.config.js +67 -2
  53. package/lib/__templates__/taro/.coze +14 -0
  54. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  55. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  56. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  57. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  58. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  59. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +1 -0
  60. package/lib/__templates__/taro/README.md +749 -0
  61. package/lib/__templates__/taro/_gitignore +40 -0
  62. package/lib/__templates__/taro/_npmrc +18 -0
  63. package/lib/__templates__/taro/babel.config.js +12 -0
  64. package/lib/__templates__/taro/config/dev.ts +9 -0
  65. package/lib/__templates__/taro/config/index.ts +173 -0
  66. package/lib/__templates__/taro/config/prod.ts +35 -0
  67. package/lib/__templates__/taro/eslint.config.mjs +57 -0
  68. package/lib/__templates__/taro/key/private.appid.key +0 -0
  69. package/lib/__templates__/taro/package.json +97 -0
  70. package/lib/__templates__/taro/pnpm-lock.yaml +22708 -0
  71. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  72. package/lib/__templates__/taro/project.config.json +15 -0
  73. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  74. package/lib/__templates__/taro/server/package.json +41 -0
  75. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  76. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  77. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  78. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  79. package/lib/__templates__/taro/server/src/main.ts +49 -0
  80. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  81. package/lib/__templates__/taro/src/app.config.ts +11 -0
  82. package/lib/__templates__/taro/src/app.css +52 -0
  83. package/lib/__templates__/taro/src/app.tsx +9 -0
  84. package/lib/__templates__/taro/src/index.html +39 -0
  85. package/lib/__templates__/taro/src/network.ts +39 -0
  86. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  87. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  88. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  89. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +171 -0
  90. package/lib/__templates__/taro/src/presets/h5-styles.ts +33 -0
  91. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  92. package/lib/__templates__/taro/src/presets/wx-debug.ts +23 -0
  93. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  94. package/lib/__templates__/taro/template.config.js +68 -0
  95. package/lib/__templates__/taro/tsconfig.json +29 -0
  96. package/lib/__templates__/taro/types/global.d.ts +32 -0
  97. package/lib/__templates__/templates.json +88 -65
  98. package/lib/__templates__/vite/.coze +1 -0
  99. package/lib/__templates__/vite/_npmrc +1 -0
  100. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  101. package/lib/__templates__/vite/package.json +14 -1
  102. package/lib/__templates__/vite/pnpm-lock.yaml +1581 -105
  103. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  104. package/lib/__templates__/vite/src/main.ts +17 -48
  105. package/lib/__templates__/vite/template.config.js +67 -6
  106. package/lib/cli.js +864 -139
  107. package/package.json +1 -1
  108. package/lib/__templates__/expo/client/app/index.ts +0 -1
  109. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
  110. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -50
  111. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
  112. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  113. package/lib/__templates__/nextjs/server.mjs +0 -50
  114. package/lib/__templates__/vite/.vscode/settings.json +0 -7
@@ -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
+ }
@@ -3,28 +3,32 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "scripts": {
6
+ "build": "node build.js",
7
+ "dev": "bash ../.cozeproj/scripts/server_dev_run.sh",
6
8
  "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",
9
9
  "start": "NODE_ENV=production PORT=${PORT:-5000} node dist/index.js"
10
10
  },
11
11
  "dependencies": {
12
- "express": "^4.22.1",
13
- "coze-coding-dev-sdk": "^0.5.5",
12
+ "@supabase/supabase-js": "2.95.3",
13
+ "cors": "^2.8.5",
14
+ "coze-coding-dev-sdk": "^0.7.16",
14
15
  "dayjs": "^1.11.19",
16
+ "dotenv": "^17.2.3",
15
17
  "drizzle-orm": "^0.45.1",
16
18
  "drizzle-zod": "^0.8.3",
19
+ "express": "^4.22.1",
17
20
  "multer": "^2.0.2",
18
21
  "pg": "^8.16.3",
19
22
  "zod": "^4.2.1"
20
23
  },
21
24
  "devDependencies": {
25
+ "@types/cors": "^2.8.19",
22
26
  "@types/express": "^5.0.6",
23
- "tsx": "^4.21.0",
24
27
  "@types/multer": "^2.0.0",
25
28
  "@types/pg": "^8.16.0",
29
+ "drizzle-kit": "^0.31.8",
26
30
  "esbuild": "0.27.2",
27
- "typescript": "^5.8.3",
28
- "drizzle-kit": "^0.31.8"
31
+ "tsx": "^4.21.0",
32
+ "typescript": "^5.8.3"
29
33
  }
30
34
  }
@@ -1,12 +1,20 @@
1
1
  import express from "express";
2
+ import cors from "cors";
2
3
 
3
4
  const app = express();
4
5
  const port = process.env.PORT || 9091;
5
6
 
6
- app.get('/api/v1/ping', (req, res) => {
7
- res.status(200).json({ message: 'connected' });
7
+ // Middleware
8
+ app.use(cors());
9
+ app.use(express.json({ limit: '50mb' }));
10
+ app.use(express.urlencoded({ limit: '50mb', extended: true }));
11
+
12
+ app.get('/api/v1/health', (req, res) => {
13
+ console.log('Health check success');
14
+ res.status(200).json({ status: 'ok' });
8
15
  });
9
16
 
17
+
10
18
  app.listen(port, () => {
11
19
  console.log(`Server listening at http://localhost:${port}/`);
12
20
  });
@@ -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
 
@@ -29,6 +32,7 @@ export const paramsSchema = {
29
32
  };
30
33
 
31
34
  const config = {
35
+ description: 'Expo template for React Native applications',
32
36
  paramsSchema,
33
37
  defaultParams: {
34
38
  port: 9090,
@@ -44,6 +48,59 @@ const config = {
44
48
  console.log(` - Framework: Expo`);
45
49
  console.log(` - Port: ${context.port}`);
46
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
+ },
47
104
  };
48
105
 
49
106
  export default config;
@@ -2,6 +2,7 @@
2
2
  requires = ["nodejs-24"]
3
3
 
4
4
  [dev]
5
+ build = ["bash", "./scripts/prepare.sh"]
5
6
  run = ["bash", "./scripts/dev.sh"]
6
7
  deps = ["git"] # -> apt install git
7
8
 
@@ -1,3 +1,4 @@
1
+ loglevel=error
1
2
  registry=https://registry.npmmirror.com
2
3
 
3
4
  strictStorePkgContentCheck=false
@@ -1,8 +1,19 @@
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'],
8
+ images: {
9
+ remotePatterns: [
10
+ {
11
+ protocol: 'https',
12
+ hostname: 'lf-coze-web-cdn.coze.cn',
13
+ pathname: '/**',
14
+ },
15
+ ],
16
+ },
6
17
  };
7
18
 
8
19
  export default nextConfig;
@@ -7,7 +7,8 @@
7
7
  "dev": "bash ./scripts/dev.sh",
8
8
  "preinstall": "npx only-allow pnpm",
9
9
  "lint": "eslint",
10
- "start": "bash ./scripts/start.sh"
10
+ "start": "bash ./scripts/start.sh",
11
+ "ts-check": "tsc -p tsconfig.json"
11
12
  },
12
13
  "dependencies": {
13
14
  "@aws-sdk/client-s3": "^3.958.0",
@@ -39,11 +40,13 @@
39
40
  "@radix-ui/react-toggle": "^1.1.10",
40
41
  "@radix-ui/react-toggle-group": "^1.1.11",
41
42
  "@radix-ui/react-tooltip": "^1.2.8",
43
+ "@supabase/supabase-js": "2.95.3",
42
44
  "class-variance-authority": "^0.7.1",
43
45
  "clsx": "^2.1.1",
44
46
  "cmdk": "^1.1.1",
45
- "coze-coding-dev-sdk": "^0.5.2",
47
+ "coze-coding-dev-sdk": "^0.7.16",
46
48
  "date-fns": "^4.1.0",
49
+ "dotenv": "^17.2.3",
47
50
  "drizzle-kit": "^0.31.8",
48
51
  "drizzle-orm": "^0.45.1",
49
52
  "drizzle-zod": "^0.8.3",
@@ -84,5 +87,10 @@
84
87
  "packageManager": "pnpm@9.0.0",
85
88
  "engines": {
86
89
  "pnpm": ">=9.0.0"
90
+ },
91
+ "pnpm": {
92
+ "overrides": {
93
+ "esbuild": "^0.25.12"
94
+ }
87
95
  }
88
96
  }