@botim/botim-cli 0.1.4 → 0.1.6

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 (106) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.mjs +2 -2
  3. package/dist/templates/react/.botim/app.json5 +12 -0
  4. package/dist/templates/react/.botim/ci/post-version.sh +7 -0
  5. package/dist/templates/react/.cursorrules +37 -0
  6. package/dist/templates/react/scripts/.gitkeep +0 -0
  7. package/dist/templates/react/src/assets/animation/.gitkeep +0 -0
  8. package/dist/templates/react/src/assets/fonts/.gitkeep +0 -0
  9. package/dist/templates/react/src/assets/images/.gitkeep +0 -0
  10. package/dist/templates/templates/react/.botim/app.json5 +12 -0
  11. package/dist/templates/templates/react/.botim/ci/post-version.sh +7 -0
  12. package/dist/templates/templates/react/.cursorrules +37 -0
  13. package/dist/templates/templates/react/README.md +48 -0
  14. package/dist/templates/templates/react/docs/code-patterns.md +139 -0
  15. package/dist/templates/templates/react/docs/core-rules.md +69 -0
  16. package/dist/templates/templates/react/docs/figma-workflow.md +81 -0
  17. package/dist/templates/templates/react/docs/validation.md +59 -0
  18. package/dist/templates/templates/react/eslint.config.ts +57 -0
  19. package/dist/templates/templates/react/index.html +12 -0
  20. package/dist/templates/templates/react/package-lock.json +12197 -0
  21. package/dist/templates/templates/react/package.json +102 -0
  22. package/dist/templates/templates/react/scripts/.gitkeep +0 -0
  23. package/dist/templates/templates/react/scripts/setup.sh +304 -0
  24. package/dist/templates/templates/react/src/api/http-client.ts +8 -0
  25. package/dist/templates/templates/react/src/api/modules/example.ts +12 -0
  26. package/dist/templates/templates/react/src/app.tsx +27 -0
  27. package/dist/templates/templates/react/src/assets/animation/.gitkeep +0 -0
  28. package/dist/templates/templates/react/src/assets/fonts/.gitkeep +0 -0
  29. package/dist/templates/templates/react/src/assets/images/.gitkeep +0 -0
  30. package/dist/templates/templates/react/src/components/not-found-content/index.ts +2 -0
  31. package/dist/templates/templates/react/src/components/not-found-content/not-found-content.tsx +24 -0
  32. package/dist/templates/templates/react/src/components/welcome-card/index.ts +1 -0
  33. package/dist/templates/templates/react/src/components/welcome-card/welcome-card.tsx +10 -0
  34. package/dist/templates/templates/react/src/hooks/use-document-title.ts +11 -0
  35. package/dist/templates/templates/react/src/i18n/index.ts +40 -0
  36. package/dist/templates/templates/react/src/i18n/languages/en.json +10 -0
  37. package/dist/templates/templates/react/src/main.tsx +27 -0
  38. package/dist/templates/templates/react/src/modules/common/README.md +7 -0
  39. package/dist/templates/templates/react/src/modules/common/constants.ts +3 -0
  40. package/dist/templates/templates/react/src/modules/core/README.md +7 -0
  41. package/dist/templates/templates/react/src/modules/core/api/error.ts +6 -0
  42. package/dist/templates/templates/react/src/modules/core/app-providers.tsx +18 -0
  43. package/dist/templates/templates/react/src/modules/core/index.ts +2 -0
  44. package/dist/templates/templates/react/src/pages/home/index.tsx +13 -0
  45. package/dist/templates/templates/react/src/pages/not-found/index.tsx +7 -0
  46. package/dist/templates/templates/react/src/routes.tsx +18 -0
  47. package/dist/templates/templates/react/src/stores/home-store.ts +11 -0
  48. package/dist/templates/templates/react/src/styles/font.css +1 -0
  49. package/dist/templates/templates/react/src/styles/global-style.tsx +27 -0
  50. package/dist/templates/templates/react/src/styles/tailwind.css +4 -0
  51. package/dist/templates/templates/react/src/styles/utility-classes.ts +13 -0
  52. package/dist/templates/templates/react/src/theme/index.tsx +24 -0
  53. package/dist/templates/templates/react/src/theme/types.ts +10 -0
  54. package/dist/templates/templates/react/src/types/global.d.ts +139 -0
  55. package/dist/templates/templates/react/src/types/shims-global.d.ts +97 -0
  56. package/dist/templates/templates/react/src/utils/currency.ts +6 -0
  57. package/dist/templates/templates/react/src/utils/date.ts +5 -0
  58. package/dist/templates/templates/react/src/utils/guard.ts +4 -0
  59. package/dist/templates/templates/react/src/vite-env.d.ts +1 -0
  60. package/dist/templates/templates/react/tsconfig.json +39 -0
  61. package/dist/templates/templates/react/tsconfig.node.json +11 -0
  62. package/dist/templates/templates/react/types/global.d.ts +131 -0
  63. package/dist/templates/templates/react/vite.config.ts +179 -0
  64. package/dist/templates/templates/vue/README.md +19 -0
  65. package/dist/templates/templates/vue/eslint.config.ts +44 -0
  66. package/dist/templates/templates/vue/index.html +12 -0
  67. package/dist/templates/templates/vue/package-lock.json +5774 -0
  68. package/dist/templates/templates/vue/package.json +39 -0
  69. package/dist/templates/templates/vue/src/api/http-client.ts +11 -0
  70. package/dist/templates/templates/vue/src/api/modules/example.ts +12 -0
  71. package/dist/templates/templates/vue/src/app.vue +23 -0
  72. package/dist/templates/templates/vue/src/components/card/index.vue +14 -0
  73. package/dist/templates/templates/vue/src/components/layout/index.ts +1 -0
  74. package/dist/templates/templates/vue/src/components/layout/page-layout.vue +43 -0
  75. package/dist/templates/templates/vue/src/components/layout/styles.ts +5 -0
  76. package/dist/templates/templates/vue/src/components/typography/heading.vue +21 -0
  77. package/dist/templates/templates/vue/src/components/typography/index.ts +1 -0
  78. package/dist/templates/templates/vue/src/hooks/use-document-title.ts +23 -0
  79. package/dist/templates/templates/vue/src/i18n/index.ts +31 -0
  80. package/dist/templates/templates/vue/src/i18n/languages/en.json +10 -0
  81. package/dist/templates/templates/vue/src/main.ts +12 -0
  82. package/dist/templates/templates/vue/src/modules/common/README.md +7 -0
  83. package/dist/templates/templates/vue/src/modules/common/constants.ts +3 -0
  84. package/dist/templates/templates/vue/src/modules/core/README.md +7 -0
  85. package/dist/templates/templates/vue/src/modules/core/api/error.ts +6 -0
  86. package/dist/templates/templates/vue/src/modules/core/app-providers.ts +17 -0
  87. package/dist/templates/templates/vue/src/modules/core/index.ts +2 -0
  88. package/dist/templates/templates/vue/src/pages/home/index.vue +28 -0
  89. package/dist/templates/templates/vue/src/pages/not-found/index.vue +13 -0
  90. package/dist/templates/templates/vue/src/routes.ts +19 -0
  91. package/dist/templates/templates/vue/src/stores/home-store.ts +12 -0
  92. package/dist/templates/templates/vue/src/styles/font.css +1 -0
  93. package/dist/templates/templates/vue/src/styles/global-style.ts +63 -0
  94. package/dist/templates/templates/vue/src/styles/utility-classes.ts +1 -0
  95. package/dist/templates/templates/vue/src/theme/index.ts +33 -0
  96. package/dist/templates/templates/vue/src/theme/types.ts +10 -0
  97. package/dist/templates/templates/vue/src/types/global.d.ts +9 -0
  98. package/dist/templates/templates/vue/src/utils/currency.ts +6 -0
  99. package/dist/templates/templates/vue/src/utils/date.ts +5 -0
  100. package/dist/templates/templates/vue/src/utils/guard.ts +4 -0
  101. package/dist/templates/templates/vue/src/vite-env.d.ts +1 -0
  102. package/dist/templates/templates/vue/tsconfig.json +36 -0
  103. package/dist/templates/templates/vue/tsconfig.node.json +9 -0
  104. package/dist/templates/templates/vue/types/global.d.ts +7 -0
  105. package/dist/templates/templates/vue/vite.config.ts +74 -0
  106. package/package.json +3 -2
