Skip to content

Commit 052ad54

Browse files
committed
feat: enable lb4 relation to retrieve models from subdirectories
Signed-off-by: warisniz02 <warisniz02@gmail.com>
1 parent f2bd46a commit 052ad54

File tree

1 file changed

+21
-0
lines changed
  • packages/cli/generators/relation

1 file changed

+21
-0
lines changed

packages/cli/generators/relation/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,27 @@ module.exports = class RelationGenerator extends ArtifactGenerator {
230230
/* istanbul ignore next */
231231
return this.exit(err);
232232
}
233+
// Check if modelDir contains subdirectories
234+
const subdirectories = await utils.getSubdirectories(
235+
this.artifactInfo.modelDir,
236+
);
237+
// If subdirectories exist, retrieve models from them
238+
if (subdirectories.length > 0) {
239+
for (const subdirectory of subdirectories) {
240+
try {
241+
const subdirectoryModelList = await utils.getArtifactList(
242+
subdirectory,
243+
'model',
244+
);
245+
modelList = modelList.concat(subdirectoryModelList);
246+
} catch (err) {
247+
// Handle errors for subdirectory model retrieval
248+
console.error(
249+
`Error retrieving models from subdirectory ${subdirectory}: ${err}`,
250+
);
251+
}
252+
}
253+
}
233254
let repoList;
234255
try {
235256
debug(`repository list dir ${this.artifactInfo.repoDir}`);

0 commit comments

Comments
 (0)