balmasi / migrate-mongoose

A node based migration framework for mongoose supporting ES6 migrations
MIT License
264 stars 84 forks source link

Support Migration files with *.ts extension #60

Open mkovel opened 4 years ago

mkovel commented 4 years ago

Hey, we use Typescript + Mongoose in our project and tried use migrate-mongoose for adding migrations. But migrate-mongoose filtering files by reg-pattern, /\d{13,}\-.+.js$/.test(file)) can we change a little /\d{13,}\-.+.(j|t)s$/.test(file)). Or create new config param for this. Thanks

pavel-lens commented 4 years ago

I would appreciate support for Typescript files as well 👍

troywweber7 commented 3 years ago

This day and age, Typescript is so popular and support is incredibly easy to add it's rare to find a relevant project that doesn't support it even if it's just via a definition file. Hopefully this makes it into the next release!

andrewmartin commented 3 years ago

Same here, curious if you can somehow allow parsing of the files using ts-node.

longseespace commented 2 years ago

Same here, curious if you can somehow allow parsing of the files using ts-node.

Here is how I did it:

"scripts": {
  "migrate_prod": "migrate up --autosync",
  "migrate_dev": "ts-node ./node_modules/migrate-mongoose/src/cli.js up --autosync"
}

On development machine, use npm run migrate_dev. On production server, you need to compile the project into .js code then run migrate_prod