@coze-arch/cli 0.0.1-alpha.cd0f36 → 0.0.1-alpha.cf9a3b

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 (32) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +1 -1
  2. package/lib/__templates__/expo/README.md +0 -1
  3. package/lib/__templates__/expo/client/contexts/AuthContext.tsx +3 -4
  4. package/lib/__templates__/expo/client/metro.config.js +3 -0
  5. package/lib/__templates__/expo/pnpm-lock.yaml +101 -45
  6. package/lib/__templates__/expo/server/package.json +9 -7
  7. package/lib/__templates__/nextjs/package.json +3 -1
  8. package/lib/__templates__/nextjs/pnpm-lock.yaml +119 -106
  9. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +2 -2
  10. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +4 -3
  11. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +0 -15
  12. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +117 -24
  13. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -1
  14. package/lib/__templates__/taro/README.md +79 -17
  15. package/lib/__templates__/taro/config/index.ts +1 -1
  16. package/lib/__templates__/taro/eslint.config.mjs +25 -3
  17. package/lib/__templates__/taro/package.json +6 -4
  18. package/lib/__templates__/taro/pnpm-lock.yaml +378 -114
  19. package/lib/__templates__/taro/server/package.json +3 -1
  20. package/lib/__templates__/taro/server/src/main.ts +14 -2
  21. package/lib/__templates__/taro/src/app.css +18 -18
  22. package/lib/__templates__/taro/src/app.tsx +9 -0
  23. package/lib/__templates__/taro/src/index.html +20 -1
  24. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +171 -0
  25. package/lib/__templates__/taro/src/{utils → presets}/h5-styles.ts +15 -4
  26. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  27. package/lib/__templates__/vite/package.json +5 -1
  28. package/lib/__templates__/vite/pnpm-lock.yaml +146 -1659
  29. package/lib/cli.js +5 -59
  30. package/package.json +1 -1
  31. package/lib/__templates__/taro/src/app.ts +0 -14
  32. /package/lib/__templates__/taro/src/{utils → presets}/wx-debug.ts +0 -0
package/lib/cli.js CHANGED
@@ -1511,46 +1511,6 @@ const convertDotfileName = (filePath) => {
1511
1511
 
1512
1512
  return filePath;
1513
1513
  };
1514
-
1515
- /**
1516
- * 复制 node_modules 目录(如果存在)
1517
- *
1518
- * @param sourceNodeModules - 源 node_modules 路径
1519
- * @param targetNodeModules - 目标 node_modules 路径
1520
- */
1521
- const copyNodeModules = (
1522
- sourceNodeModules,
1523
- targetNodeModules,
1524
- ) => {
1525
- if (!fs.existsSync(sourceNodeModules)) {
1526
- return;
1527
- }
1528
-
1529
- logger.info('\nCopying node_modules from pre-warmed template...');
1530
- logger.verbose(` From: ${sourceNodeModules}`);
1531
- logger.verbose(` To: ${targetNodeModules}`);
1532
-
1533
- const result = shelljs.exec(`cp -R "${sourceNodeModules}" "${targetNodeModules}"`, {
1534
- silent: true,
1535
- });
1536
-
1537
- if (result.stdout) {
1538
- process.stdout.write(result.stdout);
1539
- }
1540
-
1541
- if (result.stderr) {
1542
- process.stderr.write(result.stderr);
1543
- }
1544
-
1545
- if (result.code === 0) {
1546
- logger.success('✓ node_modules copied successfully');
1547
- } else {
1548
- logger.warn(
1549
- `Failed to copy node_modules: ${result.stderr || 'unknown error'}`,
1550
- );
1551
- logger.info('Will need to run pnpm install manually');
1552
- }
1553
- };
1554
1514
  // end_aigc
1555
1515
 
1556
1516
  // ABOUTME: File rendering utilities for template processing
@@ -1925,11 +1885,7 @@ const processTemplateFiles = async (options
1925
1885
 
1926
1886
  logger.verbose('✓ All files processed successfully');
1927
1887
 
1928
- // 阶段 5: 单独处理 node_modules 目录(如果存在)
1929
- const sourceNodeModules = path.join(templatePath, 'node_modules');
1930
- const targetNodeModules = path.join(outputPath, 'node_modules');
1931
-
1932
- copyNodeModules(sourceNodeModules, targetNodeModules);
1888
+ // node_modules 将由 pnpm install 处理(利用缓存和硬链接机制)
1933
1889
  };
1934
1890
  // end_aigc
1935
1891
 
@@ -2259,20 +2215,10 @@ const executeInit = async (
2259
2215
  timer.logPhase('Template engine execution');
2260
2216
  logger.success('Project created successfully!');
2261
2217
 
2262
- // 如果没有跳过安装,检查是否需要运行 pnpm install
2218
+ // 安装依赖(始终使用 pnpm install,利用缓存机制)
2263
2219
  if (!skipInstall) {
2264
- const nodeModulesPath = path.join(absoluteOutputPath, 'node_modules');
2265
- const hasNodeModules = fs.existsSync(nodeModulesPath);
2266
-
2267
- if (hasNodeModules) {
2268
- logger.info(
2269
- '\n💡 Using pre-warmed node_modules, skipping pnpm install',
2270
- );
2271
- timer.logPhase('Node modules (pre-warmed)');
2272
- } else {
2273
- runPnpmInstall(absoluteOutputPath);
2274
- timer.logPhase('Dependencies installation');
2275
- }
2220
+ runPnpmInstall(absoluteOutputPath);
2221
+ timer.logPhase('Dependencies installation');
2276
2222
  }
2277
2223
 
2278
2224
  // 执行 onComplete 钩子(在 pnpm install 之后)
@@ -2631,7 +2577,7 @@ const registerCommand = program => {
2631
2577
  });
2632
2578
  };
2633
2579
 
2634
- var version = "0.0.1-alpha.cd0f36";
2580
+ var version = "0.0.1-alpha.cf9a3b";
2635
2581
  var packageJson = {
2636
2582
  version: version};
2637
2583
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.1-alpha.cd0f36",
3
+ "version": "0.0.1-alpha.cf9a3b",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",
@@ -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
- };