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 +4 -4
- package/template/apps/server/package.json +1 -1
- package/template/apps/web/e2e/resources.spec.ts +18 -4
- package/template/apps/web/package.json +1 -1
- package/template/apps/web/src/main.tsx +7 -1
- package/template/apps/web/test/contracts.test.ts +1 -0
- package/template/package.json +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openxiangda-cli",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
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.
|
|
27
|
-
"openxiangda-devkit-core": "2.0.0-alpha.
|
|
28
|
-
"openxiangda-mcp": "2.0.0-alpha.
|
|
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",
|
|
@@ -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(
|
|
25
|
-
|
|
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="${
|
|
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}
|
|
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] }))
|
|
@@ -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={
|
|
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/);
|
package/template/package.json
CHANGED
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"build": "pnpm --recursive build"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"openxiangda-cli": "2.0.0-alpha.
|
|
26
|
-
"openxiangda-contracts": "2.0.0-alpha.
|
|
27
|
-
"openxiangda-devkit-core": "2.0.0-alpha.
|
|
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
|
}
|