Skip to content

Commit

Permalink
ts: exlcude index.ts files from been imported (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronenlu authored Dec 10, 2024
1 parent 2cc78e2 commit e8f4df9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ y.command(
return;
}
const absolutePath = path.resolve(argv.path);
const files = fs.readdirSync(absolutePath);
const models: string[] = [];
files.forEach((file) => {
if (file !== "index.ts" && file.endsWith(".ts"))
models.push(absolutePath + "/" + file);
});
const sequelize = new Sequelize({
dialect: argv.dialect,
models: [absolutePath + "/*.ts"],
models: models,
} as SequelizeOptions);
console.log(loadSQL(sequelize, argv.dialect));
} catch (e) {
Expand Down

0 comments on commit e8f4df9

Please sign in to comment.