@coze-arch/cli 0.0.1-alpha.a17d4b → 0.0.1-alpha.a2a210

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.
@@ -0,0 +1,18 @@
1
+ import { useLaunch } from '@tarojs/taro';
2
+ import { PropsWithChildren } from 'react';
3
+ import { H5NavBar } from './h5-navbar';
4
+ import { injectH5Styles } from './h5-styles';
5
+ import { enableWxDebugIfNeeded } from './wx-debug';
6
+
7
+ export const Preset = ({ children }: PropsWithChildren) => {
8
+ useLaunch(() => {
9
+ enableWxDebugIfNeeded();
10
+ injectH5Styles();
11
+ });
12
+
13
+ if (TARO_ENV === 'h5') {
14
+ return <H5NavBar>{children}</H5NavBar>;
15
+ }
16
+
17
+ return <>{children}</>;
18
+ };
@@ -26,6 +26,17 @@
26
26
  "additionalProperties": false
27
27
  }
28
28
  },
29
+ {
30
+ "name": "native-static",
31
+ "description": "Native Static(纯静态):`coze init ${COZE_WORKSPACE_PATH} --template native-static`\n- 适用:纯静态 HTML/CSS/JS 项目、静态网站\n- 使用 Python http.server 作为开发服务器\n- 不需要 Node.js 环境,适合简单静态内容",
32
+ "location": "./native-static",
33
+ "paramsSchema": {
34
+ "type": "object",
35
+ "properties": {},
36
+ "required": [],
37
+ "additionalProperties": false
38
+ }
39
+ },
29
40
  {
30
41
  "name": "nextjs",
31
42
  "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/`目录下",
@@ -4,6 +4,7 @@ export default defineConfig({
4
4
  server: {
5
5
  port: <%= port %>,
6
6
  host: '0.0.0.0',
7
+ allowedHosts: true,
7
8
  hmr: {
8
9
  overlay: true,
9
10
  path: '/hot/vite-hmr',
package/lib/cli.js CHANGED
@@ -2215,10 +2215,20 @@ const executeInit = async (
2215
2215
  timer.logPhase('Template engine execution');
2216
2216
  logger.success('Project created successfully!');
2217
2217
 
2218
+ // 检查是否存在 package.json
2219
+ const packageJsonPath = path.join(absoluteOutputPath, 'package.json');
2220
+ const hasPackageJson = fs.existsSync(packageJsonPath);
2221
+
2218
2222
  // 安装依赖(始终使用 pnpm install,利用缓存机制)
2219
2223
  if (!skipInstall) {
2220
- runPnpmInstall(absoluteOutputPath);
2221
- timer.logPhase('Dependencies installation');
2224
+ if (hasPackageJson) {
2225
+ runPnpmInstall(absoluteOutputPath);
2226
+ timer.logPhase('Dependencies installation');
2227
+ } else {
2228
+ logger.info(
2229
+ '\n💡 No package.json found, skipping dependency installation',
2230
+ );
2231
+ }
2222
2232
  }
2223
2233
 
2224
2234
  // 执行 onComplete 钩子(在 pnpm install 之后)
@@ -2239,7 +2249,7 @@ const executeInit = async (
2239
2249
  // 只有跳过 dev 时才显示 Next steps
2240
2250
  logger.info('\nNext steps:');
2241
2251
  logger.info(` cd ${outputPath}`);
2242
- if (skipInstall) {
2252
+ if (skipInstall && hasPackageJson) {
2243
2253
  logger.info(' pnpm install');
2244
2254
  }
2245
2255
  if (skipGit) {
@@ -2577,7 +2587,7 @@ const registerCommand = program => {
2577
2587
  });
2578
2588
  };
2579
2589
 
2580
- var version = "0.0.1-alpha.a17d4b";
2590
+ var version = "0.0.1-alpha.a2a210";
2581
2591
  var packageJson = {
2582
2592
  version: version};
2583
2593
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.1-alpha.a17d4b",
3
+ "version": "0.0.1-alpha.a2a210",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",
@@ -63,6 +63,7 @@
63
63
  "rollup": "^4.41.1",
64
64
  "sucrase": "^3.35.0",
65
65
  "tsx": "^4.20.6",
66
+ "vite-tsconfig-paths": "^4.2.1",
66
67
  "vitest": "~4.0.16"
67
68
  },
68
69
  "publishConfig": {
@@ -1,14 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import { useLaunch } from '@tarojs/taro';
3
- import { injectH5Styles } from '@/utils/h5-styles';
4
- import { enableWxDebugIfNeeded } from '@/utils/wx-debug';
5
- import '@/app.css';
6
-
7
- export default ({ children }: PropsWithChildren<any>) => {
8
- useLaunch(() => {
9
- enableWxDebugIfNeeded();
10
- injectH5Styles();
11
- });
12
-
13
- return children;
14
- };