openxiangda-cli 2.0.0-alpha.93 → 2.0.0-alpha.96

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": "openxiangda-cli",
3
- "version": "2.0.0-alpha.93",
3
+ "version": "2.0.0-alpha.96",
4
4
  "description": "Thin application-level CLI for OpenXiangda 2.0.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "@nestjs/common": "11.1.29",
16
16
  "@nestjs/core": "11.1.29",
17
17
  "@nestjs/platform-fastify": "11.1.29",
18
- "openxiangda": "2.0.0-alpha.5",
18
+ "openxiangda": "2.0.0-alpha.8",
19
19
  "reflect-metadata": "0.2.2",
20
20
  "rxjs": "7.8.2"
21
21
  },
@@ -317,8 +317,13 @@ test('renders the independent mobile task and executes only a Surface operation'
317
317
  test('shows an explicit authorization error instead of an empty work center', async ({
318
318
  page,
319
319
  }) => {
320
+ test.setTimeout(45_000);
320
321
  await mockWorkflow(page, { forbidden: true });
321
- await page.goto(`${runtimeBase}/admin/work-center`);
322
- await expect(page.getByText(/forbidden/)).toBeVisible();
322
+ await page.goto(`${runtimeBase}/admin/work-center`, {
323
+ waitUntil: 'domcontentloaded',
324
+ });
325
+ await expect(page.getByRole('alert')).toContainText('HTTP_403: forbidden', {
326
+ timeout: 30_000,
327
+ });
323
328
  await expect(page.getByRole('link', { name: '采购申请审批' })).toHaveCount(0);
324
329
  });
@@ -14,7 +14,7 @@
14
14
  "@ant-design/icons": "6.2.3",
15
15
  "@refinedev/core": "5.0.12",
16
16
  "antd": "6.4.3",
17
- "openxiangda": "2.0.0-alpha.5",
17
+ "openxiangda": "2.0.0-alpha.8",
18
18
  "react": "19.2.8",
19
19
  "react-dom": "19.2.8",
20
20
  "react-router-dom": "7.8.2"
@@ -6,6 +6,7 @@ const baseURL =
6
6
 
7
7
  export default defineConfig({
8
8
  testDir: './e2e',
9
+ workers: 2,
9
10
  use: { baseURL, trace: 'retain-on-failure' },
10
11
  webServer: process.env.OPENXIANGDA_E2E_BASE_URL
11
12
  ? undefined
@@ -1,39 +1,6 @@
1
- import { readFileSync, readdirSync, statSync } from "node:fs";
2
- import { gzipSync } from "node:zlib";
3
- import { join, resolve } from "node:path";
1
+ import { verifyOpenXiangdaWebBuild } from 'openxiangda/testing';
4
2
 
5
- const dist = resolve(import.meta.dirname, "../dist");
6
- const assets = join(dist, "assets");
7
- const names = readdirSync(assets);
8
- const files = names.map((name) => join(assets, name));
9
- const total = files.reduce((bytes, file) => bytes + statSync(file).size, 0);
10
- // Workflow pages are an optional route-level chunk. Preserve the stricter
11
- // initial and gzip budgets below while bounding the complete deployable set.
12
- if (total > 2_650_000)
13
- throw new Error(`WEB_DIST_BUDGET_EXCEEDED:${total}>2650000`);
14
- const javascript = files.filter((file) => file.endsWith(".js"));
15
- const gzip = javascript.reduce(
16
- (bytes, file) =>
17
- bytes + gzipSync(readFileSync(file), { level: 9 }).byteLength,
18
- 0
19
- );
20
- if (gzip > 800_000)
21
- throw new Error(`WEB_JS_GZIP_BUDGET_EXCEEDED:${gzip}>800000`);
22
- if (names.some((name) => name.endsWith(".map")))
23
- throw new Error("WEB_SOURCE_MAP_FORBIDDEN");
24
- const html = readFileSync(join(dist, "index.html"), "utf8");
25
- if (!html.includes('<div id="root"></div>'))
26
- throw new Error("WEB_ROOT_MISSING");
27
- const initialNames = [
28
- ...html.matchAll(/(?:src|href)="\.\/assets\/([^"]+\.js)"/g),
29
- ].map((match) => match[1]);
30
- const initialGzip = [...new Set(initialNames)].reduce((bytes, name) => {
31
- const file = join(assets, name);
32
- return bytes + gzipSync(readFileSync(file), { level: 9 }).byteLength;
33
- }, 0);
34
- if (initialGzip > 600_000) {
35
- throw new Error(`WEB_INITIAL_JS_GZIP_BUDGET_EXCEEDED:${initialGzip}>600000`);
36
- }
3
+ const result = verifyOpenXiangdaWebBuild(new URL('../dist', import.meta.url));
37
4
  process.stdout.write(
38
- `Verified Vite build: ${total} bytes, ${gzip} total gzip bytes, ${initialGzip} initial gzip bytes.\n`
5
+ `Verified Vite build: ${result.totalBytes} bytes, ${result.totalJavaScriptGzipBytes} total gzip bytes, ${result.initialJavaScriptGzipBytes} initial gzip bytes.\n`
39
6
  );
@@ -88,3 +88,12 @@ test('published E2E harnesses do not write evidence into the platform source rep
88
88
  );
89
89
  assert.doesNotMatch(workflowSource, /docs\/architecture|evidenceDirectory/);
90
90
  });
91
+
92
+ test('the platform package owns Web build verification policy', () => {
93
+ const verifier = readFileSync(
94
+ new URL('../scripts/verify-build.mjs', import.meta.url),
95
+ 'utf8'
96
+ );
97
+ assert.match(verifier, /verifyOpenXiangdaWebBuild/);
98
+ assert.doesNotMatch(verifier, /2_650_000|800_000|600_000/);
99
+ });
@@ -22,7 +22,7 @@
22
22
  "build": "pnpm --recursive build"
23
23
  },
24
24
  "devDependencies": {
25
- "openxiangda": "2.0.0-alpha.5",
25
+ "openxiangda": "2.0.0-alpha.8",
26
26
  "typescript": "5.9.3"
27
27
  }
28
28
  }