@@ -0,0 +1,74 @@
1
+ import vue from '@vitejs/plugin-vue';
2
+ import { defineConfig } from 'vite';
3
+ import tsconfigPaths from 'vite-tsconfig-paths';
4
+ import path from 'node:path';
5
+ import fs from 'node:fs';
6
+
7
+ // Plugin to resolve @* imports to src/*
8
+ const resolveAtAliases = () => ({
9
+ name: 'resolve-at-aliases',
10
+ resolveId(id: string) {
11
+ if (id.startsWith('@') && !id.startsWith('@/')) {
12
+ const match = id.match(/^@([^/]+)(.*)$/);
13
+ if (match) {
14
+ const [, alias, rest] = match;
15
+ const basePath = path.resolve(__dirname, `./src/${alias}${rest}`);
16
+
17
+ // Check if path already has an extension
18
+ const hasExtension = /\.(ts|vue|js|tsx|jsx|json)$/i.test(rest);
19
+ if (hasExtension) {
20
+ // Path already has extension, check if file exists
21
+ try {
22
+ if (fs.existsSync(basePath) && fs.statSync(basePath).isFile()) {
23
+ return basePath;
24
+ }
25
+ } catch {
26
+ // File doesn't exist or error occurred
27
+ }
28
+ } else {
29
+ // Try to resolve with common extensions
30
+ const extensions = ['.ts', '.vue', '.js', '.tsx', '.jsx'];
31
+ for (const ext of extensions) {
32
+ const fullPath = basePath + ext;
33
+ try {
34
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isFile()) {
35
+ return fullPath;
36
+ }
37
+ } catch {
38
+ // Continue to next extension
39
+ }
40
+ }
41
+ }
42
+
43
+ // If no file found, try directory with index files
44
+ try {
45
+ if (fs.existsSync(basePath) && fs.statSync(basePath).isDirectory()) {
46
+ const extensions = ['.ts', '.vue', '.js', '.tsx', '.jsx'];
47
+ for (const ext of extensions) {
48
+ const indexPath = path.join(basePath, `index${ext}`);
49
+ if (fs.existsSync(indexPath) && fs.statSync(indexPath).isFile()) {
50
+ return indexPath;
51
+ }
52
+ }
53
+ }
54
+ } catch {
55
+ // Continue
56
+ }
57
+
58
+ // Return null to let Vite's default resolver handle it
59
+ return null;
60
+ }
61
+ }
62
+ return null;
63
+ }
64
+ });
65
+
66
+ export default defineConfig(() => ({
67
+ plugins: [ vue(), tsconfigPaths(), resolveAtAliases() ],
68
+ server: {
69
+ port: 5174
70
+ },
71
+ build: {
72
+ sourcemap: true
73
+ }
74
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botim/botim-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A CLI tool that generates boilerplate code for React and Vue applications and manages Mini-Program apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,8 @@
13
13
  "LICENSE"
14
14
  ],
15
15
  "scripts": {
16
- "build": "tsup && npm run build:bundle",
16
+ "build": "tsup && npm run copy-templates && npm run build:bundle",
17
+ "copy-templates": "cp -r templates dist/templates",
17
18
  "build:bundle": "ncc build src/cli.ts -o dist-bundled -m -e @vercel/ncc && cp dist-bundled/index.js dist/cli.mjs && cp dist-bundled/sourcemap-register.cjs dist/ 2>/dev/null || true && rm -rf dist-bundled && npm run inject-version",
18
19
  "inject-version": "node -e \"const fs=require('fs');const pkg=require('./package.json');const f='dist/cli.mjs';let c=fs.readFileSync(f,'utf8');c=c.replace(/process\\.env\\.BOTIM_CLI_VERSION\\|\\|\\\"1\\.0\\.0\\\"/g,'\\\"'+pkg.version+'\\\"');fs.writeFileSync(f,c);\"",
19
20
  "build:tsup": "tsup",