@coze-arch/cli 0.0.1-alpha.f74941 → 0.0.1-alpha.f91253
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 +7 -2
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +220 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +45 -0
- package/lib/__templates__/expo/README.md +68 -7
- package/lib/__templates__/expo/_gitignore +1 -1
- package/lib/__templates__/expo/_npmrc +3 -5
- package/lib/__templates__/expo/client/app/_layout.tsx +14 -14
- package/lib/__templates__/expo/client/app/index.tsx +1 -0
- package/lib/__templates__/expo/client/app.config.ts +76 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
- package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
- package/lib/__templates__/expo/client/components/ThemedView.tsx +38 -0
- package/lib/__templates__/expo/client/constants/theme.ts +117 -58
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +14 -107
- package/lib/__templates__/expo/client/declarations.d.ts +5 -0
- package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +14 -10
- package/lib/__templates__/expo/client/hooks/useColorScheme.ts +34 -1
- package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
- package/lib/__templates__/expo/client/metro.config.js +121 -0
- package/lib/__templates__/expo/client/package.json +93 -0
- 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/scripts/install-missing-deps.js +37 -12
- package/lib/__templates__/expo/client/tsconfig.json +24 -0
- package/lib/__templates__/expo/client/utils/index.ts +23 -2
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +2486 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +155 -0
- package/lib/__templates__/expo/package.json +13 -92
- package/lib/__templates__/expo/pnpm-lock.yaml +675 -678
- package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
- package/lib/__templates__/expo/server/build.js +21 -0
- package/lib/__templates__/expo/server/package.json +32 -0
- package/lib/__templates__/expo/server/src/index.ts +19 -0
- package/lib/__templates__/expo/server/tsconfig.json +24 -0
- package/lib/__templates__/expo/template.config.js +2 -1
- package/lib/__templates__/expo/tsconfig.json +1 -24
- package/lib/__templates__/nextjs/.babelrc +15 -0
- package/lib/__templates__/nextjs/.coze +4 -3
- package/lib/__templates__/nextjs/README.md +341 -19
- package/lib/__templates__/nextjs/_npmrc +2 -1
- package/lib/__templates__/nextjs/components.json +21 -0
- package/lib/__templates__/nextjs/next.config.ts +12 -0
- package/lib/__templates__/nextjs/package.json +64 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +8768 -1565
- package/lib/__templates__/nextjs/scripts/dev.sh +9 -27
- package/lib/__templates__/{react-rsbuild/scripts/build.sh → nextjs/scripts/prepare.sh} +0 -5
- package/lib/__templates__/nextjs/src/app/globals.css +124 -13
- package/lib/__templates__/nextjs/src/app/layout.tsx +23 -32
- package/lib/__templates__/nextjs/src/app/page.tsx +35 -23
- package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
- package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
- package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
- package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
- package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
- package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
- package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
- package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
- package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
- package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
- package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
- package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
- package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
- package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
- package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
- package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
- package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
- package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
- package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
- package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
- package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
- package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
- package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
- package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
- package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
- package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
- package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
- package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
- package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
- package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
- package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
- package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +724 -0
- package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
- package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
- package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
- package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
- package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
- package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
- package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
- package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
- package/lib/__templates__/nextjs/template.config.js +32 -2
- package/lib/__templates__/templates.json +61 -74
- package/lib/__templates__/vite/.coze +4 -3
- package/lib/__templates__/vite/README.md +204 -26
- package/lib/__templates__/vite/_npmrc +2 -1
- package/lib/__templates__/vite/eslint.config.mjs +9 -0
- package/lib/__templates__/vite/package.json +11 -2
- package/lib/__templates__/vite/pnpm-lock.yaml +3232 -243
- package/lib/__templates__/vite/scripts/dev.sh +7 -26
- package/lib/__templates__/{rsbuild/scripts/build.sh → vite/scripts/prepare.sh} +0 -5
- package/lib/__templates__/vite/src/main.ts +1 -2
- package/lib/__templates__/vite/template.config.js +41 -6
- package/lib/__templates__/vite/vite.config.ts +3 -3
- package/lib/cli.js +874 -316
- package/package.json +11 -4
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -109
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -257
- package/lib/__templates__/expo/app.json +0 -63
- package/lib/__templates__/expo/babel.config.js +0 -9
- package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
- package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
- package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
- package/lib/__templates__/expo/client/app/+not-found.tsx +0 -79
- package/lib/__templates__/expo/client/index.js +0 -11
- package/lib/__templates__/expo/client/screens/home/index.tsx +0 -54
- package/lib/__templates__/expo/client/screens/home/styles.ts +0 -332
- package/lib/__templates__/expo/metro.config.js +0 -53
- package/lib/__templates__/expo/src/index.ts +0 -12
- package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
- package/lib/__templates__/react-rsbuild/.coze +0 -11
- package/lib/__templates__/react-rsbuild/.vscode/settings.json +0 -121
- package/lib/__templates__/react-rsbuild/README.md +0 -61
- package/lib/__templates__/react-rsbuild/_gitignore +0 -97
- package/lib/__templates__/react-rsbuild/_npmrc +0 -22
- package/lib/__templates__/react-rsbuild/package.json +0 -31
- package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +0 -997
- package/lib/__templates__/react-rsbuild/rsbuild.config.ts +0 -13
- package/lib/__templates__/react-rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/react-rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/react-rsbuild/src/App.tsx +0 -60
- package/lib/__templates__/react-rsbuild/src/index.css +0 -21
- package/lib/__templates__/react-rsbuild/src/index.html +0 -12
- package/lib/__templates__/react-rsbuild/src/index.tsx +0 -16
- package/lib/__templates__/react-rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/react-rsbuild/template.config.js +0 -54
- package/lib/__templates__/react-rsbuild/tsconfig.json +0 -17
- package/lib/__templates__/rsbuild/.coze +0 -11
- package/lib/__templates__/rsbuild/.vscode/settings.json +0 -7
- package/lib/__templates__/rsbuild/README.md +0 -61
- package/lib/__templates__/rsbuild/_gitignore +0 -97
- package/lib/__templates__/rsbuild/_npmrc +0 -22
- package/lib/__templates__/rsbuild/package.json +0 -24
- package/lib/__templates__/rsbuild/pnpm-lock.yaml +0 -888
- package/lib/__templates__/rsbuild/rsbuild.config.ts +0 -12
- package/lib/__templates__/rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/rsbuild/src/index.css +0 -21
- package/lib/__templates__/rsbuild/src/index.html +0 -12
- package/lib/__templates__/rsbuild/src/index.ts +0 -5
- package/lib/__templates__/rsbuild/src/main.ts +0 -65
- package/lib/__templates__/rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/rsbuild/template.config.js +0 -56
- package/lib/__templates__/rsbuild/tsconfig.json +0 -16
- package/lib/__templates__/vite/.vscode/settings.json +0 -7
- /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
|
@@ -3,44 +3,25 @@ set -Eeuo pipefail
|
|
|
3
3
|
|
|
4
4
|
PORT=<%= port %>
|
|
5
5
|
COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
6
|
+
DEPLOY_RUN_PORT=<%= port %>
|
|
6
7
|
|
|
7
8
|
cd "${COZE_WORKSPACE_PATH}"
|
|
8
9
|
|
|
9
10
|
kill_port_if_listening() {
|
|
10
11
|
local pids
|
|
11
|
-
|
|
12
|
-
# Check if lsof is available (macOS/BSD) or ss (Linux)
|
|
13
|
-
if command -v lsof >/dev/null 2>&1; then
|
|
14
|
-
# macOS/BSD using lsof
|
|
15
|
-
pids=$(lsof -ti:${PORT} 2>/dev/null || true)
|
|
16
|
-
elif command -v ss >/dev/null 2>&1; then
|
|
17
|
-
# Linux using ss
|
|
18
|
-
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
19
|
-
else
|
|
20
|
-
echo "Warning: neither lsof nor ss found, cannot check port ${PORT}"
|
|
21
|
-
return
|
|
22
|
-
fi
|
|
23
|
-
|
|
12
|
+
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
24
13
|
if [[ -z "${pids}" ]]; then
|
|
25
|
-
echo "Port ${
|
|
14
|
+
echo "Port ${DEPLOY_RUN_PORT} is free."
|
|
26
15
|
return
|
|
27
16
|
fi
|
|
28
|
-
|
|
29
|
-
echo "Port ${PORT} in use by PIDs: ${pids} (SIGKILL)"
|
|
17
|
+
echo "Port ${DEPLOY_RUN_PORT} in use by PIDs: ${pids} (SIGKILL)"
|
|
30
18
|
echo "${pids}" | xargs -I {} kill -9 {}
|
|
31
19
|
sleep 1
|
|
32
|
-
|
|
33
|
-
# Verify port is cleared
|
|
34
|
-
if command -v lsof >/dev/null 2>&1; then
|
|
35
|
-
pids=$(lsof -ti:${PORT} 2>/dev/null || true)
|
|
36
|
-
elif command -v ss >/dev/null 2>&1; then
|
|
37
|
-
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
38
|
-
fi
|
|
39
|
-
|
|
20
|
+
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
40
21
|
if [[ -n "${pids}" ]]; then
|
|
41
|
-
echo "Warning: port ${
|
|
22
|
+
echo "Warning: port ${DEPLOY_RUN_PORT} still busy after SIGKILL, PIDs: ${pids}"
|
|
42
23
|
else
|
|
43
|
-
echo "Port ${
|
|
24
|
+
echo "Port ${DEPLOY_RUN_PORT} cleared."
|
|
44
25
|
fi
|
|
45
26
|
}
|
|
46
27
|
|
|
@@ -13,8 +13,7 @@ export function initApp(): void {
|
|
|
13
13
|
<!-- 头部:Logo 和 产品名称 -->
|
|
14
14
|
<div class="flex items-center gap-3">
|
|
15
15
|
<img
|
|
16
|
-
|
|
17
|
-
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/hkpzboz/coze_logo.png"
|
|
16
|
+
src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/favicon.svg"
|
|
18
17
|
alt="扣子编程 Logo"
|
|
19
18
|
width="40"
|
|
20
19
|
height="40"
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
|
|
5
8
|
|
|
@@ -24,17 +27,29 @@ export const paramsSchema = {
|
|
|
24
27
|
maximum: 65535,
|
|
25
28
|
description: 'Development server port',
|
|
26
29
|
},
|
|
30
|
+
hmrPort: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
default: 6000,
|
|
33
|
+
minimum: 1024,
|
|
34
|
+
maximum: 65535,
|
|
35
|
+
description: 'Development HMR server port',
|
|
36
|
+
},
|
|
27
37
|
},
|
|
28
38
|
required: [],
|
|
29
39
|
additionalProperties: false,
|
|
30
40
|
};
|
|
31
41
|
|
|
42
|
+
const description = `Vite(简单项目):\`coze init \${COZE_WORKSPACE_PATH} --template vite\`
|
|
43
|
+
- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。`;
|
|
44
|
+
|
|
32
45
|
const config = {
|
|
46
|
+
description: description,
|
|
33
47
|
paramsSchema,
|
|
34
48
|
|
|
35
49
|
defaultParams: {
|
|
36
|
-
port:
|
|
37
|
-
|
|
50
|
+
port: 5000,
|
|
51
|
+
hmrPort: 6000,
|
|
52
|
+
appName: 'projects',
|
|
38
53
|
},
|
|
39
54
|
|
|
40
55
|
onBeforeRender: async context => {
|
|
@@ -46,11 +61,31 @@ const config = {
|
|
|
46
61
|
|
|
47
62
|
onAfterRender: async (context, outputPath) => {
|
|
48
63
|
console.log(`\nProject created at: ${outputPath}`);
|
|
49
|
-
console.log(
|
|
50
|
-
console.log(
|
|
51
|
-
console.log(
|
|
52
|
-
console.log(
|
|
64
|
+
console.log('\nConfiguration:');
|
|
65
|
+
console.log(' - Framework: vite');
|
|
66
|
+
console.log(' - TypeScript: enabled');
|
|
67
|
+
console.log(' - App Router: enabled');
|
|
53
68
|
console.log(` - Port: ${context.port}`);
|
|
69
|
+
|
|
70
|
+
// Skip pnpm add in test environment to avoid monorepo workspace issues
|
|
71
|
+
if (process.env.NODE_ENV === 'test') {
|
|
72
|
+
console.log('⊘ Skipping dependency update in test environment');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const cmd = `pnpm add coze-coding-dev-sdk@"^0.7.0"`;
|
|
77
|
+
console.log(`${cmd}`);
|
|
78
|
+
try {
|
|
79
|
+
const projectRoot = resolve(outputPath);
|
|
80
|
+
// execSync(cmd, {
|
|
81
|
+
// cwd: projectRoot,
|
|
82
|
+
// stdio: 'inherit',
|
|
83
|
+
// });
|
|
84
|
+
console.log('✓ coze-coding-dev-sdk updated successfully');
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('✗ Failed to update coze-coding-dev-sdk:', error);
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
54
89
|
},
|
|
55
90
|
};
|
|
56
91
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
|
-
port: '<%= port %>',
|
|
5
|
-
host: '0.0.0.0',
|
|
6
4
|
server: {
|
|
5
|
+
port: <%= port %>,
|
|
6
|
+
host: '0.0.0.0',
|
|
7
7
|
hmr: {
|
|
8
8
|
overlay: true,
|
|
9
9
|
path: '/hot/vite-hmr',
|
|
10
|
-
port:
|
|
10
|
+
port: <%= hmrPort %>,
|
|
11
11
|
clientPort: 443,
|
|
12
12
|
timeout: 30000,
|
|
13
13
|
},
|