@botim/botim-cli 0.1.3 → 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.
- package/dist/cli.js +18 -2
- package/dist/cli.mjs +6 -6
- package/dist/templates/react/.botim/app.json5 +12 -0
- package/dist/templates/react/.botim/ci/post-version.sh +7 -0
- package/dist/templates/react/.cursorrules +37 -0
- package/dist/templates/react/scripts/.gitkeep +0 -0
- package/dist/templates/react/src/assets/animation/.gitkeep +0 -0
- package/dist/templates/react/src/assets/fonts/.gitkeep +0 -0
- package/dist/templates/react/src/assets/images/.gitkeep +0 -0
- package/dist/templates/templates/react/.botim/app.json5 +12 -0
- package/dist/templates/templates/react/.botim/ci/post-version.sh +7 -0
- package/dist/templates/templates/react/.cursorrules +37 -0
- package/dist/templates/templates/react/README.md +48 -0
- package/dist/templates/templates/react/docs/code-patterns.md +139 -0
- package/dist/templates/templates/react/docs/core-rules.md +69 -0
- package/dist/templates/templates/react/docs/figma-workflow.md +81 -0
- package/dist/templates/templates/react/docs/validation.md +59 -0
- package/dist/templates/templates/react/eslint.config.ts +57 -0
- package/dist/templates/templates/react/index.html +12 -0
- package/dist/templates/templates/react/package-lock.json +12197 -0
- package/dist/templates/templates/react/package.json +102 -0
- package/dist/templates/templates/react/scripts/.gitkeep +0 -0
- package/dist/templates/templates/react/scripts/setup.sh +304 -0
- package/dist/templates/templates/react/src/api/http-client.ts +8 -0
- package/dist/templates/templates/react/src/api/modules/example.ts +12 -0
- package/dist/templates/templates/react/src/app.tsx +27 -0
- package/dist/templates/templates/react/src/assets/animation/.gitkeep +0 -0
- package/dist/templates/templates/react/src/assets/fonts/.gitkeep +0 -0
- package/dist/templates/templates/react/src/assets/images/.gitkeep +0 -0
- package/dist/templates/templates/react/src/components/not-found-content/index.ts +2 -0
- package/dist/templates/templates/react/src/components/not-found-content/not-found-content.tsx +24 -0
- package/dist/templates/templates/react/src/components/welcome-card/index.ts +1 -0
- package/dist/templates/templates/react/src/components/welcome-card/welcome-card.tsx +10 -0
- package/dist/templates/templates/react/src/hooks/use-document-title.ts +11 -0
- package/dist/templates/templates/react/src/i18n/index.ts +40 -0
- package/dist/templates/templates/react/src/i18n/languages/en.json +10 -0
- package/dist/templates/templates/react/src/main.tsx +27 -0
- package/dist/templates/templates/react/src/modules/common/README.md +7 -0
- package/dist/templates/templates/react/src/modules/common/constants.ts +3 -0
- package/dist/templates/templates/react/src/modules/core/README.md +7 -0
- package/dist/templates/templates/react/src/modules/core/api/error.ts +6 -0
- package/dist/templates/templates/react/src/modules/core/app-providers.tsx +18 -0
- package/dist/templates/templates/react/src/modules/core/index.ts +2 -0
- package/dist/templates/templates/react/src/pages/home/index.tsx +13 -0
- package/dist/templates/templates/react/src/pages/not-found/index.tsx +7 -0
- package/dist/templates/templates/react/src/routes.tsx +18 -0
- package/dist/templates/templates/react/src/stores/home-store.ts +11 -0
- package/dist/templates/templates/react/src/styles/font.css +1 -0
- package/dist/templates/templates/react/src/styles/global-style.tsx +27 -0
- package/dist/templates/templates/react/src/styles/tailwind.css +4 -0
- package/dist/templates/templates/react/src/styles/utility-classes.ts +13 -0
- package/dist/templates/templates/react/src/theme/index.tsx +24 -0
- package/dist/templates/templates/react/src/theme/types.ts +10 -0
- package/dist/templates/templates/react/src/types/global.d.ts +139 -0
- package/dist/templates/templates/react/src/types/shims-global.d.ts +97 -0
- package/dist/templates/templates/react/src/utils/currency.ts +6 -0
- package/dist/templates/templates/react/src/utils/date.ts +5 -0
- package/dist/templates/templates/react/src/utils/guard.ts +4 -0
- package/dist/templates/templates/react/src/vite-env.d.ts +1 -0
- package/dist/templates/templates/react/tsconfig.json +39 -0
- package/dist/templates/templates/react/tsconfig.node.json +11 -0
- package/dist/templates/templates/react/types/global.d.ts +131 -0
- package/dist/templates/templates/react/vite.config.ts +179 -0
- package/dist/templates/templates/vue/README.md +19 -0
- package/dist/templates/templates/vue/eslint.config.ts +44 -0
- package/dist/templates/templates/vue/index.html +12 -0
- package/dist/templates/templates/vue/package-lock.json +5774 -0
- package/dist/templates/templates/vue/package.json +39 -0
- package/dist/templates/templates/vue/src/api/http-client.ts +11 -0
- package/dist/templates/templates/vue/src/api/modules/example.ts +12 -0
- package/dist/templates/templates/vue/src/app.vue +23 -0
- package/dist/templates/templates/vue/src/components/card/index.vue +14 -0
- package/dist/templates/templates/vue/src/components/layout/index.ts +1 -0
- package/dist/templates/templates/vue/src/components/layout/page-layout.vue +43 -0
- package/dist/templates/templates/vue/src/components/layout/styles.ts +5 -0
- package/dist/templates/templates/vue/src/components/typography/heading.vue +21 -0
- package/dist/templates/templates/vue/src/components/typography/index.ts +1 -0
- package/dist/templates/templates/vue/src/hooks/use-document-title.ts +23 -0
- package/dist/templates/templates/vue/src/i18n/index.ts +31 -0
- package/dist/templates/templates/vue/src/i18n/languages/en.json +10 -0
- package/dist/templates/templates/vue/src/main.ts +12 -0
- package/dist/templates/templates/vue/src/modules/common/README.md +7 -0
- package/dist/templates/templates/vue/src/modules/common/constants.ts +3 -0
- package/dist/templates/templates/vue/src/modules/core/README.md +7 -0
- package/dist/templates/templates/vue/src/modules/core/api/error.ts +6 -0
- package/dist/templates/templates/vue/src/modules/core/app-providers.ts +17 -0
- package/dist/templates/templates/vue/src/modules/core/index.ts +2 -0
- package/dist/templates/templates/vue/src/pages/home/index.vue +28 -0
- package/dist/templates/templates/vue/src/pages/not-found/index.vue +13 -0
- package/dist/templates/templates/vue/src/routes.ts +19 -0
- package/dist/templates/templates/vue/src/stores/home-store.ts +12 -0
- package/dist/templates/templates/vue/src/styles/font.css +1 -0
- package/dist/templates/templates/vue/src/styles/global-style.ts +63 -0
- package/dist/templates/templates/vue/src/styles/utility-classes.ts +1 -0
- package/dist/templates/templates/vue/src/theme/index.ts +33 -0
- package/dist/templates/templates/vue/src/theme/types.ts +10 -0
- package/dist/templates/templates/vue/src/types/global.d.ts +9 -0
- package/dist/templates/templates/vue/src/utils/currency.ts +6 -0
- package/dist/templates/templates/vue/src/utils/date.ts +5 -0
- package/dist/templates/templates/vue/src/utils/guard.ts +4 -0
- package/dist/templates/templates/vue/src/vite-env.d.ts +1 -0
- package/dist/templates/templates/vue/tsconfig.json +36 -0
- package/dist/templates/templates/vue/tsconfig.node.json +9 -0
- package/dist/templates/templates/vue/types/global.d.ts +7 -0
- package/dist/templates/templates/vue/vite.config.ts +74 -0
- 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.
|
|
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",
|