@tbox.cn/app-template-h5 1.0.0-alpha.1 → 1.0.0-alpha.10

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.
Files changed (65) hide show
  1. package/._.gitignore +0 -0
  2. package/._.npmignore +0 -0
  3. package/._.nvmrc +0 -0
  4. package/._AGENTS.md +0 -0
  5. package/._LEGAL.md +0 -0
  6. package/._LICENSE +0 -0
  7. package/._README.md +0 -0
  8. package/._eslint.config.mjs +0 -0
  9. package/._package.json +0 -0
  10. package/._pnpm-lock.template.yaml +0 -0
  11. package/._pnpm-workspace.template.yaml +0 -0
  12. package/._tsconfig.base.json +0 -0
  13. package/.gitignore +9 -1
  14. package/.tbox/._app.json +0 -0
  15. package/.tbox/app.json +1 -1
  16. package/AGENTS.md +16 -10
  17. package/README.md +0 -1
  18. package/apps/._AGENTS.md +0 -0
  19. package/apps/AGENTS.md +2 -6
  20. package/apps/client/._index.html +0 -0
  21. package/apps/client/._package.json +0 -0
  22. package/apps/client/._tsconfig.json +0 -0
  23. package/apps/client/._vite.config.ts +0 -0
  24. package/apps/client/._vitest.config.ts +0 -0
  25. package/apps/client/package.json +5 -2
  26. package/apps/client/src/._app.config.ts +0 -0
  27. package/apps/client/src/._vite-env.d.ts +0 -0
  28. package/apps/client/src/app.config.ts +10 -0
  29. package/apps/client/src/pages/._page.tsx +0 -0
  30. package/apps/client/src/pages/page.tsx +9 -5
  31. package/apps/client/src/styles/._tailwind.css +0 -0
  32. package/apps/client/src/styles/tailwind.css +101 -0
  33. package/apps/client/vite.config.ts +8 -2
  34. package/apps/server/._package.json +0 -0
  35. package/apps/server/._tsconfig.json +0 -0
  36. package/apps/server/._tsup.config.ts +0 -0
  37. package/apps/server/._vitest.config.ts +0 -0
  38. package/apps/server/src/._app.ts +0 -0
  39. package/apps/server/src/._dev.ts +0 -0
  40. package/apps/server/src/._index.ts +0 -0
  41. package/apps/server/src/dev.ts +2 -2
  42. package/apps/server/src/functions/._greet.server.ts +0 -0
  43. package/apps/server/src/index.ts +2 -2
  44. package/apps/server/tests/._app.test.ts +0 -0
  45. package/modules/._.gitkeep +0 -0
  46. package/package.json +16 -9
  47. package/packages/shared/._AGENTS.md +0 -0
  48. package/packages/shared/._package.json +0 -0
  49. package/packages/shared/._tsconfig.json +0 -0
  50. package/packages/shared/src/._index.ts +0 -0
  51. package/pnpm-lock.template.yaml +531 -189
  52. package/pnpm-workspace.template.yaml +10 -8
  53. package/scripts/._build.sh +0 -0
  54. package/scripts/._check-css-target.mjs +0 -0
  55. package/scripts/._check.mjs +0 -0
  56. package/scripts/._dev.sh +0 -0
  57. package/scripts/._generate.mjs +0 -0
  58. package/scripts/._start.sh +0 -0
  59. package/scripts/._stop.sh +0 -0
  60. package/scripts/check-css-target.mjs +54 -0
  61. package/apps/client/src/platform/bootstrap.ts +0 -11
  62. package/apps/client/src/platform/mount-page.tsx +0 -26
  63. package/apps/client/src/styles/base.css +0 -21
  64. package/scripts/agents-check.mjs +0 -23
  65. package/scripts/agents-sync.mjs +0 -9
@@ -22,6 +22,8 @@ catalog:
22
22
  tsx: 4.23.11
23
23
  vite: 6.4.3
24
24
  vitest: 4.1.10
