Skip to content

Commit

Permalink
feat: enable lb4 relation to retrieve models from subdirectories
Browse files Browse the repository at this point in the history
Signed-off-by: warisniz02 <warisniz02@gmail.com>
  • Loading branch information
warisniz02 committed Sep 11, 2024
1 parent f2bd46a commit 052ad54
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/cli/generators/relation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,27 @@ module.exports = class RelationGenerator extends ArtifactGenerator {
/* istanbul ignore next */
return this.exit(err);
}
// Check if modelDir contains subdirectories
const subdirectories = await utils.getSubdirectories(
this.artifactInfo.modelDir,
);
// If subdirectories exist, retrieve models from them
if (subdirectories.length > 0) {
for (const subdirectory of subdirectories) {
try {
const subdirectoryModelList = await utils.getArtifactList(
subdirectory,
'model',
);
modelList = modelList.concat(subdirectoryModelList);
} catch (err) {
// Handle errors for subdirectory model retrieval
console.error(
`Error retrieving models from subdirectory ${subdirectory}: ${err}`,
);
}
}
}
let repoList;
try {
debug(`repository list dir ${this.artifactInfo.repoDir}`);
Expand Down

0 comments on commit 052ad54

Please sign in to comment.