openxiangda-cli 2.0.0-alpha.81 → 2.0.0-alpha.83

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.81",
3
+ "version": "2.0.0-alpha.83",
4
4
  "description": "Thin application-level CLI for OpenXiangda 2.0.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,9 +23,9 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@oclif/core": "4.13.3",
26
- "openxiangda-contracts": "2.0.0-alpha.37",
27
- "openxiangda-devkit-core": "2.0.0-alpha.48",
28
- "openxiangda-mcp": "2.0.0-alpha.48"
26
+ "openxiangda-contracts": "2.0.0-alpha.38",
27
+ "openxiangda-devkit-core": "2.0.0-alpha.50",
28
+ "openxiangda-mcp": "2.0.0-alpha.50"
29
29
  },
30
30
  "devDependencies": {
31
31
  "tsx": "4.23.12",
@@ -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-nest": "2.0.0-alpha.46",
18
+ "openxiangda-nest": "2.0.0-alpha.47",
19
19
  "reflect-metadata": "0.2.2",
20
20
  "rxjs": "7.8.2"
21
21
  },
@@ -21,13 +21,17 @@ const definitions = resourceDefinitions as Record<string, DeclaredResource>;
21
21
  const allCapabilities = [...capabilities] as string[];
22
22
  const runtimeBase = `/view/${appCode}`;
23
23
 
24
- async function mockPlatform(page: Page, authorized = true) {
25
- await page.route(`**${runtimeBase}/**`, async route => {
24
+ async function mockPlatform(
25
+ page: Page,
26
+ authorized = true,
27
+ targetRuntimeBase = runtimeBase,
28
+ ) {
29
+ await page.route(`**${targetRuntimeBase}/**`, async route => {
26
30
  if (route.request().resourceType() !== 'document') return route.continue();
27
31
  const response = await route.fetch();
28
32
  const body = (await response.text()).replace(
29
33
  '<head>',
30
- `<head><meta name="openxiangda-runtime-base" content="${runtimeBase}/" />` +
34
+ `<head><meta name="openxiangda-runtime-base" content="${targetRuntimeBase}/" />` +
31
35
  `<meta name="openxiangda-app-code" content="${appCode}" />` +
32
36
  '<meta name="openxiangda-environment" content="preproduction" />'
33
37
  );
@@ -104,8 +108,9 @@ test('renders the compiled desktop resource contract and shared workbench', asyn
104
108
  } else {
105
109
  const code = codes[0];
106
110
  const definition = definitions[code];
107
- await page.goto(`${runtimeBase}/${code}`);
111
+ await page.goto(`${runtimeBase}/admin`);
108
112
  await expect(page.locator('.oxa-list-surface')).toBeVisible();
113
+ await expect(page).toHaveURL(`${runtimeBase}/${code}`);
109
114
  await expect(page.locator('.oxa-sider').getByText(definition.name, { exact: true })).toBeVisible();
110
115
  await expect(page.getByRole('button', { name: /导出$/ })).toBeVisible();
111
116
  await expect(page.getByRole('button', { name: /列设置$/ })).toBeVisible();
@@ -131,6 +136,15 @@ test('renders the compiled desktop resource contract and shared workbench', asyn
131
136
  await expect.poll(() => page.evaluate(() => localStorage.getItem('openxiangda.admin.appearance'))).toBe('dark');
132
137
  });
133
138
 
139
+ test('opens the stable admin entry under the preproduction gateway mount', async ({ page }) => {
140
+ test.skip(!codes.length, 'No resource route exists in an empty application.');
141
+ const devRuntimeBase = `/dev/${appCode}`;
142
+ await mockPlatform(page, true, devRuntimeBase);
143
+ await page.goto(`${devRuntimeBase}/admin`);
144
+ await expect(page.locator('.oxa-list-surface')).toBeVisible();
145
+ await expect(page).toHaveURL(`${devRuntimeBase}/${codes[0]}`);
146
+ });
147
+
134
148
  test('renders platform mobile controls from declared field widgets', async ({ page }) => {
135
149
  const candidate = codes
136
150
  .map(code => ({ code, definition: definitions[code] }))
@@ -16,7 +16,7 @@
16
16
  "antd": "6.4.3",
17
17
  "dayjs": "1.11.18",
18
18
  "docx-preview": "0.3.7",
19
- "openxiangda-contracts": "2.0.0-alpha.37",
19
+ "openxiangda-contracts": "2.0.0-alpha.38",
20
20
  "react": "19.2.8",
21
21
  "react-dom": "19.2.8",
22
22
  "react-router-dom": "7.8.2",
@@ -15,6 +15,11 @@ import './styles.css';
15
15
 
16
16
  const codes = Object.keys(resourceDefinitions);
17
17
  const firstPath = codes[0] ? `/${codes[0]}` : '/';
18
+ const adminEntry = codes.length ? (
19
+ <Navigate replace to={firstPath} />
20
+ ) : (
21
+ <EmptyApplicationPage />
22
+ );
18
23
 
19
24
  function GlobalRequestLoading() {
20
25
  const loading = useGlobalRequestLoading();
@@ -49,7 +54,8 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
49
54
  <BrowserRouter basename={applicationBasename()}>
50
55
  <Refine dataProvider={applicationProvider} resources={codes.map(code => ({ name: code, list: `/${code}`, create: `/${code}/new`, edit: `/${code}/:id/edit`, show: `/${code}/:id` }))}>
51
56
  <Routes>
52
- <Route path="/" element={codes.length ? <Navigate replace to={firstPath} /> : <EmptyApplicationPage />} />
57
+ <Route path="/" element={adminEntry} />
58
+ <Route path="/admin" element={adminEntry} />
53
59
  <Route path="/files/:resourceCode/:fileId/preview" element={<FilePreviewPage />} />
54
60
  {resourceRoutes}
55
61
  </Routes>
@@ -54,6 +54,7 @@ test('admin appearance is a bounded Ant Design theme with compact route chrome',
54
54
  assert.match(appearance, /openxiangda\.admin\.appearance/);
55
55
  assert.match(main, /<AppearanceProvider>/);
56
56
  assert.match(main, /oxa-global-request-loading/);
57
+ assert.match(main, /path="\/admin"/);
57
58
  assert.match(shell, /openxiangda\.admin\.route-history/);
58
59
  assert.match(shell, /MAX_HISTORY_ITEMS = 8/);
59
60
  assert.match(shell, /<Segmented/);
@@ -22,9 +22,9 @@
22
22
  "build": "pnpm --recursive build"
23
23
  },
24
24
  "devDependencies": {
25
- "openxiangda-cli": "2.0.0-alpha.81",
26
- "openxiangda-contracts": "2.0.0-alpha.37",
27
- "openxiangda-devkit-core": "2.0.0-alpha.48",
25
+ "openxiangda-cli": "2.0.0-alpha.83",
26
+ "openxiangda-contracts": "2.0.0-alpha.38",
27
+ "openxiangda-devkit-core": "2.0.0-alpha.50",
28
28
  "typescript": "5.9.3"
29
29
  }
30
30
  }