@lark-apaas/coding-templates 0.1.28 → 0.1.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/coding-templates",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "OpenClaw project templates for mclaw CLI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -8,9 +8,6 @@
8
8
  <link href="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/feisuda.svg" rel="shortcut icon"/>
9
9
  </head>
10
10
  <body>
11
- <script>
12
- window.__APP_CONFIG__ = {{{appConfig}}};
13
- </script>
14
11
  <div id="root"></div>
15
12
  <script type="module" src="/src/main.tsx"></script>
16
13
  </body>
@@ -47,9 +47,8 @@
47
47
  "@radix-ui/react-toggle": "^1.1.9",
48
48
  "@radix-ui/react-toggle-group": "^1.1.10",
49
49
  "@radix-ui/react-tooltip": "^1.1.18",
50
- "@lark-apaas/client-toolkit-lite": "^0.0.2",
51
- "@lark-apaas/express-core": "^0.0.6",
52
- "@lark-apaas/express-datapaas": "^0.0.3",
50
+ "@lark-apaas/client-toolkit-lite": "^1.0.0",
51
+ "@lark-apaas/express-core": "^0.0.7",
53
52
  "@formkit/auto-animate": "^0.9.0",
54
53
  "framer-motion": "^12.38.0",
55
54
  "class-variance-authority": "^0.7.1",
@@ -78,8 +77,8 @@
78
77
  "zod": "^4.3.6"
79
78
  },
80
79
  "devDependencies": {
81
- "@lark-apaas/coding-presets": "^0.2.0",
82
- "@lark-apaas/coding-vite-preset": "^0.1.0",
80
+ "@lark-apaas/coding-presets": "^1.0.0",
81
+ "@lark-apaas/coding-vite-preset": "^1.0.0",
83
82
  "@vercel/nft": "^0.29.2",
84
83
  "@types/express": "^5",
85
84
  "@types/node": "^24",
@@ -89,11 +88,5 @@
89
88
  "tsx": "^4",
90
89
  "typescript": "~5.9",
91
90
  "vite": "^8"
92
- },
93
- "pnpm": {
94
- "onlyBuiltDependencies": [
95
- "@lark-apaas/express-datapaas",
96
- "esbuild"
97
- ]
98
91
  }
99
92
  }
@@ -2,7 +2,7 @@ import express, { type Request, type Response } from "express";
2
2
  import path from "path";
3
3
  import fs from "fs";
4
4
  import hbs from "hbs";
5
- import { setup, safeStringify, createViewContextMiddleware } from "@lark-apaas/express-core";
5
+ import { setup, createViewContextMiddleware } from "@lark-apaas/express-core";
6
6
  import * as schema from "./db/schema";
7
7
  import { registerRoutes } from "./routes/index";
8
8
 
@@ -29,10 +29,6 @@ const template = hbs.compile(fs.readFileSync(templatePath, "utf-8"));
29
29
  router.get("/{*path}", createViewContextMiddleware(), (_req: Request, res: Response) => {
30
30
  const html = template({
31
31
  ...res.locals,
32
- appConfig: safeStringify({
33
- appId: res.locals.appId || process.env.MCLAW_APP_ID || "",
34
- cdnDomain: process.env.MCLAW_CDN_DOMAIN || "",
35
- }),
36
32
  });
37
33
  res.type("html").send(html);
38
34
  });
@@ -3,11 +3,9 @@ import { Layout } from "@/components/layout";
3
3
  import HomePage from "@/pages/HomePage/HomePage";
4
4
  import NotFoundPage from "@/pages/NotFoundPage/NotFoundPage";
5
5
 
