From e8f4df92555515aec5c899df01f8cb8e243ee227 Mon Sep 17 00:00:00 2001 From: Ronen Lubin <63970571+ronenlu@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:22:04 +0200 Subject: [PATCH] ts: exlcude index.ts files from been imported (#19) --- ts/src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ts/src/index.ts b/ts/src/index.ts index 632b506..ebf799b 100755 --- a/ts/src/index.ts +++ b/ts/src/index.ts @@ -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) {