fix(plop): 修复生成文件路径和 app.module.ts 正则
- 添加 --dest . 参数确保文件生成到项目根目录 - 修复 app.module.ts 导入语句和 imports 数组的正则匹配 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -447,8 +447,8 @@ name:string 名称 "示例名称" min:2 max:100
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: 'apps/api/src/app.module.ts',
|
||||
pattern: /(import.*from.*['"]\.\/\w+\/\w+\.module['"];?\n)(?!import)/,
|
||||
template: `$1import { {{pascalCase name}}Module } from './{{kebabCase name}}/{{kebabCase name}}.module';\n`,
|
||||
pattern: /(import \{ \w+Module \} from '\.\/\w+\/\w+\.module';)\n(\n@Module)/,
|
||||
template: `$1\nimport { {{pascalCase name}}Module } from './{{kebabCase name}}/{{kebabCase name}}.module';\n$2`,
|
||||
data: templateData,
|
||||
});
|
||||
|
||||
@@ -456,8 +456,8 @@ name:string 名称 "示例名称" min:2 max:100
|
||||
actions.push({
|
||||
type: 'modify',
|
||||
path: 'apps/api/src/app.module.ts',
|
||||
pattern: /(imports:\s*\[[\s\S]*?)(UserModule)/,
|
||||
template: `$1$2,\n {{pascalCase name}}Module`,
|
||||
pattern: /(\s+)(StudentModule,?\s*\n)(\s*\],)/,
|
||||
template: `$1$2$1{{pascalCase name}}Module,\n$3`,
|
||||
data: templateData,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user