openxiangda 1.0.49 → 1.0.51
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/lib/cli.js +339 -9
- package/lib/workspace-init.js +20 -8
- package/openxiangda-skills/SKILL.md +4 -3
- package/openxiangda-skills/skills/openxiangda-app/SKILL.md +28 -0
- package/openxiangda-skills/skills/openxiangda-core/SKILL.md +45 -1
- package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +31 -0
- package/package.json +7 -1
- package/packages/sdk/dist/runtime/index.cjs +3614 -3377
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +1 -0
- package/packages/sdk/dist/runtime/index.d.ts +1 -0
- package/packages/sdk/dist/runtime/index.mjs +3103 -2860
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +236 -0
- package/packages/sdk/dist/runtime/react.cjs.map +1 -0
- package/packages/sdk/dist/runtime/react.d.mts +109 -0
- package/packages/sdk/dist/runtime/react.d.ts +109 -0
- package/packages/sdk/dist/runtime/react.mjs +222 -0
- package/packages/sdk/dist/runtime/react.mjs.map +1 -0
- package/templates/openxiangda-react-spa/.env.example +4 -0
- package/templates/openxiangda-react-spa/AGENTS.md +65 -0
- package/templates/openxiangda-react-spa/index.html +12 -0
- package/templates/openxiangda-react-spa/package.json +35 -0
- package/templates/openxiangda-react-spa/postcss.config.cjs +6 -0
- package/templates/openxiangda-react-spa/src/app/router.tsx +97 -0
- package/templates/openxiangda-react-spa/src/layouts/AdminShell.tsx +102 -0
- package/templates/openxiangda-react-spa/src/layouts/PublicShell.tsx +11 -0
- package/templates/openxiangda-react-spa/src/layouts/UserShell.tsx +22 -0
- package/templates/openxiangda-react-spa/src/main.tsx +12 -0
- package/templates/openxiangda-react-spa/src/pages/admin/RuntimeWorkspacePage.tsx +57 -0
- package/templates/openxiangda-react-spa/src/pages/defaults/DataRoutePage.tsx +17 -0
- package/templates/openxiangda-react-spa/src/pages/defaults/FilePreviewRoutePage.tsx +14 -0
- package/templates/openxiangda-react-spa/src/pages/defaults/FormRoutePage.tsx +62 -0
- package/templates/openxiangda-react-spa/src/pages/portal/UserPortalPage.tsx +27 -0
- package/templates/openxiangda-react-spa/src/pages/public/PublicHomePage.tsx +10 -0
- package/templates/openxiangda-react-spa/src/pages/states/NotFoundPage.tsx +16 -0
- package/templates/openxiangda-react-spa/src/resources/menus/menus.json +31 -0
- package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/app-admin.json +8 -0
- package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/app-user.json +8 -0
- package/templates/openxiangda-react-spa/src/resources/roles/roles.json +14 -0
- package/templates/openxiangda-react-spa/src/styles/index.css +23 -0
- package/templates/openxiangda-react-spa/tailwind.config.cjs +29 -0
- package/templates/openxiangda-react-spa/tsconfig.app.json +36 -0
- package/templates/openxiangda-react-spa/tsconfig.json +7 -0
- package/templates/openxiangda-react-spa/tsconfig.node.json +10 -0
- package/templates/openxiangda-react-spa/vite.config.ts +73 -0
- package/templates/sy-lowcode-app-workspace/src/dev/App.tsx +33 -1
|
@@ -34,6 +34,17 @@ openxiangda workspace publish --profile <name> --only pages/dashboard,forms/cust
|
|
|
34
34
|
openxiangda workspace publish --profile <name>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
For Phase 6 React SPA workspaces (`workspace init --runtime react-spa`), do not use `workspace publish` for frontend routes. Publish in two explicit steps:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
openxiangda resource validate --profile <name>
|
|
41
|
+
openxiangda resource plan --profile <name>
|
|
42
|
+
openxiangda resource publish --profile <name>
|
|
43
|
+
openxiangda runtime deploy --profile <name>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`runtime deploy` builds the Vite app with a release-specific asset base, uploads `dist/` to the platform runtime release store, and activates the release unless `--no-activate` is passed.
|
|
47
|
+
|
|
37
48
|
## DO NOT
|
|
38
49
|
|
|
39
50
|
- ❌ `pnpm publish:all` / `pnpm publish:oss` / `pnpm register` / `lowcode-workspace publish-*` directly. They are workspace internals and miss `OPENXIANGDA_PROFILE / BASE_URL / ACCESS_TOKEN / APP_TYPE` injection.
|
|
@@ -116,6 +127,27 @@ pnpm install
|
|
|
116
127
|
openxiangda env --profile dev
|
|
117
128
|
```
|
|
118
129
|
|
|
130
|
+
For new Phase 6 React SPA apps:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
openxiangda workspace init ./my-react-app \
|
|
134
|
+
--profile dev \
|
|
135
|
+
--app-name "测试应用" \
|
|
136
|
+
--runtime react-spa
|
|
137
|
+
cd ./my-react-app
|
|
138
|
+
pnpm install
|
|
139
|
+
pnpm dev
|
|
140
|
+
openxiangda resource typegen --profile dev
|
|
141
|
+
openxiangda resource plan --profile dev
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
React SPA apps are standard React/Vite projects. Use React Router for routing,
|
|
145
|
+
Tailwind CSS for styling, and `openxiangda/runtime/react` for runtime bootstrap,
|
|
146
|
+
menus, and route permission checks. Do not publish React SPA pages through the
|
|
147
|
+
old custom-page app-shell path unless explicitly maintaining a legacy app.
|
|
148
|
+
Use `openxiangda resource publish` for roles/menus/page permission groups and
|
|
149
|
+
`openxiangda runtime deploy` for the SPA frontend release.
|
|
150
|
+
|
|
119
151
|
Local workspace state is authoritative. If `.openxiangda/state.json` already contains an app binding for the target profile, use it. If there is no local binding, create a new app with `workspace init --app-name`; do not search platform apps for similar names.
|
|
120
152
|
|
|
121
153
|
After workspace initialization, inspect `examples/best-practices/` before generating a real app. The examples are copied locally but are not published by default; copy only the selected pattern into `src/`.
|
|
@@ -194,7 +226,7 @@ The snapshot endpoint aggregates app metadata, forms, menus, code pages, release
|
|
|
194
226
|
openxiangda workspace publish --profile prod
|
|
195
227
|
```
|
|
196
228
|
|
|
197
|
-
|
|
229
|
+
For classic workspaces, the CLI checks that the target profile is logged in and bound to an app. It then runs the workspace publish script with these environment variables:
|
|
198
230
|
|
|
199
231
|
For normal development, inspect and publish only changed or targeted modules:
|
|
200
232
|
|
|
@@ -225,6 +257,18 @@ The publish script is responsible for:
|
|
|
225
257
|
4. Uploading assets to OSS.
|
|
226
258
|
5. Registering bundles through `/openxiangda-api/v1` with `OPENXIANGDA_ACCESS_TOKEN`.
|
|
227
259
|
|
|
260
|
+
For React SPA workspaces, the frontend publish command is:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
openxiangda runtime deploy --profile prod
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
It is responsible for:
|
|
267
|
+
|
|
268
|
+
1. Running the workspace build command with `OPENXIANGDA_APP_TYPE`, `OPENXIANGDA_BUILD_ID`, and `OPENXIANGDA_RUNTIME_ASSET_BASE`.
|
|
269
|
+
2. Uploading `dist/` to `/openxiangda-api/v1/apps/:appType/runtime/releases`.
|
|
270
|
+
3. Activating the new runtime release so `/view/:appType/*` enters the React app.
|
|
271
|
+
|
|
228
272
|
## References
|
|
229
273
|
|
|
230
274
|
- `../../references/openxiangda-api.md` — exact endpoint contracts.
|
|
@@ -64,6 +64,37 @@ openxiangda permission page-group-create portal_pages --name "门户页面" --pa
|
|
|
64
64
|
|
|
65
65
|
Use `--page-codes` or `--menu-codes` for custom code page menus; the CLI resolves the permission group to the published menu ID and keeps required page ID, route key, and legacy `PAGE_...` runtime aliases in the same group so the platform editor can still round-trip the selection. Use `--form-codes` for form menus; the CLI resolves forms to profile-local form UUIDs. Empty target lists mean all menus/pages are visible to matched roles. Only pass `--no-runtime-aliases` after confirming the target platform checks menu IDs directly at runtime.
|
|
66
66
|
|
|
67
|
+
For Phase 6 React SPA apps, define menu visibility and direct route access with
|
|
68
|
+
resource codes instead of old platform menu-tree-only targets:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"code": "sales_spa_pages",
|
|
73
|
+
"name": "销售 SPA 页面",
|
|
74
|
+
"roles": ["sales"],
|
|
75
|
+
"menuCodes": ["sales_dashboard", "customer_data"],
|
|
76
|
+
"routeCodes": ["sales.dashboard", "customer.data"],
|
|
77
|
+
"pathPatterns": ["/view/:appType/admin/sales/*"]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or create from CLI:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
openxiangda permission page-group-create sales_spa_pages \
|
|
85
|
+
--name "销售 SPA 页面" \
|
|
86
|
+
--roles sales \
|
|
87
|
+
--menu-codes sales_dashboard,customer_data \
|
|
88
|
+
--route-codes sales.dashboard,customer.data \
|
|
89
|
+
--path-patterns '/view/:appType/admin/sales/*' \
|
|
90
|
+
--profile dev
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Do not hardcode role checks in React pages. Use backend runtime bootstrap,
|
|
94
|
+
`useAppMenus()`, `useCanAccessRoute()`, and `PermissionBoundary` from
|
|
95
|
+
`openxiangda/runtime/react` for display control. Backend form, field, data,
|
|
96
|
+
workflow, file, and connector permissions remain authoritative.
|
|
97
|
+
|
|
67
98
|
## Form Permission Groups
|
|
68
99
|
|
|
69
100
|
Form permission groups control submit/view permissions, data scope, operations, and fields:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openxiangda",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.51",
|
|
4
4
|
"description": "OpenXiangda CLI, workspace build tools, runtime SDK, and form components.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"bin": {
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
"import": "./packages/sdk/dist/runtime/index.mjs",
|
|
22
22
|
"require": "./packages/sdk/dist/runtime/index.cjs"
|
|
23
23
|
},
|
|
24
|
+
"./runtime/react": {
|
|
25
|
+
"types": "./packages/sdk/dist/runtime/react.d.ts",
|
|
26
|
+
"import": "./packages/sdk/dist/runtime/react.mjs",
|
|
27
|
+
"require": "./packages/sdk/dist/runtime/react.cjs"
|
|
28
|
+
},
|
|
24
29
|
"./build": {
|
|
25
30
|
"types": "./packages/sdk/dist/build/index.d.ts",
|
|
26
31
|
"import": "./packages/sdk/dist/build/index.mjs",
|
|
@@ -60,6 +65,7 @@
|
|
|
60
65
|
"prepack": "npm run build:sdk",
|
|
61
66
|
"test:profile-isolation": "bash scripts/profile-isolation-smoke.sh",
|
|
62
67
|
"test:resource-plan": "node scripts/resource-plan-smoke.mjs",
|
|
68
|
+
"test:runtime-deploy": "node scripts/runtime-deploy-smoke.mjs",
|
|
63
69
|
"test:skill-install": "bash scripts/skill-install-smoke.sh",
|
|
64
70
|
"test:workspace-init": "bash scripts/workspace-init-smoke.sh"
|
|
65
71
|
},
|