@tbox.cn/app-template-h5 0.1.0

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.
@@ -0,0 +1,26 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ format: ['esm'],
6
+ target: 'node24',
7
+ platform: 'node',
8
+ outDir: 'dist',
9
+ clean: true,
10
+ sourcemap: true,
11
+ // vite 禁进 bundle 的结构防线:静态入口图(entry: index.ts → app.ts 链)任何 vite 引用
12
+ // (含 dev.ts 误入 entry)在 onResolve 即失败——dev 形态仅存在于 src/dev.ts(tsx 运行)。
13
+ esbuildPlugins: [
14
+ {
15
+ name: 'forbid-vite-in-bundle',
16
+ setup(build) {
17
+ build.onResolve({ filter: /^vite(\/|$)/ }, () => ({
18
+ errors: [
19
+ { text: 'vite 禁止进入 server bundle:dev 形态走 src/dev.ts(仅 tsx),禁入 tsup entry' },
20
+ ],
21
+ }));
22
+ },
23
+ },
24
+ ],
25
+ external: ['express', 'path', 'url', 'http', 'fs'],
26
+ });
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'node',
7
+ },
8
+ });
@@ -0,0 +1,36 @@
1
+ import tseslint from "typescript-eslint";
2
+ import reactHooks from "eslint-plugin-react-hooks";
3
+
4
+ export default [
5
+ {
6
+ files: ["apps/**/*.ts", "apps/**/*.tsx"],
7
+ plugins: {
8
+ "@typescript-eslint": tseslint.plugin,
9
+ "react-hooks": reactHooks,
10
+ },
11
+ languageOptions: {
12
+ parser: tseslint.parser,
13
+ parserOptions: {
14
+ sourceType: "module",
15
+ },
16
+ },
17
+ linterOptions: {
18
+ reportUnusedDisableDirectives: "off",
19
+ },
20
+ rules: {
21
+ "quotes": ["error", "single", { "avoidEscape": true }],
22
+ "no-restricted-syntax": [
23
+ "error",
24
+ {
25
+ selector:
26
+ "CallExpression[callee.property.name='listen'] > Literal[raw=/^\\d{4,5}$/]",
27
+ message:
28
+ "禁止硬编码端口号。必须使用 process.env.PORT || 8000。",
29
+ },
30
+ ],
31
+ },
32
+ },
33
+ {
34
+ ignores: ["**/dist/**", "**/node_modules/**", "**/.vite/**"],
35
+ },
36
+ ];
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@tbox.cn/app-template-h5",
3
+ "version": "0.1.0",
4
+ "description": "tbox 移动 H5 全栈模板(单 workspace:apps/client + apps/server),运行时与页面微调经 @tbox.cn/app-sdk。",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=24.0.0 <25.0.0"
8
+ },
9
+ "license": "MIT",
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "files": [
14
+ "apps",
15
+ "!apps/**/dist",
16
+ "!apps/**/dist-ssr",
17
+ "!apps/**/.vite",
18
+ "!apps/**/node_modules",
19
+ "!apps/**/*.tsbuildinfo",
20
+ "scripts",
21
+ ".tbox",
22
+ ".gitignore",
23
+ ".nvmrc",
24
+ "AGENTS.md",
25
+ "LEGAL.md",
26
+ "README.md",
27
+ "LICENSE",
28
+ "eslint.config.mjs",
29
+ "pnpm-workspace.template.yaml",
30
+ "pnpm-lock.template.yaml",
31
+ "tsconfig.base.json"
32
+ ],
33
+ "devDependencies": {
34
+ "@tbox.cn/app-sdk": "0.20.0",
35
+ "eslint": "9.39.5",
36
+ "eslint-plugin-react-hooks": "5.2.0",
37
+ "typescript-eslint": "8.67.0",
38
+ "vite": "6.4.3"
39
+ },
40
+ "scripts": {
41
+ "dev": "pnpm --filter ./apps/server dev",
42
+ "build": "pnpm check && pnpm --filter ./apps/server build && pnpm --filter ./apps/client build",
43
+ "build:client": "pnpm check && pnpm --filter ./apps/client build",
44
+ "typecheck": "pnpm -r --filter \"./apps/*\" typecheck",
45
+ "test": "pnpm -r --filter \"./apps/*\" test",
46
+ "lint": "eslint apps",
47
+ "verify": "pnpm typecheck && pnpm test && pnpm lint && pnpm build && pnpm check:inspector",
48
+ "check": "pnpm check:workspace && pnpm check:inspector",
49
+ "check:workspace": "node scripts/check-workspace.mjs",
50
+ "check:inspector": "tbox-inspector-check"
51
+ }
52
+ }