Skip to content

Commit

Permalink
Merge pull request #11 from ezequielramos/main
Browse files Browse the repository at this point in the history
work with ts or js
  • Loading branch information
ezequielramos authored May 13, 2024
2 parents 41a27e1 + b59ff5d commit efed5c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,16 @@ async function generateMigration(migrationName) {
async function upgrade() {
try {
const pathName = process.cwd();
const initFile = await import(pathName + '/gina/initializeModels.ts');

const ginaFolder = (await readdir(pathName + '/gina')).filter(file => !file.includes('.d.ts') && !file.includes('.js.map'));

let initializeModelsFile = 'initializeModels.ts';

if (ginaFolder.includes('initializeModels.js')) {
initializeModelsFile = 'initializeModels.js';
}

const initFile = await import(pathName + '/gina/' + initializeModelsFile);

console.log('loading models...');
let initializeModels = initFile.initializeModels;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"gina-cli": "./bin/index.ts"
},
"types": "./dist/gina.d.ts",
"version": "0.0.14",
"version": "0.0.15",
"description": "Gina is a tool to auto-generate and run migrations based on Sequelize ORM.",
"scripts": {
"eslint": "eslint .",
Expand Down

0 comments on commit efed5c7

Please sign in to comment.