- Add start_app.sh script for one-click application startup - Add STARTUP_GUIDE.md with detailed startup instructions - Add init_and_start.sh alternative startup script - Fix JpaAuditingConfig to remove duplicate @EnableJpaRepositories - Update application-dev.yml to use environment variables for database config - Fix TenantContextFilterTest to use proper MockFilterChain implementation - Fix OrderAuditIntegrationTest to use correct TenantScope constructor - Fix OrderCacheIntegrationTest to use correct method names and return types - Add tmpl-admin frontend project - Update OrderControllerTest with correct method mappings and return codes Co-authored-by: Qwen-Coder <[email protected]>
65 lines
2.0 KiB
JavaScript
65 lines
2.0 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* 新增页面脚手架。
|
|
*
|
|
* 用法:pnpm new-page OrderList order
|
|
* → 生成 src/pages/order/OrderListPage.vue
|
|
* → 追加到 src/router/page-registry.ts(提示手动确认)
|
|
* → 输出 Flyway 迁移模板(权限点 + 菜单种子)
|
|
*/
|
|
import { writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
import { resolve, dirname } from 'path';
|
|
|
|
const [, , pageName, moduleDir] = process.argv;
|
|
|
|
if (!pageName || !moduleDir) {
|
|
console.error('用法: pnpm new-page <PageName> <module>');
|
|
console.error('示例: pnpm new-page OrderList order');
|
|
process.exit(1);
|
|
}
|
|
|
|
const dir = resolve('src/pages', moduleDir);
|
|
const filePath = resolve(dir, `${pageName}Page.vue`);
|
|
|
|
if (existsSync(filePath)) {
|
|
console.error(`文件已存在: ${filePath}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
if (!existsSync(dir)) {
|
|
mkdirSync(dir, { recursive: true });
|
|
}
|
|
|
|
const template = `<template>
|
|
<div class="space-y-5">
|
|
<h1 class="text-2xl font-bold text-gray-800 dark:text-gray-100">${pageName}</h1>
|
|
<div class="card">
|
|
<p class="text-gray-400">TODO: 实现 ${pageName} 页面</p>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
// ${pageName}Page
|
|
</script>
|
|
`;
|
|
|
|
writeFileSync(filePath, template, 'utf-8');
|
|
console.log(`✅ 页面已创建: ${filePath}`);
|
|
|
|
console.log(`
|
|
📋 后续步骤(必须完成,否则 CI 将失败):
|
|
|
|
1. 在 src/router/page-registry.ts 注册:
|
|
'${pageName}': () => import('@/pages/${moduleDir}/${pageName}Page.vue'),
|
|
|
|
2. 创建 Flyway 权限迁移 (tmpl-infrastructure):
|
|
INSERT INTO sys_permission (code, type, description)
|
|
VALUES ('${moduleDir}:${pageName.toLowerCase()}:read', 'PAGE', '${pageName} 页面访问');
|
|
|
|
3. 创建 Flyway 菜单迁移 (tmpl-infrastructure):
|
|
INSERT INTO sys_menu (parent_id, name, path, component, icon, sort, type, visible, status)
|
|
VALUES (<parent>, '${pageName}', '/${moduleDir}/${pageName.toLowerCase()}', '${pageName}', '<icon>', 10, 'MENU', true, true);
|
|
|
|
4. 更新 PR 描述,确认上述三项已完成。
|
|
`); |