@coze-arch/cli 0.1.5 → 0.1.8-alpha.2ee669
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/README.md +18 -0
- package/docs/deploy.md +12 -1
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +3 -3
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +11 -3
- package/lib/__templates__/expo/.cozeproj/scripts/prepare-node-modules.sh +380 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +3 -3
- package/lib/__templates__/expo/client/components/Screen.tsx +65 -25
- package/lib/__templates__/expo/client/heroui/components/toast/toast.tsx +6 -2
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-controllable-state.ts +1 -1
- package/lib/__templates__/native-static/.coze +2 -2
- package/lib/__templates__/nextjs/.coze +1 -1
- package/lib/__templates__/nextjs/README.md +18 -0
- package/lib/__templates__/nextjs/eslint.config.mjs +11 -5
- package/lib/__templates__/nextjs/next.config.ts +10 -0
- package/lib/__templates__/nextjs/package.json +2 -5
- package/lib/__templates__/nextjs/pnpm-lock.yaml +14 -945
- package/lib/__templates__/nextjs/scripts/build.ps1 +1 -1
- package/lib/__templates__/nextjs/scripts/build.sh +1 -1
- package/lib/__templates__/nextjs/scripts/dev.ps1 +2 -2
- package/lib/__templates__/nextjs/scripts/dev.sh +70 -12
- package/lib/__templates__/nextjs/scripts/local-workspace.cjs +302 -0
- package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +380 -0
- package/lib/__templates__/nextjs/scripts/prepare.sh +9 -4
- package/lib/__templates__/nextjs/scripts/validate.sh +11 -1
- package/lib/__templates__/nextjs/src/app/layout.tsx +0 -4
- package/lib/__templates__/nextjs/src/server.ts +1 -1
- package/lib/__templates__/nextjs/template.config.js +20 -6
- package/lib/__templates__/nextjs/tsconfig.json +0 -1
- package/lib/__templates__/nuxt-vue/.coze +1 -1
- package/lib/__templates__/nuxt-vue/README.md +20 -2
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +21 -7
- package/lib/__templates__/nuxt-vue/scripts/local-workspace.cjs +302 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare-node-modules.sh +380 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +9 -4
- package/lib/__templates__/nuxt-vue/scripts/validate.sh +11 -1
- package/lib/__templates__/taro/.coze +2 -2
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +10 -1
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +4 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +12 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.ps1 +4 -2
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +84 -10
- package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +4 -0
- package/lib/__templates__/taro/.cozeproj/scripts/local-workspace.cjs +351 -0
- package/lib/__templates__/taro/.cozeproj/scripts/pack.ps1 +3 -1
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -6
- package/lib/__templates__/taro/.cozeproj/scripts/prepare-node-modules.sh +380 -0
- package/lib/__templates__/taro/.cozeproj/scripts/taro-build.cjs +66 -0
- package/lib/__templates__/taro/.cozeproj/scripts/validate.ps1 +3 -1
- package/lib/__templates__/taro/.cozeproj/scripts/validate.sh +7 -0
- package/lib/__templates__/taro/_gitignore +1 -0
- package/lib/__templates__/taro/package.json +5 -5
- package/lib/__templates__/vite/.coze +1 -1
- package/lib/__templates__/vite/README.md +20 -0
- package/lib/__templates__/vite/scripts/dev.ps1 +2 -2
- package/lib/__templates__/vite/scripts/dev.sh +21 -7
- package/lib/__templates__/vite/scripts/local-workspace.cjs +302 -0
- package/lib/__templates__/vite/scripts/prepare-node-modules.sh +380 -0
- package/lib/__templates__/vite/scripts/prepare.sh +9 -4
- package/lib/__templates__/vite/scripts/validate.sh +7 -1
- package/lib/__templates__/vite/template.config.js +20 -6
- package/lib/cli.js +511 -199
- package/package.json +3 -2
- package/lib/__templates__/nextjs/.babelrc +0 -15
package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-controllable-state.ts
CHANGED
|
@@ -108,7 +108,7 @@ function useUncontrolledState<T>({
|
|
|
108
108
|
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
109
109
|
* prop or avoid re-executing effects when passed as a dependency
|
|
110
110
|
*/
|
|
111
|
-
function useCallbackRef<T extends (...args:
|
|
111
|
+
function useCallbackRef<T extends (...args: never[]) => unknown>(
|
|
112
112
|
callback: T | undefined
|
|
113
113
|
): T {
|
|
114
114
|
const callbackRef = useRef(callback);
|
|
@@ -5,10 +5,10 @@ project_type = "web"
|
|
|
5
5
|
|
|
6
6
|
[dev]
|
|
7
7
|
build = []
|
|
8
|
-
run = ["
|
|
8
|
+
run = [ "sh", "-c", "exec python3 -m http.server ${DEPLOY_RUN_PORT} --bind 0.0.0.0" ]
|
|
9
9
|
run_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/serve.ps1"]
|
|
10
10
|
|
|
11
11
|
[deploy]
|
|
12
12
|
build = []
|
|
13
|
-
run = ["
|
|
13
|
+
run = [ "sh", "-c", "exec python3 -m http.server ${DEPLOY_RUN_PORT} --bind 0.0.0.0" ]
|
|
14
14
|
run_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/serve.ps1"]
|
|
@@ -9,7 +9,7 @@ run = ["bash", "./scripts/dev.sh"]
|
|
|
9
9
|
run_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/dev.ps1"]
|
|
10
10
|
validate = ["bash", "./scripts/validate.sh"]
|
|
11
11
|
validate_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/validate.ps1"]
|
|
12
|
-
deps = ["git"] # -> apt install git
|
|
12
|
+
deps = ["git", "rsync"] # -> apt install git rsync
|
|
13
13
|
|
|
14
14
|
[deploy]
|
|
15
15
|
build = ["bash","./scripts/build.sh"]
|
|
@@ -361,3 +361,21 @@ export const useStore = create<Store>((set) => ({
|
|
|
361
361
|
3. **遵循 Next.js App Router 规范**,正确区分服务端/客户端组件
|
|
362
362
|
4. **使用 TypeScript** 进行类型安全开发
|
|
363
363
|
5. **使用 `@/` 路径别名** 导入模块(已配置)
|
|
364
|
+
|
|
365
|
+
## 云盘源码与本地开发
|
|
366
|
+
|
|
367
|
+
Vite、Next.js、Nuxt 的 Unix 开发脚本在 `COZE_DRIVE_ROOT`(默认 `/Coze/Drive`)内通过
|
|
368
|
+
`scripts/local-workspace.cjs` 将源码用 `rsync` 同步到本机临时目录。系统需提供 Node.js、pnpm、bash 和 rsync。
|
|
369
|
+
所有开发与修复仍在云盘源码目录完成,从该目录执行 `.coze` 的 `[dev]` 命令。
|
|
370
|
+
|
|
371
|
+
- `prepare.sh` 同步并在本地安装依赖;安装成功且云盘依赖输入未变化时,仅将更新的锁文件回写云盘。
|
|
372
|
+
- `dev.sh` 在本地镜像运行开发服务,每轮 rsync 结束后等待一秒再同步,框架监听本地文件进行热更新。
|
|
373
|
+
同步失败或依赖输入变化时停止服务;修复后重新运行 `prepare.sh` / `dev.sh`。
|
|
374
|
+
- `validate.sh` 使用独立的本地 `check` 目录,避免类型生成影响正在运行的 `dev` 服务。
|
|
375
|
+
- 同步排除 `.git`、`node_modules`、日志和框架输出;不要在镜像修复源码或将依赖、编译产物回传云盘。
|
|
376
|
+
日志和 PID 默认保留在源码目录的 `logs/`,实际镜像路径见脚本输出。
|
|
377
|
+
|
|
378
|
+
本地镜像仅用于 `[dev].build/run/validate`。部署配置、`build.sh`、`start.sh` 保持原流程;
|
|
379
|
+
普通本地目录和 Windows PowerShell 入口也保持原流程。
|
|
380
|
+
存量项目通过新版 CLI 的 `coze-dev patch --dry-run` / `coze-dev patch` 升级,沿用 patch 总开关。
|
|
381
|
+
仅升级完整匹配旧模板的三个 Unix 开发脚本并保留端口;自定义开发脚本、命令或同名 helper 会跳过。
|
|
@@ -23,6 +23,11 @@ const eslintConfig = defineConfig([
|
|
|
23
23
|
...nextVitals,
|
|
24
24
|
...nextTs,
|
|
25
25
|
{
|
|
26
|
+
settings: {
|
|
27
|
+
// node_modules 里的 barrel 包(lucide-react 等)不参与 ExportMap 构建,
|
|
28
|
+
// import/no-cycle 只需要项目源码的依赖图。
|
|
29
|
+
'import/ignore': ['/node_modules/'],
|
|
30
|
+
},
|
|
26
31
|
rules: {
|
|
27
32
|
'import/no-cycle': ['error', { ignoreExternal: true }],
|
|
28
33
|
'react-hooks/set-state-in-effect': 'off',
|
|
@@ -37,14 +42,15 @@ const eslintConfig = defineConfig([
|
|
|
37
42
|
},
|
|
38
43
|
// Override default ignores of eslint-config-next.
|
|
39
44
|
globalIgnores([
|
|
40
|
-
// Default ignores of eslint-config-next
|
|
41
|
-
|
|
42
|
-
'
|
|
43
|
-
'
|
|
45
|
+
// Default ignores of eslint-config-next (trailing slash prunes the whole
|
|
46
|
+
// directory instead of walking into it):
|
|
47
|
+
'.next/',
|
|
48
|
+
'out/',
|
|
49
|
+
'build/',
|
|
44
50
|
'next-env.d.ts',
|
|
45
51
|
// Build artifacts:
|
|
46
52
|
'server.js',
|
|
47
|
-
'dist
|
|
53
|
+
'dist/',
|
|
48
54
|
// Script files (CommonJS):
|
|
49
55
|
'scripts/**/*.js',
|
|
50
56
|
]),
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import type { NextConfig } from 'next';
|
|
2
|
+
import path from 'path';
|
|
2
3
|
|
|
3
4
|
const nextConfig: NextConfig = {
|
|
4
5
|
// outputFileTracingRoot: path.resolve(__dirname, '../../'), // Uncomment and add 'import path from "path"' if needed
|
|
5
6
|
/* config options here */
|
|
7
|
+
serverExternalPackages: ['coze-coding-dev-sdk'],
|
|
8
|
+
webpack: (config, { dev }) => {
|
|
9
|
+
if (dev && config.cache && config.cache.type === 'filesystem') {
|
|
10
|
+
config.cache.cacheDirectory = path.resolve(
|
|
11
|
+
'node_modules/.cache/next-webpack',
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return config;
|
|
15
|
+
},
|
|
6
16
|
allowedDevOrigins: ['*.dev.coze.site'],
|
|
7
17
|
images: {
|
|
8
18
|
remotePatterns: [
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"build": "bash ./scripts/build.sh",
|
|
7
7
|
"dev": "bash ./scripts/dev.sh",
|
|
8
8
|
"preinstall": "npx only-allow pnpm",
|
|
9
|
-
"lint": "eslint",
|
|
9
|
+
"lint": "eslint --cache --cache-location node_modules/.cache/eslint/",
|
|
10
10
|
"lint:build": "eslint . --quiet",
|
|
11
11
|
"lint:style": "stylelint \"src/**/*.css\"",
|
|
12
12
|
"start": "bash ./scripts/start.sh",
|
|
@@ -73,17 +73,14 @@
|
|
|
73
73
|
"zod": "^4.3.5"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@react-dev-inspector/babel-plugin": "^2.0.1",
|
|
77
|
-
"@react-dev-inspector/middleware": "^2.0.1",
|
|
78
76
|
"@tailwindcss/postcss": "^4",
|
|
79
77
|
"@types/node": "^20",
|
|
80
78
|
"@types/pg": "^8.16.0",
|
|
81
79
|
"@types/react": "^19",
|
|
82
80
|
"@types/react-dom": "^19",
|
|
83
81
|
"eslint": "^9",
|
|
84
|
-
"eslint-config-next": "16.
|
|
82
|
+
"eslint-config-next": "16.1.1",
|
|
85
83
|
"only-allow": "^1.2.2",
|
|
86
|
-
"react-dev-inspector": "^2.0.1",
|
|
87
84
|
"shadcn": "latest",
|
|
88
85
|
"stylelint": "^16.4.0",
|
|
89
86
|
"stylelint-config-standard": "^38.0.0",
|