6
- declare const __APP_BASE_PATH__: string;
7
-
8
6
  export default function App() {
9
7
  return (
10
- <BrowserRouter basename={__APP_BASE_PATH__}>
8
+ <BrowserRouter basename={process.env.CLIENT_BASE_PATH || '/'}>
11
9
  <Routes>
12
10
  <Route element={<Layout />}>
13
11
  <Route index element={<HomePage />} />
@@ -609,7 +609,6 @@ function SidebarMenuSkeleton({
609
609
  }) {
610
610
  // Random width between 50 to 90%.
611
611
  const width = React.useMemo(() => {
612
- // eslint-disable-next-line react-hooks/purity
613
612
  return `${Math.floor(Math.random() * 40) + 50}%`
614
613
  }, [])
615
614
 
@@ -1,10 +1,14 @@
1
1
  import { StrictMode } from "react";
2
2
  import { createRoot } from "react-dom/client";
3
+ import { AppContainer } from "@lark-apaas/client-toolkit-lite";
4
+ import "@lark-apaas/client-toolkit-lite/styles";
3
5
  import App from "./app";
4
6
  import "./index.css";
5
7
 
6
8
  createRoot(document.getElementById("root")!).render(
7
9
  <StrictMode>
8
- <App />
10
+ <AppContainer>
11
+ <App />
12
+ </AppContainer>
9
13
  </StrictMode>,
10
14
  );
@@ -6,7 +6,9 @@
6
6
  "mclaw": {
7
7
  "stack": "vite-react",
8
8
  "stackVersion": "0.1.0",
9
- "features": ["client"]
9
+ "features": [
10
+ "client"
11
+ ]
10
12
  },
11
13
  "scripts": {
12
14
  "dev": "vite",
@@ -43,7 +45,7 @@
43
45
  "@radix-ui/react-toggle": "^1.1.9",
44
46
  "@radix-ui/react-toggle-group": "^1.1.10",
45
47
  "@radix-ui/react-tooltip": "^1.1.18",
46
- "@tailwindcss/vite": "^4.2.2",
48
+ "@lark-apaas/client-toolkit-lite": "^1.0.0",
47
49
  "@formkit/auto-animate": "^0.9.0",
48
50
  "framer-motion": "^12.38.0",
49
51
  "class-variance-authority": "^0.7.1",
@@ -64,7 +66,7 @@
64
66
  "react-router-dom": "^7.13.2",
65
67
  "recharts": "^3.8.0",
66
68
  "sonner": "^2.0.7",
67
- "tailwind-merge": "^3.5.0",
69
+ "tailwind-merge": "^3.5.0",
68
70
  "tailwindcss": "^4.2.2",
69
71
  "tw-animate-css": "^1.2.0",
70
72
  "vaul": "^1.1.2",
@@ -75,7 +77,8 @@
75
77
  "@types/node": "^24",
76
78
  "@types/react": "^19",
77
79
  "@types/react-dom": "^19",
78
- "@vitejs/plugin-react": "^6",
80
+ "@lark-apaas/coding-presets": "^1.0.0",
81
+ "@lark-apaas/coding-vite-preset": "^1.0.0",
79
82
  "eslint": "^9",
80
83
  "eslint-plugin-react-hooks": "^7",
81
84
  "eslint-plugin-react-refresh": "^0.5",
@@ -6,6 +6,11 @@ OUTPUT="$ROOT/dist/output"
6
6
  OUTPUT_RESOURCE="$ROOT/dist/output_resource"
7
7
  OUTPUT_STATIC="$ROOT/dist/output_static"
8
8
 
9
+ # 映射平台环境变量到 preset 期望的变量名
10
+ export CLIENT_BASE_PATH="${MCLAW_APP_ID:+/app/$MCLAW_APP_ID}"
11
+ export ASSETS_CDN_PATH="${MCLAW_CDN_DOMAIN:-/}"
12
+ export NODE_ENV="${NODE_ENV:-production}"
13
+
9
14
  # 清理
10
15
  rm -rf "$ROOT/dist"
11
16
 
@@ -1,28 +1,8 @@
1
1
  {
2
+ "extends": "@lark-apaas/coding-presets/lib/tsconfig/tsconfig.app.json",
2
3
  "compilerOptions": {
3
4
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
- "target": "ES2023",
5
- "useDefineForClassFields": true,
6
- "lib": ["ES2023", "DOM", "DOM.Iterable"],
7
- "module": "ESNext",
8
5
  "types": ["vite/client"],
9
- "skipLibCheck": true,
10
-
11
- /* Bundler mode */
12
- "moduleResolution": "bundler",
13
- "allowImportingTsExtensions": true,
14
- "verbatimModuleSyntax": true,
15
- "moduleDetection": "force",
16
- "noEmit": true,
17
- "jsx": "react-jsx",
18
-
19
- /* Linting */
20
- "strict": true,
21
- "noUnusedLocals": true,
22
- "noUnusedParameters": true,
23
- "erasableSyntaxOnly": true,
24
- "noFallthroughCasesInSwitch": true,
25
- "noUncheckedSideEffectImports": true,
26
6
  "baseUrl": ".",
27
7
  "paths": {
28
8
  "@/*": ["./client/src/*"],
@@ -1,18 +1,8 @@
1
1
  import path from 'path'
2
- import { defineConfig } from 'vite'
3
- import react from '@vitejs/plugin-react'
4
- import tailwindcss from '@tailwindcss/vite'
2
+ import { defineConfig } from '@lark-apaas/coding-vite-preset'
5
3
 
6
- // https://vite.dev/config/
7
4
  export default defineConfig({
8
5
  root: path.resolve(__dirname, 'client'),
9
- base: process.env.MCLAW_CDN_DOMAIN || '/',
10
- plugins: [react(), tailwindcss()],
11
- define: {
12
- __APP_BASE_PATH__: JSON.stringify(
13
- process.env.MCLAW_APP_ID ? `/app/${process.env.MCLAW_APP_ID}` : '/',
14
- ),
15
- },
16
6
  resolve: {
17
7
  alias: {
18
8
  '@': path.resolve(__dirname, 'client/src'),
@@ -1,7 +0,0 @@
1
- // API 层示例
2
- // 根据实际后端接口补充
3
-
4
- export async function fetchExample() {
5
- const response = await fetch("/api/example");
6
- return response.json();
7
- }