@lark-apaas/coding-templates 0.1.27 → 0.1.29
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/index.html +0 -3
- package/template-apex/package.json +1 -9
- package/template-apex/server/index.ts +1 -5
- package/template-vite-react/client/src/app.tsx +1 -3
- package/template-vite-react/client/src/components/ui/sidebar.tsx +0 -1
- package/template-vite-react/client/src/main.tsx +5 -1
- package/template-vite-react/package.json +3 -2
- package/template-vite-react/scripts/build.sh +5 -0
- package/template-vite-react/tsconfig.app.json +1 -21
- package/template-vite-react/vite.config.ts +1 -11
- package/template-vite-react/client/src/api/index.ts +0 -7
package/package.json
CHANGED
|
@@ -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>
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"postinstall": "pnpm rebuild @lark-apaas/express-datapaas",
|
|
16
15
|
"dev": "tsx --watch --watch-path server --watch-path shared server/index.ts",
|
|
17
16
|
"build": "bash scripts/build.sh",
|
|
18
17
|
"lint": "npm run lint:client && npm run lint:server",
|
|
@@ -49,8 +48,7 @@
|
|
|
49
48
|
"@radix-ui/react-toggle-group": "^1.1.10",
|
|
50
49
|
"@radix-ui/react-tooltip": "^1.1.18",
|
|
51
50
|
"@lark-apaas/client-toolkit-lite": "^0.0.2",
|
|
52
|
-
"@lark-apaas/express-core": "^0.0.
|
|
53
|
-
"@lark-apaas/express-datapaas": "^0.0.3",
|
|
51
|
+
"@lark-apaas/express-core": "^0.0.7",
|
|
54
52
|
"@formkit/auto-animate": "^0.9.0",
|
|
55
53
|
"framer-motion": "^12.38.0",
|
|
56
54
|
"class-variance-authority": "^0.7.1",
|
|
@@ -90,11 +88,5 @@
|
|
|
90
88
|
"tsx": "^4",
|
|
91
89
|
"typescript": "~5.9",
|
|
92
90
|
"vite": "^8"
|
|
93
|
-
},
|
|
94
|
-
"pnpm": {
|
|
95
|
-
"onlyBuiltDependencies": [
|
|
96
|
-
"@lark-apaas/express-datapaas",
|
|
97
|
-
"esbuild"
|
|
98
|
-
]
|
|
99
91
|
}
|
|
100
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,
|
|
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={
|
|
8
|
+
<BrowserRouter basename={process.env.CLIENT_BASE_PATH || '/'}>
|
|
11
9
|
<Routes>
|
|
12
10
|
<Route element={<Layout />}>
|
|
13
11
|
<Route index element={<HomePage />} />
|
|
@@ -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
|
-
<
|
|
10
|
+
<AppContainer>
|
|
11
|
+
<App />
|
|
12
|
+
</AppContainer>
|
|
9
13
|
</StrictMode>,
|
|
10
14
|
);
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@radix-ui/react-toggle": "^1.1.9",
|
|
44
44
|
"@radix-ui/react-toggle-group": "^1.1.10",
|
|
45
45
|
"@radix-ui/react-tooltip": "^1.1.18",
|
|
46
|
-
"@
|
|
46
|
+
"@lark-apaas/client-toolkit-lite": "^0.0.3",
|
|
47
47
|
"@formkit/auto-animate": "^0.9.0",
|
|
48
48
|
"framer-motion": "^12.38.0",
|
|
49
49
|
"class-variance-authority": "^0.7.1",
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
"@types/node": "^24",
|
|
76
76
|
"@types/react": "^19",
|
|
77
77
|
"@types/react-dom": "^19",
|
|
78
|
-
"@
|
|
78
|
+
"@lark-apaas/coding-presets": "^0.2.0",
|
|
79
|
+
"@lark-apaas/coding-vite-preset": "^0.1.0",
|
|
79
80
|
"eslint": "^9",
|
|
80
81
|
"eslint-plugin-react-hooks": "^7",
|
|
81
82
|
"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'),
|