#!/usr/bin/env node /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import assert from 'node:assert/strict' import { readFile } from 'node:fs/promises' import path from 'node:path' import { fileURLToPath } from 'node:url' const scriptPath = fileURLToPath(import.meta.url) const appRoot = path.resolve(path.dirname(scriptPath), '..') const appVue = await readFile(path.join(appRoot, 'src/App.vue'), 'utf8') const shellVue = await readFile(path.join(appRoot, 'src/components/erp/ErpAppShell.vue'), 'utf8') const dashboardVue = await readFile(path.join(appRoot, 'src/views/DashboardView.vue'), 'utf8') const loginVue = await readFile(path.join(appRoot, 'src/views/LoginView.vue'), 'utf8') const moduleCatalog = await readFile(path.join(appRoot, 'src/data/moduleCatalog.ts'), 'utf8') const pageVue = await readFile(path.join(appRoot, 'src/views/BusinessPageView.vue'), 'utf8') const rendererVue = await readFile(path.join(appRoot, 'src/components/erp/ErpPageRenderer.vue'), 'utf8') const dataTableVue = await readFile(path.join(appRoot, 'src/components/erp/ErpDataTable.vue'), 'utf8') const design = await readFile(path.join(appRoot, '../../..', 'DESIGN.md'), 'utf8') for (const text of ['工作台', '订单', '商品', '客户', '财务', '库存', '运营', '系统']) { assert.match(appVue + shellVue + moduleCatalog, new RegExp(text), `primary admin navigation should include ${text}`) } for (const text of ['LoginView', 'showLoginGate', 'isAuthenticated']) { assert.match(appVue, new RegExp(text), `app should route through login/session gate: ${text}`) } assert.doesNotMatch(appVue + shellVue, /adminPreview|preserveAdminPreview|isAdminPreviewMode/, 'product shell must not expose a preview parameter that bypasses login') for (const text of ['登录后进入完整 ERP 后台', 'apiLogin', 'targetHash']) { assert.match(loginVue, new RegExp(text), `login door should delegate to OFBiz login: ${text}`) } assert.match(appVue, /:target-hash="loginTargetHash"/, 'login gate should return users to the originally requested administrator route after OFBiz login') for (const text of ['ERP 管理员工作台', '今日运营', '待办队列', '最近记录', '常用动作']) { assert.match(dashboardVue, new RegExp(text), `administrator dashboard should render ${text}`) } assert.doesNotMatch( dashboardVue, /OFBiz 全量 UI 重写基座|Migration Foundation|交付预览|组件体系/, 'default dashboard must not read like a migration preview site' ) for (const text of ['搜索订单', '运营工作台', '核心业务', '渠道与扩展', '统一运营管理平台', '系统治理', '系统管理']) { assert.match(shellVue, new RegExp(text), `admin shell should expose ${text}`) } assert.match(design, /Business operation before implementation evidence/, 'DESIGN.md should document the administrator-site direction') for (const text of ['处理台', '资料明细', '处理动作', '操作记录']) { assert.match(pageVue, new RegExp(text), `generated business page tabs should include ${text}`) } assert.doesNotMatch( pageVue, /eyebrow="Page Definition"|Generated Element Plus preview|\{\{ kind \}\}<\/div>/, 'adapter blocks should use business-facing copy instead of technical source paths' ) assert.doesNotMatch( pageVue, /service、event|page\.value\.pageId\]\)|label="工作面"|label="数据区"|label="执行区"|label="审批流"|后端服务协同|Service Dispatcher|统一 Lookup|动作编码/, 'business page chrome should not expose implementation identifiers in the primary view' ) assert.doesNotMatch( appVue + shellVue + dashboardVue, /label: 'Workbench'|label: 'Orders'|Live routes|service \/ event \/ readonly \/ local|>high<|routes<\/el-tag>/, 'admin shell and workbench should use business-facing Chinese labels' ) console.log(JSON.stringify({ status: 'passed', checked: ['App.vue', 'ErpAppShell.vue', 'DashboardView.vue', 'BusinessPageView.vue', 'ErpPageRenderer.vue', 'ErpDataTable.vue', 'DESIGN.md'] }, null, 2))