@coze-arch/cli 0.0.1-alpha.f9be02 → 0.0.1-alpha.ff64d9
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/.coze +1 -1
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +19 -82
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +62 -81
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +45 -0
- package/lib/__templates__/expo/README.md +66 -7
- package/lib/__templates__/expo/client/app/_layout.tsx +33 -0
- package/lib/__templates__/expo/client/app/demo.tsx +1 -0
- package/lib/__templates__/expo/client/app/index.tsx +1 -0
- package/lib/__templates__/expo/client/app.config.ts +64 -60
- package/lib/__templates__/expo/client/{src/constants → constants}/theme.ts +22 -18
- package/lib/__templates__/expo/client/declarations.d.ts +5 -0
- package/lib/__templates__/expo/client/hooks/useColorScheme.ts +34 -0
- package/lib/__templates__/expo/client/package.json +3 -2
- package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
- package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
- package/lib/__templates__/expo/client/tsconfig.json +1 -1
- package/lib/__templates__/expo/package.json +4 -98
- package/lib/__templates__/expo/pnpm-lock.yaml +376 -577
- package/lib/__templates__/expo/server/package.json +18 -3
- package/lib/__templates__/expo/server/src/index.ts +8 -2
- package/lib/__templates__/expo/server/tsconfig.json +24 -0
- package/lib/__templates__/expo/template.config.js +1 -0
- package/lib/__templates__/nextjs/.coze +1 -0
- package/lib/__templates__/nextjs/_npmrc +1 -0
- package/lib/__templates__/nextjs/next.config.ts +12 -0
- package/lib/__templates__/nextjs/package.json +3 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +13 -5
- package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
- package/lib/__templates__/nextjs/src/app/globals.css +10 -2
- package/lib/__templates__/nextjs/src/app/layout.tsx +1 -12
- package/lib/__templates__/nextjs/src/app/page.tsx +35 -23
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
- package/lib/__templates__/nextjs/template.config.js +30 -0
- package/lib/__templates__/templates.json +61 -43
- package/lib/__templates__/vite/.coze +1 -0
- package/lib/__templates__/vite/_npmrc +1 -0
- package/lib/__templates__/vite/eslint.config.mjs +9 -0
- package/lib/__templates__/vite/package.json +5 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +3481 -14
- package/lib/__templates__/vite/scripts/prepare.sh +9 -0
- package/lib/__templates__/vite/src/main.ts +1 -2
- package/lib/__templates__/vite/template.config.js +28 -4
- package/lib/cli.js +201 -57
- package/package.json +5 -3
- package/lib/__templates__/expo/client/src/app/_layout.tsx +0 -33
- package/lib/__templates__/expo/client/src/app/index.ts +0 -1
- package/lib/__templates__/expo/client/src/hooks/useColorScheme.ts +0 -1
- package/lib/__templates__/expo/client/src/screens/home/index.tsx +0 -50
- package/lib/__templates__/expo/client/src/screens/home/styles.ts +0 -60
- package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
- package/lib/__templates__/vite/.vscode/settings.json +0 -7
- /package/lib/__templates__/expo/client/{src/assets → assets}/fonts/SpaceMono-Regular.ttf +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/adaptive-icon.png +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/default-avatar.png +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/favicon.png +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/icon.png +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/partial-react-logo.png +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/react-logo.png +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/react-logo@2x.png +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/react-logo@3x.png +0 -0
- /package/lib/__templates__/expo/client/{src/assets → assets}/images/splash-icon.png +0 -0
- /package/lib/__templates__/expo/client/{src/components → components}/Screen.tsx +0 -0
- /package/lib/__templates__/expo/client/{src/components → components}/SmartDateInput.tsx +0 -0
- /package/lib/__templates__/expo/client/{src/components → components}/ThemedText.tsx +0 -0
- /package/lib/__templates__/expo/client/{src/components → components}/ThemedView.tsx +0 -0
- /package/lib/__templates__/expo/client/{src/contexts → contexts}/AuthContext.tsx +0 -0
- /package/lib/__templates__/expo/client/{src/hooks → hooks}/useTheme.ts +0 -0
- /package/lib/__templates__/expo/client/{src/utils → utils}/index.ts +0 -0
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import { resolve } from 'path';
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
|
|
11
|
+
const description = `Next.js(复杂项目):\`coze init \${COZE_WORKSPACE_PATH} --template nextjs\`
|
|
12
|
+
- 适用:全栈应用、复杂多页面等复杂项目
|
|
13
|
+
- 使用默认nextjs项目规范
|
|
14
|
+
- **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。
|
|
15
|
+
- **项目理解加速**:初始可以依赖项目下 \`package.json\` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。
|
|
16
|
+
- **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,\`shadcn/ui\`组件默认完整的预装在\`src/components/ui/\`目录下`;
|
|
17
|
+
|
|
9
18
|
export const paramsSchema = {
|
|
10
19
|
type: 'object',
|
|
11
20
|
properties: {
|
|
@@ -29,6 +38,7 @@ export const paramsSchema = {
|
|
|
29
38
|
};
|
|
30
39
|
|
|
31
40
|
const config = {
|
|
41
|
+
description: description,
|
|
32
42
|
paramsSchema,
|
|
33
43
|
|
|
34
44
|
// 显式定义默认参数,确保在渲染时可用
|
|
@@ -49,6 +59,26 @@ const config = {
|
|
|
49
59
|
console.log(' - TypeScript: enabled');
|
|
50
60
|
console.log(' - App Router: enabled');
|
|
51
61
|
console.log(` - Port: ${context.port}`);
|
|
62
|
+
|
|
63
|
+
// Skip pnpm add in test environment to avoid monorepo workspace issues
|
|
64
|
+
if (process.env.NODE_ENV === 'test') {
|
|
65
|
+
console.log('⊘ Skipping dependency update in test environment');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const cmd = `pnpm add coze-coding-dev-sdk@"^0.7.0"`;
|
|
70
|
+
console.log(`${cmd}`);
|
|
71
|
+
try {
|
|
72
|
+
const projectRoot = resolve(outputPath);
|
|
73
|
+
execSync(cmd, {
|
|
74
|
+
cwd: projectRoot,
|
|
75
|
+
stdio: 'inherit',
|
|
76
|
+
});
|
|
77
|
+
console.log('✓ coze-coding-dev-sdk updated successfully');
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error('✗ Failed to update coze-coding-dev-sdk:', error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
52
82
|
},
|
|
53
83
|
};
|
|
54
84
|
|
|
@@ -3,66 +3,84 @@
|
|
|
3
3
|
"templates": [
|
|
4
4
|
{
|
|
5
5
|
"name": "expo",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Expo template for React Native applications",
|
|
7
7
|
"location": "./expo",
|
|
8
8
|
"paramsSchema": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"appName": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1,
|
|
14
|
+
"pattern": "^[a-z0-9-]+$",
|
|
15
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
16
|
+
},
|
|
17
|
+
"port": {
|
|
18
|
+
"type": "number",
|
|
19
|
+
"default": 8081,
|
|
20
|
+
"minimum": 1024,
|
|
21
|
+
"maximum": 65535,
|
|
22
|
+
"description": "Metro bundler port"
|
|
23
|
+
}
|
|
13
24
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"description": "Metro bundler port",
|
|
17
|
-
"default": 8081,
|
|
18
|
-
"minimum": 1024,
|
|
19
|
-
"maximum": 65535
|
|
20
|
-
}
|
|
25
|
+
"required": [],
|
|
26
|
+
"additionalProperties": false
|
|
21
27
|
}
|
|
22
28
|
},
|
|
23
29
|
{
|
|
24
30
|
"name": "nextjs",
|
|
25
|
-
"description": "nextjs
|
|
31
|
+
"description": "Next.js(复杂项目):`coze init ${COZE_WORKSPACE_PATH} --template nextjs`\n- 适用:全栈应用、复杂多页面等复杂项目\n- 使用默认nextjs项目规范\n - **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。\n - **项目理解加速**:初始可以依赖项目下 `package.json` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。\n - **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,`shadcn/ui`组件默认完整的预装在`src/components/ui/`目录下",
|
|
26
32
|
"location": "./nextjs",
|
|
27
33
|
"paramsSchema": {
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"appName": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"minLength": 1,
|
|
39
|
+
"pattern": "^[a-z0-9-]+$",
|
|
40
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
41
|
+
},
|
|
42
|
+
"port": {
|
|
43
|
+
"type": "number",
|
|
44
|
+
"default": 5000,
|
|
45
|
+
"minimum": 1024,
|
|
46
|
+
"maximum": 65535,
|
|
47
|
+
"description": "Development server port (for Next.js dev server)"
|
|
48
|
+
}
|
|
32
49
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"description": "Development server port (for Next.js dev server)",
|
|
36
|
-
"default": 5000,
|
|
37
|
-
"minimum": 1024,
|
|
38
|
-
"maximum": 65535
|
|
39
|
-
}
|
|
50
|
+
"required": [],
|
|
51
|
+
"additionalProperties": false
|
|
40
52
|
}
|
|
41
53
|
},
|
|
42
54
|
{
|
|
43
55
|
"name": "vite",
|
|
44
|
-
"description": "vite
|
|
56
|
+
"description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
|
|
45
57
|
"location": "./vite",
|
|
46
58
|
"paramsSchema": {
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"appName": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"minLength": 1,
|
|
64
|
+
"pattern": "^[a-z0-9-]+$",
|
|
65
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
66
|
+
},
|
|
67
|
+
"port": {
|
|
68
|
+
"type": "number",
|
|
69
|
+
"default": 5000,
|
|
70
|
+
"minimum": 1024,
|
|
71
|
+
"maximum": 65535,
|
|
72
|
+
"description": "Development server port"
|
|
73
|
+
},
|
|
74
|
+
"hmrPort": {
|
|
75
|
+
"type": "number",
|
|
76
|
+
"default": 6000,
|
|
77
|
+
"minimum": 1024,
|
|
78
|
+
"maximum": 65535,
|
|
79
|
+
"description": "Development HMR server port"
|
|
80
|
+
}
|
|
51
81
|
},
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"description": "Development server port",
|
|
55
|
-
"default": 5000,
|
|
56
|
-
"minimum": 1024,
|
|
57
|
-
"maximum": 65535
|
|
58
|
-
},
|
|
59
|
-
"hmrPort": {
|
|
60
|
-
"type": "number",
|
|
61
|
-
"description": "Development HMR server port",
|
|
62
|
-
"default": 6000,
|
|
63
|
-
"minimum": 1024,
|
|
64
|
-
"maximum": 65535
|
|
65
|
-
}
|
|
82
|
+
"required": [],
|
|
83
|
+
"additionalProperties": false
|
|
66
84
|
}
|
|
67
85
|
}
|
|
68
86
|
]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
4
|
+
|
|
5
|
+
export default defineConfig([
|
|
6
|
+
eslint.configs.recommended,
|
|
7
|
+
...tseslint.configs.recommended,
|
|
8
|
+
globalIgnores(['dist/**', 'node_modules/**']),
|
|
9
|
+
]);
|
|
@@ -7,14 +7,18 @@
|
|
|
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
|
"devDependencies": {
|
|
13
14
|
"autoprefixer": "^10.4.20",
|
|
15
|
+
"coze-coding-dev-sdk": "^0.7.0",
|
|
16
|
+
"eslint": "^9",
|
|
14
17
|
"only-allow": "^1.2.2",
|
|
15
18
|
"postcss": "^8.4.49",
|
|
16
19
|
"tailwindcss": "^3.4.17",
|
|
17
20
|
"typescript": "^5.6.0",
|
|
21
|
+
"typescript-eslint": "^8",
|
|
18
22
|
"vite": "^7.2.4"
|
|
19
23
|
},
|
|
20
24
|
"packageManager": "pnpm@9.0.0",
|