25
+ tailwindcss: 4.3.5
26
+ "@tailwindcss/vite": 4.3.5
25
27
  react: 18.3.1
26
28
  react-dom: 18.3.1
27
29
  "@types/react": 18.3.31
@@ -29,14 +31,14 @@ catalog:
29
31
  "@types/node": 24.13.3
30
32
  express: 4.22.2
31
33
  "@types/express": 4.17.25
32
- "@tbox.cn/app-sdk-core": 1.0.0-alpha.1
33
- "@tbox.cn/app-sdk-client": 1.0.0-alpha.1
34
- "@tbox.cn/app-sdk-server": 1.0.0-alpha.1
35
- "@tbox.cn/app-build": 1.0.0-alpha.1
36
- "@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.1
37
- "@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.1
38
- "@tbox.cn/app-contracts": 1.0.0-alpha.1
39
- "@tbox.cn/app-contracts-mall": 1.0.0-alpha.1
34
+ "@tbox.cn/app-sdk-core": 1.0.0-alpha.10
35
+ "@tbox.cn/app-sdk-client": 1.0.0-alpha.10
36
+ "@tbox.cn/app-sdk-server": 1.0.0-alpha.10
37
+ "@tbox.cn/app-build": 1.0.0-alpha.10
38
+ "@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.10
39
+ "@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.10
40
+ "@tbox.cn/app-contracts": 1.0.0-alpha.10
41
+ "@tbox.cn/app-contracts-mall": 1.0.0-alpha.10
40
42
  eslint: 9.39.5
41
43
  typescript-eslint: 8.67.0
42
44
  eslint-plugin-react-hooks: 5.2.0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * check-css-target — 产物兼容门禁(多引擎矩阵 + 兜底后能力)。
