mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-08-07 02:22:57 +08:00
refactor(plugin-model): 优化下代码,只判定src/models下的文件为模块数据
This commit is contained in:
parent
77e074d03a
commit
d828b16ce9
@ -24,12 +24,12 @@ export default (api) => {
|
|||||||
function getAllModels() {
|
function getAllModels() {
|
||||||
const srcModelsPath = getModelsPath();
|
const srcModelsPath = getModelsPath();
|
||||||
return lodash.uniq([
|
return lodash.uniq([
|
||||||
...getModels(srcModelsPath),
|
...getModels(srcModelsPath)
|
||||||
...getModels(
|
// ...getModels(
|
||||||
paths.absPagesPath,
|
// paths.absPagesPath,
|
||||||
`**/${getModelDir()}/**/*.{js,jsx}`
|
// `**/${getModelDir()}/**/*.{js,jsx}`
|
||||||
),
|
// ),
|
||||||
...getModels(paths.absPagesPath, '**/*.model.{js,jsx}')
|
// ...getModels(paths.absPagesPath, '**/*.model.{js,jsx}')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,11 +24,11 @@ function getExtraImports(models = [], absSrcPath) {
|
|||||||
.map((ele) => {
|
.map((ele) => {
|
||||||
if (ele.exportName) {
|
if (ele.exportName) {
|
||||||
return `import { ${ele.exportName} } from '${winPath(
|
return `import { ${ele.exportName} } from '${winPath(
|
||||||
ele.importPath.replace(/'/g, "\\'"),
|
ele.importPath.replace(/'/g, "\\'")
|
||||||
)}';`;
|
)}';`;
|
||||||
}
|
}
|
||||||
return `import ${ele.importName} from '${winPath(
|
return `import ${ele.importName} from '${winPath(
|
||||||
ele.importPath.replace(/'/g, "\\'"),
|
ele.importPath.replace(/'/g, "\\'")
|
||||||
)}';`;
|
)}';`;
|
||||||
})
|
})
|
||||||
.join(EOL);
|
.join(EOL);
|
||||||
@ -37,7 +37,7 @@ function getExtraImports(models = [], absSrcPath) {
|
|||||||
export const getTmpFile = (
|
export const getTmpFile = (
|
||||||
files,
|
files,
|
||||||
extra = [],
|
extra = [],
|
||||||
absSrcPath,
|
absSrcPath
|
||||||
) => {
|
) => {
|
||||||
const userImports = genImports(files);
|
const userImports = genImports(files);
|
||||||
const userModels = getModels(files, absSrcPath);
|
const userModels = getModels(files, absSrcPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user