Skip to content

Commit

Permalink
Merge pull request #6 from ezequielramos/main
Browse files Browse the repository at this point in the history
trying this
  • Loading branch information
ezequielramos authored Apr 25, 2024
2 parents 944e169 + 5f9faf2 commit 0a69cf3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"nocheck"
]
}
21 changes: 14 additions & 7 deletions bin/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/usr/bin/env ts-node

import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
import { readdir, mkdir, writeFile } from 'fs/promises';
import moment from 'moment';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck

// eslint-disable-next-line @typescript-eslint/no-var-requires
const yargs = require('yargs/yargs');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { hideBin } = require('yargs/helpers');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { readdir, mkdir, writeFile } = require('fs/promises');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const moment = require('moment');

async function createInitialFolder() {
const files = await readdir('.');
Expand Down Expand Up @@ -106,7 +113,7 @@ export { initializeModels };

}

async function generateMigration(migrationName: string) {
async function generateMigration(migrationName) {
try {
const pathName = process.cwd();
const initFile = await import(pathName + '/gina/initializeModels.ts');
Expand Down Expand Up @@ -143,7 +150,7 @@ async function upgrade() {
const files = (await readdir(pathName + '/gina/migrations')).filter(file => !file.includes('.d.ts') && !file.includes('.js.map'));

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const migrations: { [file: string]: any; } = {};
const migrations = {};

for (const file of files) {
const filePath = await import(pathName + '/gina/migrations/' + file);
Expand Down Expand Up @@ -177,7 +184,7 @@ yargs(hideBin(process.argv))
describe: 'Name of the migration to be added'
});
}, (argv) => {
generateMigration(argv['migration-name'] as string);
generateMigration(argv['migration-name']);
})
.command('upgrade', 'upgrade database to its last revision', () => {
upgrade();
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.10",
"version": "0.0.11",
"description": "Gina is a tool to auto-generate and run migrations based on Sequelize ORM.",
"scripts": {
"eslint": "eslint .",
Expand Down

0 comments on commit 0a69cf3

Please sign in to comment.