4
+ *
5
+ * 读 `apps/client/dist/assets/*.css`,按模板 `package.json` 的 `tbox.compat.baseline` 判定:
6
+ * baseline = { "safari": 16.4, "chrome": 105 } // 矩阵;缺任一引擎即判基线非法
7
+ * 判定内核在 `@tbox.cn/app-build/compat`(与根级 `verify:css` 同一份实现):
8
+ * - 所有声明引擎都满足才算通过(AND,不是任一引擎通过);
9
+ * - 先剥掉 `@supports` 条件块再判,条件块内属于渐进增强。
10
+ * **缺产物 = 失败**(fail-closed):没有证据不得放行。
11
+ *
12
+ * 用法:node scripts/check-css-target.mjs [--baseline "safari 16.4, chrome 105"] [--json]
13
+ * 退出码:0 = 产物在基线内;1 = 越线 / 基线非法 / 无产物。
14
+ */
15
+ import { readFileSync } from 'node:fs';
16
+ import path from 'node:path';
17
+ import process from 'node:process';
18
+ import { checkDist, formatBaseline } from '@tbox.cn/app-build/compat';
19
+
20
+ const appDir = path.resolve(import.meta.dirname, '..');
21
+ const args = process.argv.slice(2);
22
+ const asJson = args.includes('--json');
23
+ const baselineArg = args.indexOf('--baseline');
24
+ const pkg = JSON.parse(readFileSync(path.join(appDir, 'package.json'), 'utf8'));
25
+ const baseline = baselineArg >= 0 ? args[baselineArg + 1] : pkg?.tbox?.compat?.baseline;
26
+ const result = checkDist({ appDir, baseline });
27
+
28
+ if (asJson) {
29
+ console.log(
30
+ JSON.stringify(
31
+ {
32
+ ok: result.ok,
33
+ baseline: formatBaseline(baseline),
34
+ engines: result.engines,
35
+ files: result.files.length,
36
+ bytes: result.totalBytes,
37
+ errors: result.errors,
38
+ findings: result.findings,
39
+ },
40
+ null,
41
+ 2,
42
+ ),
43
+ );
44
+ } else if (result.ok) {
45
+ console.log(`✅ 产物在基线内:${formatBaseline(baseline)}(${result.files.length} 个 CSS,${result.totalBytes} B)`);
46
+ } else {
47
+ for (const error of result.errors) console.error(`❌ ${error}`);
48
+ for (const finding of result.findings) {
49
+ console.error(
50
+ `❌ ${finding.file} ${finding.feature}(${finding.sample}):${finding.message}——${finding.fix}`,
51
+ );
52
+ }
53
+ }
54
+ process.exitCode = result.ok ? 0 : 1;
@@ -1,11 +0,0 @@
1
- import { configureRuntime, installGlobalErrorReporting } from '@tbox.cn/app-sdk-client';
2
- import '../styles/base.css';
3
-
4
- let bootstrapped = false;
5
-
6
- export function bootstrap(): void {
7
- if (bootstrapped) return;
8
- bootstrapped = true;
9
- configureRuntime({ apiBaseUrl: import.meta.env.VITE_API_URL as string | undefined });
10
- installGlobalErrorReporting();
11
- }
@@ -1,26 +0,0 @@
1
- import { StrictMode, type ComponentType } from 'react';
2
- import { createRoot } from 'react-dom/client';
3
- import { ErrorBoundary } from '@tbox.cn/app-sdk-client';
4
- import { bootstrap } from './bootstrap';
5
-
6
- export function mountPage(Page: ComponentType): void {
7
- bootstrap();
8
- const el = document.getElementById('root');
9
- if (!el) return;
10
- createRoot(el).render(
11
- <StrictMode>
12
- <ErrorBoundary
13
- fallback={
14
- <main style={{ padding: 24 }}>
15
- <h1>页面暂时不可用</h1>
16
- <button type="button" onClick={() => window.location.reload()}>
17
- 重新加载
18
- </button>
19
- </main>
20
- }
21
- >
22
- <Page />
23
- </ErrorBoundary>
24
- </StrictMode>,
25
- );
26
- }
@@ -1,21 +0,0 @@
1
- :root {
2
- color-scheme: light;
3
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
4
- color: #1f2329;
5
- background: #f7f8fa;
6
- }
7
-
8
- * {
9
- box-sizing: border-box;
10
- }
11
-
12
- html,
13
- body,
14
- #root {
15
- min-height: 100%;
16
- margin: 0;
17
- }
18
-
19
- body {
20
- margin: 0;
21
- }
@@ -1,23 +0,0 @@
1
- import { existsSync, readdirSync } from 'node:fs';
2
- import { readFile } from 'node:fs/promises';
3
- import path from 'node:path';
4
- import { composeAgents } from '@tbox.cn/app-build';
5
-
6
- const root = process.cwd();
7
- const modulesDir = path.join(root, 'modules');
8
- const hasModules = existsSync(modulesDir) && readdirSync(modulesDir, { withFileTypes: true }).some((entry) => entry.isDirectory());
9
- const composed = await composeAgents({ appKind: 'web', hasModules });
10
- const targets = [
11
- ['AGENTS.md', composed.root],
12
- ['apps/AGENTS.md', composed.app],
13
- ];
14
- if (composed.modules) targets.push(['modules/AGENTS.md', composed.modules]);
15
- let failed = false;
16
- for (const [file, expected] of targets) {
17
- const actual = await readFile(path.join(root, file), 'utf8');
18
- if (!actual.includes(expected)) {
19
- console.error(`AGENTS drift: ${file}`);
20
- failed = true;
21
- }
22
- }
23
- if (failed) process.exitCode = 1;
@@ -1,9 +0,0 @@
1
- import { existsSync, readdirSync } from 'node:fs';
2
- import path from 'node:path';
3
- import { syncAgents } from '@tbox.cn/app-build';
4
-
5
- const root = process.cwd();
6
- const modulesDir = path.join(root, 'modules');
7
- const hasModules = existsSync(modulesDir) && readdirSync(modulesDir, { withFileTypes: true }).some((entry) => entry.isDirectory());
8
- const written = await syncAgents({ root, appKind: 'web', hasModules, allowAppend: true });
9
- for (const file of written) console.log(`✅ ${path.relative(root, file)}`);