Skip to content

Split app env ownership#3303

Merged
aofei merged 1 commit into
goplus:devfrom
nighca:issue-3299
Jul 2, 2026
Merged

Split app env ownership#3303
aofei merged 1 commit into
goplus:devfrom
nighca:issue-3299

Conversation

@nighca

@nighca nighca commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #3299

Summary

  • Split app env ownership between xbuilder and account.
  • Configure app-level runtime dependencies from app entry points instead of shared env imports.
  • Move existing widgets under app xbuilder and keep their output paths unchanged.
  • Use VITE_MODE to select Vite build modes in workflows and Dockerfiles, keeping NODE_ENV reserved for the runtime environment.

Deployment Notes

When this change is released, update the Vercel configuration for the xbuilder app:

  • Rename the existing NODE_ENV environment variable to VITE_MODE and set it to production-cn where needed.
  • Remove the other existing environment variables so the build uses the app-specific .env.* files committed in this project.

Checks

  • npm run type-check
  • npm run lint
  • npm run test -- --run src/models/common/cloud.test.ts src/components/editor/editing.test.ts src/components/editor/editor-state.test.ts
  • npm run build
  • VITE_MODE=production-cn npm run build
  • npm run build:account
  • VITE_MODE=production-cn npm run build:account
  • npm run dev -- --port 5175 --host 127.0.0.1, opened http://127.0.0.1:5175/ in Chrome and verified XBuilder home loads
  • npm run dev:account -- --host 127.0.0.1, opened http://127.0.0.1:5174/ in Chrome and verified Account home loads

gemini-code-assist[bot]

This comment was marked as resolved.

fennoai[bot]

This comment was marked as resolved.

file: ${{ matrix.dockerfile }}
build-args: |
NODE_ENV=staging
VITE_MODE=staging

@nighca nighca Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于 staging/production/production-cn,构建时实际的 NODE_ENV 值都是 production(通过 npm script build 控制),之前外部指定 NODE_ENVstaging/production/production-cn 的做法是容易造成误解的

这里换成 VITE_MODE,明确是用于控制 vite mode,对应于最终配置文件的选用

- name: Build account frontend for mainland China deployment
working-directory: spx-gui
run: NODE_ENV=production.cn npm run build:account
run: VITE_MODE=production-cn npm run build:account

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.env 的加载本身有一定策略,比如当指定 mode: abc 的时候,.env.abc.local 会优先级高于 .env.abc(详见 .env Files);考虑到这里 . 用于分隔 mode name 和 local 这样的特殊标识,因此在 mode name 中把原来的 . 换成 -,减少把 .cn 误解为像 .local 这样的特殊标记的可能性

declare module 'vue-router' {
interface RouteMeta {
/** Whether the route requires sign-in */
requiresSignIn?: boolean

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个机制干掉了,维护这个机制会比较麻烦,依赖这个机制的页面很少;目前只有 admin 页面依赖它,改为由 admin 页面自己去实现了

Comment thread spx-gui/src/stores/user/avatar.ts
@aofei aofei enabled auto-merge (squash) July 2, 2026 06:24
@aofei aofei merged commit 48987ce into goplus:dev Jul 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align Vercel deployment config and split app envs

2 participants