@lark-apaas/coding-templates 0.1.34 → 0.1.35-alpha.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/package.json +1 -1
- package/template-apex/client/src/main.tsx +0 -1
- package/template-apex/{eslint.config.js → eslint.config.mjs} +4 -2
- package/template-apex/package.json +8 -5
- package/template-apex/server/db/schema.ts +1 -11
- package/template-apex/server/index.ts +3 -21
- package/template-apex/server/routes/index.ts +6 -2
- package/template-apex/server/routes/view.ts +16 -0
- package/template-apex/tsconfig.server.json +0 -2
- package/template-vite-react/client/src/main.tsx +0 -1
- package/template-vite-react/{eslint.config.js → eslint.config.mjs} +1 -1
- package/template-vite-react/package.json +6 -8
- package/template-apex/_env.local.example +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { eslintPresets } from '@lark-apaas/coding-presets'
|
|
2
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
2
3
|
|
|
3
|
-
export default [
|
|
4
|
+
export default defineConfig([
|
|
5
|
+
globalIgnores(['dist', '**/components/ui/**']),
|
|
4
6
|
// 客户端:React + TypeScript
|
|
5
7
|
...eslintPresets.client.map(config => config.ignores ? config : {
|
|
6
8
|
...config,
|
|
@@ -11,4 +13,4 @@ export default [
|
|
|
11
13
|
...config,
|
|
12
14
|
files: ['server/**/*.ts', 'shared/**/*.ts'],
|
|
13
15
|
}),
|
|
14
|
-
]
|
|
16
|
+
])
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"dev": "tsx --watch --watch-path server --watch-path shared server/index.ts",
|
|
15
14
|
"build": "bash scripts/build.sh",
|
|
16
|
-
"typecheck": "npm
|
|
15
|
+
"typecheck": "concurrently npm:typecheck:client npm:typecheck:server",
|
|
17
16
|
"typecheck:client": "tsc -p tsconfig.app.json",
|
|
18
|
-
"
|
|
17
|
+
"typecheck:server": "tsc --noEmit -p tsconfig.server.json",
|
|
18
|
+
"lint": "concurrently npm:typecheck npm:lint:client npm:lint:server",
|
|
19
19
|
"lint:client": "eslint client/src",
|
|
20
20
|
"lint:server": "eslint server",
|
|
21
21
|
"gen:db-schema": "npx -y @lark-apaas/db-schema-sync@latest --output server/db/schema.ts"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@radix-ui/react-toggle": "^1.1.9",
|
|
49
49
|
"@radix-ui/react-toggle-group": "^1.1.10",
|
|
50
50
|
"@radix-ui/react-tooltip": "^1.1.18",
|
|
51
|
-
"@lark-apaas/client-toolkit-lite": "^1.0.0",
|
|
51
|
+
"@lark-apaas/client-toolkit-lite": "^1.1.0-alpha.0",
|
|
52
52
|
"@lark-apaas/express-core": "^0.0.9",
|
|
53
53
|
"@formkit/auto-animate": "^0.9.0",
|
|
54
54
|
"framer-motion": "^12.38.0",
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
"cmdk": "^1.1.1",
|
|
58
58
|
"date-fns": "^4.1.0",
|
|
59
59
|
"drizzle-orm": "0.44.6",
|
|
60
|
+
"echarts": "~5.6.0",
|
|
61
|
+
"echarts-for-react": "~3.0.2",
|
|
60
62
|
"embla-carousel-react": "^8.6.0",
|
|
61
63
|
"express": "^5.1.0",
|
|
62
64
|
"hbs": "^4.2.0",
|
|
@@ -78,13 +80,14 @@
|
|
|
78
80
|
"zod": "^4.3.6"
|
|
79
81
|
},
|
|
80
82
|
"devDependencies": {
|
|
81
|
-
"@lark-apaas/coding-presets": "^1.0.0",
|
|
83
|
+
"@lark-apaas/coding-presets": "^1.0.1-alpha.0",
|
|
82
84
|
"@lark-apaas/coding-vite-preset": "^1.0.0",
|
|
83
85
|
"@vercel/nft": "^0.29.2",
|
|
84
86
|
"@types/express": "^5",
|
|
85
87
|
"@types/node": "^24",
|
|
86
88
|
"@types/react": "^19",
|
|
87
89
|
"@types/react-dom": "^19",
|
|
90
|
+
"concurrently": "^9",
|
|
88
91
|
"eslint": "^9",
|
|
89
92
|
"tsc-alias": "^1.8.15",
|
|
90
93
|
"tsx": "^4",
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
// import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
|
|
4
|
-
//
|
|
5
|
-
// 使用示例:
|
|
6
|
-
// export const posts = pgTable("posts", {
|
|
7
|
-
// id: serial("id").primaryKey(),
|
|
8
|
-
// title: text("title").notNull(),
|
|
9
|
-
// content: text("content"),
|
|
10
|
-
// createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
11
|
-
// });
|
|
1
|
+
/* 该文件通过 npm run gen:db-schema 自动生成*/
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import express
|
|
2
|
-
import
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import hbs from "hbs";
|
|
5
|
-
import { setup, createViewContextMiddleware } from "@lark-apaas/express-core";
|
|
6
|
-
import * as schema from "./db/schema";
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { setup } from "@lark-apaas/express-core";
|
|
7
3
|
import { registerRoutes } from "./routes/index";
|
|
8
4
|
|
|
9
5
|
const port = Number(process.env.FORCE_SERVER_PORT) || 3000;
|
|
@@ -13,26 +9,12 @@ const basePath = process.env.CLIENT_BASE_PATH || "/";
|
|
|
13
9
|
const app = express();
|
|
14
10
|
|
|
15
11
|
// Platform middleware
|
|
16
|
-
const { close } = setup(app
|
|
17
|
-
database: { schema },
|
|
18
|
-
csrf: { enabled: false },
|
|
19
|
-
viewContext: { enabled: false },
|
|
20
|
-
});
|
|
12
|
+
const { close } = setup(app);
|
|
21
13
|
|
|
22
14
|
// All routes under basePath
|
|
23
15
|
const router = express.Router();
|
|
24
16
|
registerRoutes(router);
|
|
25
17
|
|
|
26
|
-
const templatePath = path.resolve(__dirname, "../index.html");
|
|
27
|
-
const template = hbs.compile(fs.readFileSync(templatePath, "utf-8"));
|
|
28
|
-
|
|
29
|
-
router.get("/{*path}", createViewContextMiddleware(), (_req: Request, res: Response) => {
|
|
30
|
-
const html = template({
|
|
31
|
-
...res.locals,
|
|
32
|
-
});
|
|
33
|
-
res.type("html").send(html);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
18
|
app.use(basePath, router);
|
|
37
19
|
|
|
38
20
|
const server = app.listen(port, host, () => {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
+
import { registerViewRoute } from "./view";
|
|
2
3
|
// import postsRouter from "./posts";
|
|
3
4
|
|
|
4
|
-
export function registerRoutes(
|
|
5
|
+
export function registerRoutes(router: Router) {
|
|
5
6
|
// 在此注册 API 路由
|
|
6
7
|
//
|
|
7
8
|
// 使用示例:
|
|
8
|
-
//
|
|
9
|
+
// router.use("/api/posts", postsRouter);
|
|
10
|
+
|
|
11
|
+
// HTML 页面渲染(catch-all,必须放在最后)
|
|
12
|
+
registerViewRoute(router);
|
|
9
13
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import hbs from "hbs";
|
|
4
|
+
import type { Request, Response, Router } from "express";
|
|
5
|
+
|
|
6
|
+
const templatePath = path.resolve(__dirname, "../../index.html");
|
|
7
|
+
const template = hbs.compile(fs.readFileSync(templatePath, "utf-8"));
|
|
8
|
+
|
|
9
|
+
export function registerViewRoute(router: Router) {
|
|
10
|
+
router.get("/{*path}", (_req: Request, res: Response) => {
|
|
11
|
+
const html = template({
|
|
12
|
+
...res.locals,
|
|
13
|
+
});
|
|
14
|
+
res.type("html").send(html);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
"rootDir": ".",
|
|
6
6
|
"module": "commonjs",
|
|
7
7
|
"moduleResolution": "node",
|
|
8
|
-
"verbatimModuleSyntax": false,
|
|
9
8
|
"esModuleInterop": true,
|
|
10
9
|
"noEmit": false,
|
|
11
10
|
"allowImportingTsExtensions": false,
|
|
12
|
-
"noUnusedParameters": false,
|
|
13
11
|
"baseUrl": ".",
|
|
14
12
|
"paths": {
|
|
15
13
|
"@shared/*": ["./shared/*"]
|
|
@@ -10,13 +10,10 @@
|
|
|
10
10
|
]
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"dev": "vite",
|
|
14
13
|
"build": "bash scripts/build.sh",
|
|
15
|
-
"typecheck": "
|
|
16
|
-
"
|
|
17
|
-
"lint": "
|
|
18
|
-
"lint:client": "eslint client/src",
|
|
19
|
-
"preview": "vite preview"
|
|
14
|
+
"typecheck": "tsc -p tsconfig.app.json",
|
|
15
|
+
"lint": "concurrently npm:typecheck npm:lint:eslint",
|
|
16
|
+
"lint:eslint": "eslint client/src"
|
|
20
17
|
},
|
|
21
18
|
"dependencies": {
|
|
22
19
|
"@hookform/resolvers": "^5.2.2",
|
|
@@ -46,7 +43,7 @@
|
|
|
46
43
|
"@radix-ui/react-toggle": "^1.1.9",
|
|
47
44
|
"@radix-ui/react-toggle-group": "^1.1.10",
|
|
48
45
|
"@radix-ui/react-tooltip": "^1.1.18",
|
|
49
|
-
"@lark-apaas/client-toolkit-lite": "^1.0.0",
|
|
46
|
+
"@lark-apaas/client-toolkit-lite": "^1.1.0-alpha.0",
|
|
50
47
|
"@formkit/auto-animate": "^0.9.0",
|
|
51
48
|
"framer-motion": "^12.38.0",
|
|
52
49
|
"class-variance-authority": "^0.7.1",
|
|
@@ -78,8 +75,9 @@
|
|
|
78
75
|
"@types/node": "^24",
|
|
79
76
|
"@types/react": "^19",
|
|
80
77
|
"@types/react-dom": "^19",
|
|
81
|
-
"@lark-apaas/coding-presets": "^1.0.0",
|
|
78
|
+
"@lark-apaas/coding-presets": "^1.0.1-alpha.0",
|
|
82
79
|
"@lark-apaas/coding-vite-preset": "^1.0.0",
|
|
80
|
+
"concurrently": "^9",
|
|
83
81
|
"eslint": "^9",
|
|
84
82
|
"eslint-plugin-react-hooks": "^7",
|
|
85
83
|
"eslint-plugin-react-refresh": "^0.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/openclaw
|