create-soybean 1.7.0-beta.2 → 1.7.1
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/README.en_US.md +7 -5
- package/README.md +7 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -15
- package/package.json +12 -24
- package/template-ts-lib/_vite-hooks/pre-commit +1 -0
- package/template-ts-lib/package.json +40 -0
- package/template-ts-lib/pnpm-workspace.yaml +11 -0
- package/{template-tsdown → template-ts-lib}/tsconfig.json +7 -6
- package/template-ts-lib/vite.config.ts +22 -0
- package/template-ubean/README.md +20 -0
- package/template-ubean/_editorconfig +11 -0
- package/template-ubean/_gitattributes +2 -0
- package/template-ubean/_gitignore +32 -0
- package/template-ubean/_vite-hooks/pre-commit +1 -0
- package/template-ubean/eslint.config.mjs +3 -0
- package/template-ubean/package.json +38 -0
- package/template-ubean/pnpm-workspace.yaml +11 -0
- package/template-ubean/public/data.json +5 -0
- package/template-ubean/public/favicon.svg +64 -0
- package/template-ubean/src/app.ts +39 -0
- package/template-ubean/src/components/islands/IslandClock.vue +57 -0
- package/template-ubean/src/components/islands/IslandCounter.vue +66 -0
- package/template-ubean/src/components/islands/IslandMedia.vue +69 -0
- package/template-ubean/src/components/islands/IslandOnly.vue +54 -0
- package/template-ubean/src/components/islands/IslandVisibility.vue +60 -0
- package/template-ubean/src/layouts/admin.vue +13 -0
- package/template-ubean/src/layouts/default.vue +97 -0
- package/template-ubean/src/locales/en.json +31 -0
- package/template-ubean/src/locales/zh.json +31 -0
- package/template-ubean/src/middleware/01.global.ts +9 -0
- package/template-ubean/src/pages/about.vue +135 -0
- package/template-ubean/src/pages/blog/[...slug].vue +30 -0
- package/template-ubean/src/pages/dashboard/index.vue +19 -0
- package/template-ubean/src/pages/data-fetch.vue +95 -0
- package/template-ubean/src/pages/index.vue +117 -0
- package/template-ubean/src/pages/islands-test.vue +155 -0
- package/template-ubean/src/routes/api/hello.ts +60 -0
- package/template-ubean/src/routes/api/users/[id].ts +94 -0
- package/template-ubean/src/routes/api/users/index.ts +79 -0
- package/template-ubean/src/server.ts +9 -0
- package/template-ubean/src/typings/env.d.ts +37 -0
- package/template-ubean/tsconfig.json +26 -0
- package/template-ubean/ubean.config.ts +24 -0
- package/template-ubean/vite.config.ts +9 -0
- package/template-ubean-client/README.md +18 -0
- package/template-ubean-client/_gitignore +32 -0
- package/template-ubean-client/_vite-hooks/pre-commit +1 -0
- package/template-ubean-client/eslint.config.mjs +3 -0
- package/template-ubean-client/index.html +14 -0
- package/template-ubean-client/package.json +37 -0
- package/template-ubean-client/pnpm-workspace.yaml +11 -0
- package/template-ubean-client/public/favicon.svg +64 -0
- package/template-ubean-client/src/App.vue +135 -0
- package/template-ubean-client/src/main.ts +63 -0
- package/template-ubean-client/src/pages/404.vue +36 -0
- package/template-ubean-client/src/pages/about.vue +151 -0
- package/template-ubean-client/src/pages/about2.reuse.ts +8 -0
- package/template-ubean-client/src/pages/blog/[...slug].vue +72 -0
- package/template-ubean-client/src/pages/guide.md +30 -0
- package/template-ubean-client/src/pages/index.vue +101 -0
- package/template-ubean-client/src/pages/users/[id=numeric].vue +80 -0
- package/template-ubean-client/src/pages/users/index.vue +56 -0
- package/template-ubean-client/src/typings/globals.d.ts +17 -0
- package/template-ubean-client/tsconfig.json +25 -0
- package/template-ubean-client/vite.config.ts +20 -0
- package/template-vue/.gitignore +2 -0
- package/template-vue/_vite-hooks/pre-commit +1 -0
- package/template-vue/eslint.config.mjs +3 -0
- package/template-vue/package.json +17 -26
- package/template-vue/pnpm-workspace.yaml +11 -0
- package/template-vue/src/App.vue +3 -3
- package/template-vue/src/main.ts +2 -7
- package/template-vue/uno.config.ts +3 -3
- package/template-vue/vite.config.ts +10 -6
- package/template-vue-lib/_editorconfig +11 -0
- package/template-vue-lib/_gitattributes +2 -0
- package/template-vue-lib/_vite-hooks/pre-commit +1 -0
- package/template-vue-lib/eslint.config.mjs +3 -0
- package/template-vue-lib/package.json +53 -0
- package/template-vue-lib/pnpm-workspace.yaml +11 -0
- package/template-vue-lib/vite.config.ts +33 -0
- package/template-tsdown/_npmrc +0 -1
- package/template-tsdown/_oxfmtrc.json +0 -7
- package/template-tsdown/_oxlintrc.json +0 -16
- package/template-tsdown/package.json +0 -54
- package/template-tsdown/tsdown.config.ts +0 -10
- package/template-vue/_npmrc +0 -1
- package/template-vue/_oxfmtrc.json +0 -7
- package/template-vue/_oxlintrc.json +0 -17
- package/template-vue/er.config.ts +0 -9
- package/template-vue/src/components/HelloWorld.vue +0 -5
- package/template-vue/src/constants/index.ts +0 -0
- package/template-vue/src/layouts/base/index.vue +0 -9
- package/template-vue/src/layouts/blank/index.vue +0 -9
- package/template-vue/src/plugins/assets.ts +0 -4
- package/template-vue/src/router/index.ts +0 -25
- package/template-vue/src/shared/index.ts +0 -0
- package/template-vue/src/store/_plugin.ts +0 -17
- package/template-vue/src/store/counter/index.ts +0 -14
- package/template-vue/src/store/index.ts +0 -12
- package/template-vue/src/styles/app.css +0 -49
- package/template-vue/src/typings/components.d.ts +0 -17
- package/template-vue/src/views/(builtin)/403.vue +0 -5
- package/template-vue/src/views/(builtin)/404.vue +0 -5
- package/template-vue/src/views/(builtin)/login/index.vue +0 -5
- package/template-vue/src/views/(builtin)/wip.vue +0 -5
- package/template-vue/src/views/demo.tsx +0 -7
- package/template-vue/src/views/home/child.vue +0 -5
- package/template-vue/src/views/home/child2.vue +0 -5
- package/template-vue/src/views/home/index.vue +0 -9
- package/template-vue/src/views/list/[id].vue +0 -9
- package/template-vue/src/views/list/add.vue +0 -5
- package/template-vue/src/views/list/components/demo.vue +0 -0
- package/template-vue/src/views/list/components/search-list.vue +0 -5
- package/template-vue/src/views/list/detail2-[[id]]-[[userId]].vue +0 -5
- package/template-vue/src/views/list/detail_[id]_[userId].vue +0 -5
- package/template-vue/src/views/list/edit_[id].vue +0 -5
- package/template-vue/src/views/list/index.vue +0 -5
- package/template-vue/src/views/list/modules/list-table.vue +0 -5
- package/template-vue-tsdown/_npmrc +0 -1
- package/template-vue-tsdown/_oxfmtrc.json +0 -7
- package/template-vue-tsdown/_oxlintrc.json +0 -17
- package/template-vue-tsdown/package.json +0 -64
- package/template-vue-tsdown/tsdown.config.ts +0 -16
- package/template-vue-tsdown/vite.config.ts +0 -7
- /package/{template-tsdown → template-ts-lib}/.github/workflows/release.yml +0 -0
- /package/{template-tsdown → template-ts-lib}/.vscode/extensions.json +0 -0
- /package/{template-tsdown → template-ts-lib}/.vscode/launch.json +0 -0
- /package/{template-tsdown → template-ts-lib}/.vscode/settings.json +0 -0
- /package/{template-tsdown → template-ts-lib}/_editorconfig +0 -0
- /package/{template-tsdown → template-ts-lib}/_gitattributes +0 -0
- /package/{template-tsdown → template-ts-lib}/_gitignore +0 -0
- /package/{template-tsdown → template-ts-lib}/src/index.ts +0 -0
- /package/{template-vue-tsdown → template-ubean-client}/_editorconfig +0 -0
- /package/{template-vue-tsdown → template-ubean-client}/_gitattributes +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/.github/workflows/release.yml +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/.vscode/extensions.json +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/.vscode/launch.json +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/.vscode/settings.json +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/_gitignore +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/playground/index.html +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/playground/src/App.vue +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/playground/src/index.ts +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/playground/src/style.css +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/src/demo-pkg.vue +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/src/index.ts +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/tsconfig.json +0 -0
package/README.en_US.md
CHANGED
|
@@ -42,11 +42,13 @@ npm create soybean@latest my-project -- --template vue
|
|
|
42
42
|
|
|
43
43
|
## Available Templates
|
|
44
44
|
|
|
45
|
-
| Template
|
|
46
|
-
|
|
|
47
|
-
| `
|
|
48
|
-
| `vue`
|
|
49
|
-
| `vue-
|
|
45
|
+
| Template | Description |
|
|
46
|
+
| -------------- | ---------------------------------- |
|
|
47
|
+
| `ts-lib` | TypeScript library |
|
|
48
|
+
| `vue` | Vue 3 project |
|
|
49
|
+
| `vue-lib` | Vue 3 + TypeScript library |
|
|
50
|
+
| `ubean` | ubean full-stack app (SSR/islands) |
|
|
51
|
+
| `ubean-client` | ubean client-only SPA |
|
|
50
52
|
|
|
51
53
|
## License
|
|
52
54
|
|
package/README.md
CHANGED
|
@@ -42,11 +42,13 @@ npm create soybean@latest my-project -- --template vue
|
|
|
42
42
|
|
|
43
43
|
## 可用模板
|
|
44
44
|
|
|
45
|
-
| 模板
|
|
46
|
-
|
|
|
47
|
-
| `
|
|
48
|
-
| `vue`
|
|
49
|
-
| `vue-
|
|
45
|
+
| 模板 | 描述 |
|
|
46
|
+
| -------------- | ---------------------------------- |
|
|
47
|
+
| `ts-lib` | TypeScript 库 |
|
|
48
|
+
| `vue` | Vue 3 项目 |
|
|
49
|
+
| `vue-lib` | Vue 3 + TypeScript 库 |
|
|
50
|
+
| `ubean` | ubean 全栈应用(SSR/Islands/i18n) |
|
|
51
|
+
| `ubean-client` | ubean 纯客户端 SPA |
|
|
50
52
|
|
|
51
53
|
## License
|
|
52
54
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import process from "node:process";
|
|
3
2
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
4
3
|
import path from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import {
|
|
6
|
+
import { consola } from "consola";
|
|
7
|
+
import { blue, cyan, green, red, reset } from "kolorist";
|
|
7
8
|
import minimist from "minimist";
|
|
8
9
|
import prompts from "prompts";
|
|
9
|
-
import { consola } from "consola";
|
|
10
10
|
|
|
11
11
|
//#region src/shared.ts
|
|
12
12
|
function formatTargetDir(targetDir) {
|
|
@@ -25,10 +25,13 @@ function toValidPackageName(projectName) {
|
|
|
25
25
|
function emptyDir(dir) {
|
|
26
26
|
if (!existsSync(dir)) return;
|
|
27
27
|
const files = readdirSync(dir);
|
|
28
|
-
for (const file of files) if (file !== ".git")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
for (const file of files) if (file !== ".git") {
|
|
29
|
+
const filePath = path.resolve(dir, file);
|
|
30
|
+
rmSync(filePath, {
|
|
31
|
+
recursive: true,
|
|
32
|
+
force: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
function copyDir(srcDir, destDir) {
|
|
34
37
|
mkdirSync(destDir, { recursive: true });
|
|
@@ -44,8 +47,8 @@ function copy(src, dest) {
|
|
|
44
47
|
//#region src/index.ts
|
|
45
48
|
const templates = [
|
|
46
49
|
{
|
|
47
|
-
type: "
|
|
48
|
-
name: "TypeScript library
|
|
50
|
+
type: "ts-lib",
|
|
51
|
+
name: "TypeScript library",
|
|
49
52
|
color: cyan
|
|
50
53
|
},
|
|
51
54
|
{
|
|
@@ -54,9 +57,19 @@ const templates = [
|
|
|
54
57
|
color: green
|
|
55
58
|
},
|
|
56
59
|
{
|
|
57
|
-
type: "vue-
|
|
58
|
-
name: "Vue 3 + TypeScript library
|
|
60
|
+
type: "vue-lib",
|
|
61
|
+
name: "Vue 3 + TypeScript library",
|
|
59
62
|
color: green
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "ubean",
|
|
66
|
+
name: "Ubean full-stack app (SSR, islands, i18n)",
|
|
67
|
+
color: blue
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: "ubean-client",
|
|
71
|
+
name: "Ubean client-only SPA",
|
|
72
|
+
color: blue
|
|
60
73
|
}
|
|
61
74
|
];
|
|
62
75
|
const TEMPLATES = templates.map((t) => t.type);
|
|
@@ -64,9 +77,7 @@ const renameFiles = {
|
|
|
64
77
|
_editorconfig: ".editorconfig",
|
|
65
78
|
_gitattributes: ".gitattributes",
|
|
66
79
|
_gitignore: ".gitignore",
|
|
67
|
-
|
|
68
|
-
"_oxlintrc.json": ".oxlintrc.json",
|
|
69
|
-
"_oxfmtrc.json": ".oxfmtrc.json"
|
|
80
|
+
"_vite-hooks": ".vite-hooks"
|
|
70
81
|
};
|
|
71
82
|
const defaultTargetDir = "create-soybean-project";
|
|
72
83
|
async function setupCli() {
|
|
@@ -147,4 +158,5 @@ async function setupCli() {
|
|
|
147
158
|
}
|
|
148
159
|
setupCli();
|
|
149
160
|
|
|
150
|
-
//#endregion
|
|
161
|
+
//#endregion
|
|
162
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-soybean",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "The official scaffolding tool by SoybeanJS for quickly creating different project templates.",
|
|
5
5
|
"homepage": "https://github.com/soybeanjs/create-soybean",
|
|
6
6
|
"bugs": {
|
|
@@ -29,8 +29,7 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
32
|
-
"import": "./dist/index.js"
|
|
33
|
-
"require": "./dist/index.js"
|
|
32
|
+
"import": "./dist/index.js"
|
|
34
33
|
}
|
|
35
34
|
},
|
|
36
35
|
"publishConfig": {
|
|
@@ -43,36 +42,25 @@
|
|
|
43
42
|
"prompts": "^2.4.2"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@soybeanjs/cli": "
|
|
45
|
+
"@soybeanjs/cli": "1.8.3",
|
|
46
|
+
"@soybeanjs/oxc-config": "^0.2.6",
|
|
47
47
|
"@types/minimist": "^1.2.5",
|
|
48
|
-
"@types/node": "^
|
|
48
|
+
"@types/node": "^26.5.1",
|
|
49
49
|
"@types/prompts": "^2.4.9",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"simple-git-hooks": "^2.13.1",
|
|
54
|
-
"tsdown": "^0.21.4",
|
|
55
|
-
"tsx": "^4.21.0",
|
|
56
|
-
"typescript": "^5.9.3"
|
|
57
|
-
},
|
|
58
|
-
"simple-git-hooks": {
|
|
59
|
-
"commit-msg": "pnpm soy git-commit-verify",
|
|
60
|
-
"pre-commit": "pnpm typecheck && pnpm lint-staged"
|
|
61
|
-
},
|
|
62
|
-
"lint-staged": {
|
|
63
|
-
"*": "oxlint --fix && oxfmt"
|
|
50
|
+
"tsx": "^4.23.13",
|
|
51
|
+
"typescript": "^7.0.2",
|
|
52
|
+
"vite-plus": "latest"
|
|
64
53
|
},
|
|
65
54
|
"scripts": {
|
|
66
|
-
"build": "
|
|
55
|
+
"build": "vp pack",
|
|
67
56
|
"cleanup": "soy cleanup",
|
|
68
57
|
"commit": "soy git-commit",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
58
|
+
"fmt": "vp fmt",
|
|
59
|
+
"lint": "vp lint --fix",
|
|
71
60
|
"publish-pkg": "pnpm publish --access public",
|
|
72
61
|
"release": "soy release -e 'pnpm release-execute'",
|
|
73
62
|
"release-execute": "tsx ./scripts/release.ts && pnpm soy changelog",
|
|
74
63
|
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
75
|
-
"upkg": "soy ncu"
|
|
76
|
-
"rei": "pnpm cleanup && pnpm i"
|
|
64
|
+
"upkg": "soy ncu"
|
|
77
65
|
}
|
|
78
66
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vp staged
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-ts-lib",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"registry": "https://registry.npmjs.org/"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "vp pack",
|
|
23
|
+
"cleanup": "soy cleanup",
|
|
24
|
+
"commit": "soy git-commit",
|
|
25
|
+
"fmt": "vp fmt",
|
|
26
|
+
"lint": "vp lint --fix",
|
|
27
|
+
"publish-pkg": "pnpm publish --access public",
|
|
28
|
+
"release": "soy release",
|
|
29
|
+
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
30
|
+
"upkg": "soy ncu"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@soybeanjs/cli": "^1.8.3",
|
|
34
|
+
"@soybeanjs/oxc-config": "^0.2.6",
|
|
35
|
+
"@types/node": "^26.5.1",
|
|
36
|
+
"typescript": "catalog:",
|
|
37
|
+
"vite-plus": "catalog:"
|
|
38
|
+
},
|
|
39
|
+
"packageManager": "pnpm@12.4.1"
|
|
40
|
+
}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ESNext",
|
|
4
|
+
"jsx": "preserve",
|
|
5
|
+
"jsxImportSource": "vue",
|
|
4
6
|
"lib": ["DOM", "ESNext"],
|
|
5
7
|
"module": "ESNext",
|
|
6
|
-
"moduleResolution": "
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"types": ["node", "vite/client"],
|
|
7
10
|
"paths": {
|
|
8
11
|
"@/*": ["./src/*"]
|
|
9
12
|
},
|
|
10
13
|
"resolveJsonModule": true,
|
|
11
|
-
"types": ["node"],
|
|
12
14
|
"strict": true,
|
|
13
15
|
"strictNullChecks": true,
|
|
14
|
-
"noImplicitThis": true,
|
|
15
|
-
"noUncheckedIndexedAccess": false,
|
|
16
16
|
"noUnusedLocals": true,
|
|
17
17
|
"allowSyntheticDefaultImports": true,
|
|
18
18
|
"esModuleInterop": true,
|
|
19
19
|
"forceConsistentCasingInFileNames": true,
|
|
20
|
-
"isolatedModules": true
|
|
20
|
+
"isolatedModules": true,
|
|
21
|
+
"skipLibCheck": true
|
|
21
22
|
},
|
|
22
|
-
"include": ["
|
|
23
|
+
"include": ["./**/*.ts"],
|
|
23
24
|
"exclude": ["node_modules", "dist"]
|
|
24
25
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from 'vite-plus';
|
|
2
|
+
import { lint, fmt } from '@soybeanjs/oxc-config';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
staged: {
|
|
6
|
+
'*': 'vp check --fix'
|
|
7
|
+
},
|
|
8
|
+
fmt,
|
|
9
|
+
lint,
|
|
10
|
+
resolve: {
|
|
11
|
+
tsconfigPaths: true
|
|
12
|
+
},
|
|
13
|
+
pack: {
|
|
14
|
+
entry: ['src/index.ts'],
|
|
15
|
+
platform: 'neutral',
|
|
16
|
+
clean: true,
|
|
17
|
+
dts: true,
|
|
18
|
+
sourcemap: false,
|
|
19
|
+
minify: false,
|
|
20
|
+
fixedExtension: false
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# template-ubean
|
|
2
|
+
|
|
3
|
+
基于 [ubean](https://github.com/soybeanjs/ubean) 的全栈应用模板:文件式路由、SSR/Islands 架构、i18n、API 路由。
|
|
4
|
+
|
|
5
|
+
## 使用
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install
|
|
9
|
+
pnpm dev
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
> 类型检查(`pnpm typecheck`)需先运行一次 `pnpm dev`,以生成 `.ubean/` 类型声明(该目录已在 .gitignore 中忽略)。
|
|
13
|
+
|
|
14
|
+
## 演示内容
|
|
15
|
+
|
|
16
|
+
- 页面路由: `src/pages/`(含嵌套布局 `src/layouts/`)
|
|
17
|
+
- Islands 架构: `src/components/islands/` + `/islands-test`
|
|
18
|
+
- API 路由: `src/routes/api/`(hello、users CRUD)
|
|
19
|
+
- 数据请求: `/data-fetch`
|
|
20
|
+
- i18n: `src/locales/`
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
.DS_Store
|
|
12
|
+
dist
|
|
13
|
+
dist-ssr
|
|
14
|
+
coverage
|
|
15
|
+
*.local
|
|
16
|
+
|
|
17
|
+
# ubean
|
|
18
|
+
.ubean
|
|
19
|
+
|
|
20
|
+
# Editor directories and files
|
|
21
|
+
.vscode/*
|
|
22
|
+
!.vscode/extensions.json
|
|
23
|
+
!.vscode/settings.json
|
|
24
|
+
!.vscode/launch.json
|
|
25
|
+
.idea
|
|
26
|
+
*.suo
|
|
27
|
+
*.ntvs*
|
|
28
|
+
*.njsproj
|
|
29
|
+
*.sln
|
|
30
|
+
*.sw?
|
|
31
|
+
|
|
32
|
+
.VSCodeCounter
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vp staged
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-ubean",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "ubean build",
|
|
8
|
+
"cleanup": "soy cleanup",
|
|
9
|
+
"commit": "soy git-commit",
|
|
10
|
+
"dev": "ubean dev",
|
|
11
|
+
"fmt": "vp fmt",
|
|
12
|
+
"lint": "vp lint --fix && pnpm lint:vue",
|
|
13
|
+
"lint:vue": "eslint . --ext .vue --fix",
|
|
14
|
+
"preview": "ubean preview",
|
|
15
|
+
"typecheck": "vue-tsc --noEmit --skipLibCheck",
|
|
16
|
+
"upkg": "soy ncu"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@iconify/vue": "^5.0.1",
|
|
20
|
+
"@ubean/islands": "^0.5.1",
|
|
21
|
+
"ubean": "^0.5.1",
|
|
22
|
+
"valibot": "^1.5.0",
|
|
23
|
+
"vue": "^3.5.42",
|
|
24
|
+
"vue-i18n": "^11.4.10",
|
|
25
|
+
"vue-router": "^5.3.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@soybeanjs/cli": "^1.8.3",
|
|
29
|
+
"@soybeanjs/eslint-config-vue": "^0.1.1",
|
|
30
|
+
"@soybeanjs/oxc-config": "^0.2.6",
|
|
31
|
+
"@types/node": "^26.5.1",
|
|
32
|
+
"typescript": "catalog:",
|
|
33
|
+
"vite": "catalog:",
|
|
34
|
+
"vite-plus": "catalog:",
|
|
35
|
+
"vue-tsc": "^3.3.11"
|
|
36
|
+
},
|
|
37
|
+
"packageManager": "pnpm@12.4.1"
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
catalog:
|
|
2
|
+
vite: npm:@voidzero-dev/vite-plus-core@latest
|
|
3
|
+
vite-plus: latest
|
|
4
|
+
typescript: npm:typescript-native-bridge@latest
|
|
5
|
+
overrides:
|
|
6
|
+
vite: 'catalog:'
|
|
7
|
+
typescript: 'catalog:'
|
|
8
|
+
shamefullyHoist: true
|
|
9
|
+
allowBuilds:
|
|
10
|
+
esbuild: false
|
|
11
|
+
minimumReleaseAge: 0
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<svg width="100%" height="100%" version="1.1" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"
|
|
2
|
+
xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<g>
|
|
4
|
+
<path
|
|
5
|
+
d="M 200,866 C 100,866 50,779.4 100,692.8 L 200,519.6 C 220,485 240,490 265,499.6 S 360,542.68 360,542.68 C 480.5,601 498,642.5 500,720 C 498,811 462,856 420,866"
|
|
6
|
+
fill="url(#LinearGradient)" fill-rule="nonzero" opacity="1" stroke="none" />
|
|
7
|
+
<path
|
|
8
|
+
d="M 420,866 C 455,861 478,846 500,827 C 614,696 615,597 500,517 C 394,444 333,374 380,207.82 L 260,415.67 C 240.22,450 254.37,465.1 275.28,481.79 S 360,542.68 360,542.68 C 480.5,601 498,642.5 500,720 C 498,811 462,856 420,866"
|
|
9
|
+
fill="url(#LinearGradient_2)" fill-rule="nonzero" opacity="1" stroke="none" />
|
|
10
|
+
<path d="M 500,517 C 394,444 333,374 380,207.82 L 400,173.2 C 367,295 421,350 603,428 C 572,440 524,474 500,517"
|
|
11
|
+
fill="url(#LinearGradient_3)" fill-rule="nonzero" opacity="1" stroke="none" />
|
|
12
|
+
<path d="M 500,827 L 660,660 C 738,589 710,482 603,428 C 572,440 524,474 500,517 C 615,597 614,696 500,827"
|
|
13
|
+
fill="url(#LinearGradient_4)" fill-rule="nonzero" opacity="1" stroke="none" />
|
|
14
|
+
<path d="M 400,173.2 C 367,295 421,350 603,428 C 690,389, 750,445 788,500 L 600,173.2 C 550,86.6 450,86.6 400,173.2"
|
|
15
|
+
fill="url(#LinearGradient_5)" fill-rule="nonzero" opacity="1" stroke="none" />
|
|
16
|
+
<path
|
|
17
|
+
d="M 500,827 L 660,660 C 738,589 710,482 603,428 C 690,389, 750,445 788,500 C 816,554 797,606 750,640 L 500,827"
|
|
18
|
+
fill="url(#LinearGradient_6)" fill-rule="nonzero" opacity="1" stroke="none" />
|
|
19
|
+
<path
|
|
20
|
+
d="M 788,500 C 816,554 797,606 750,640 L 500,827 C 497,851 513,862 540,866 L 800,866 C 900,866 950,779.4 900,692.8 L 788,500"
|
|
21
|
+
fill="url(#LinearGradient_7)" fill-rule="nonzero" opacity="1" stroke="none" />
|
|
22
|
+
<!-- bean -->
|
|
23
|
+
<g transform="translate(140, 650) scale(0.18)">
|
|
24
|
+
<path d="M539.04,146.5c-77.37,32.74-126.47,114.53-123.22,198,.61,150.92,169.47,210.6,214.99,341.13,39.71,96.62-16.62,230.68-122.31,253.16-374.89-83.15-390.44-785.49,30.54-792.29ZM564.61,948.5c68.1-32.18,118.51-95.45,132.49-169.97,41.81-214.6-158.22-254.7-215.15-413.02-31.14-86.21,21.33-198.66,114.56-214.57,129.21,21.58,214.93,148.7,230.96,272.19,7.94,38.53,21.57,75.37,34.41,112.43,75.75,198.26-76.06,438.99-297.26,412.94Z" fill="#ffffff" fill-rule="evenodd"/>
|
|
25
|
+
</g>
|
|
26
|
+
</g>
|
|
27
|
+
<defs>
|
|
28
|
+
<linearGradient gradientTransform="matrix(104.391 -73.3432 73.3432 104.391 277.441 710.122)"
|
|
29
|
+
gradientUnits="userSpaceOnUse" id="LinearGradient" x1="0" x2="1" y1="0" y2="0">
|
|
30
|
+
<stop offset="0" stop-color="#373ebf" />
|
|
31
|
+
<stop offset="1" stop-color="#5058e6" />
|
|
32
|
+
</linearGradient>
|
|
33
|
+
<linearGradient gradientTransform="matrix(-173.747 557.324 -557.324 -173.747 508.829 258.172)"
|
|
34
|
+
gradientUnits="userSpaceOnUse" id="LinearGradient_2" x1="0" x2="1" y1="0" y2="0">
|
|
35
|
+
<stop offset="0" stop-color="#c2d6ff" />
|
|
36
|
+
<stop offset="1" stop-color="#646cff" />
|
|
37
|
+
</linearGradient>
|
|
38
|
+
<linearGradient gradientTransform="matrix(157.951 295.666 -295.666 157.951 382.944 193.642)"
|
|
39
|
+
gradientUnits="userSpaceOnUse" id="LinearGradient_3" x1="0" x2="1" y1="0" y2="0">
|
|
40
|
+
<stop offset="0" stop-color="#5058e6" />
|
|
41
|
+
<stop offset="1" stop-color="#373ebf" />
|
|
42
|
+
</linearGradient>
|
|
43
|
+
<linearGradient gradientTransform="matrix(-44.3023 219.578 -219.578 -44.3023 619.69 469.652)"
|
|
44
|
+
gradientUnits="userSpaceOnUse" id="LinearGradient_4" x1="0" x2="1" y1="0" y2="0">
|
|
45
|
+
<stop offset="0" stop-color="#91a7ff" />
|
|
46
|
+
<stop offset="1" stop-color="#5058e6" />
|
|
47
|
+
</linearGradient>
|
|
48
|
+
<linearGradient gradientTransform="matrix(125.52 334.256 -334.256 125.52 539.723 235.139)"
|
|
49
|
+
gradientUnits="userSpaceOnUse" id="LinearGradient_5" x1="0" x2="1" y1="0" y2="0">
|
|
50
|
+
<stop offset="0" stop-color="#646cff" />
|
|
51
|
+
<stop offset="1" stop-color="#c2d6ff" />
|
|
52
|
+
</linearGradient>
|
|
53
|
+
<linearGradient gradientTransform="matrix(-241.23 357.206 -357.206 -241.23 754.054 449.312)"
|
|
54
|
+
gradientUnits="userSpaceOnUse" id="LinearGradient_6" x1="0" x2="1" y1="0" y2="0">
|
|
55
|
+
<stop offset="0" stop-color="#c2d6ff" />
|
|
56
|
+
<stop offset="1" stop-color="#646cff" />
|
|
57
|
+
</linearGradient>
|
|
58
|
+
<linearGradient gradientTransform="matrix(125.978 210.065 -210.065 125.978 596.433 613.665)"
|
|
59
|
+
gradientUnits="userSpaceOnUse" id="LinearGradient_7" x1="0" x2="1" y1="0" y2="0">
|
|
60
|
+
<stop offset="0" stop-color="#373ebf" />
|
|
61
|
+
<stop offset="1" stop-color="#5058e6" />
|
|
62
|
+
</linearGradient>
|
|
63
|
+
</defs>
|
|
64
|
+
</svg>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineApp } from 'ubean/client';
|
|
2
|
+
|
|
3
|
+
// Locales are auto-loaded by ubean:locales virtual module on the server,
|
|
4
|
+
// and auto-hydrated on the client via SSR-injected __UBEAN_LOCALE__ data.
|
|
5
|
+
// No manual defineLocale() needed here.
|
|
6
|
+
//
|
|
7
|
+
// Island components (IslandCounter, IslandClock, etc.) are auto-registered
|
|
8
|
+
// by `ubeanIslandsPlugin` and auto-hydrated by the framework after mount.
|
|
9
|
+
// No manual hydrateIslands() call needed.
|
|
10
|
+
|
|
11
|
+
export default defineApp({
|
|
12
|
+
head: {
|
|
13
|
+
title: 'ubean App',
|
|
14
|
+
meta: [
|
|
15
|
+
{ name: 'description', content: 'ubean 全栈应用模板' },
|
|
16
|
+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
rootId: 'app',
|
|
20
|
+
// 路由钩子示例 — 在 Client 和 SSR 都会执行。
|
|
21
|
+
// 守卫必须同步注册(函数体本身可以返回 Promise)。
|
|
22
|
+
router: {
|
|
23
|
+
setup(router) {
|
|
24
|
+
// 全局前置守卫:打印每次导航
|
|
25
|
+
router.beforeEach((to, from) => {
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.log(`[router] ${from.fullPath} → ${to.fullPath}`);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// 全局后置钩子:可在此处做埋点
|
|
31
|
+
router.afterEach(to => {
|
|
32
|
+
// 实际场景:发送到 analytics / 设置页面标题等
|
|
33
|
+
if (typeof document !== 'undefined' && to.meta?.title) {
|
|
34
|
+
document.title = String(to.meta.title);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, onMounted, onUnmounted } from 'vue';
|
|
3
|
+
|
|
4
|
+
const now = ref<string>('--:--:--');
|
|
5
|
+
let timer: ReturnType<typeof setInterval> | null = null;
|
|
6
|
+
|
|
7
|
+
function update() {
|
|
8
|
+
now.value = new Date().toLocaleTimeString('zh-CN', { hour12: false });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
onMounted(() => {
|
|
12
|
+
update();
|
|
13
|
+
timer = setInterval(update, 1000);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
onUnmounted(() => {
|
|
17
|
+
if (timer) clearInterval(timer);
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div class="island-clock">
|
|
23
|
+
<p class="island-label">client:idle Island</p>
|
|
24
|
+
<p class="clock-time">{{ now }}</p>
|
|
25
|
+
<p class="clock-hint">Hydrated when browser is idle</p>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style scoped>
|
|
30
|
+
.island-clock {
|
|
31
|
+
padding: 1rem;
|
|
32
|
+
border: 2px solid #3b82f6;
|
|
33
|
+
border-radius: 8px;
|
|
34
|
+
background: #eff6ff;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.island-label {
|
|
38
|
+
font-size: 0.8rem;
|
|
39
|
+
color: #1d4ed8;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
margin-bottom: 0.5rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.clock-time {
|
|
45
|
+
font-size: 1.8rem;
|
|
46
|
+
font-weight: 700;
|
|
47
|
+
color: #1e3a8a;
|
|
48
|
+
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
49
|
+
letter-spacing: 2px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.clock-hint {
|
|
53
|
+
margin-top: 0.5rem;
|
|
54
|
+
font-size: 0.75rem;
|
|
55
|
+
color: #6b7280;
|
|
56
|
+
}
|
|
57
|
+
</style>
|