These are chat archives for db-migrate/node-db-migrate

15th
Aug 2016
Nicholas Iannone
@nickiannone
Aug 15 2016 16:56
Hey folks, I'm working on Typescript bindings for db-migrate and db-migrate-pg
DefinitelyTyped/DefinitelyTyped#10625
I've got a couple of questions (aimed at @wzrdtales): (1) Should I work on a fork of the node-db-migrate bin that can spit out Typescript migration scripts? Would it get accepted? (2) My typescript definition for "db-migrate" actually covers db-migrate/db-migrate-base, should it get switched to the correct name?
Nicholas Iannone
@nickiannone
Aug 15 2016 17:08
For the second, I think the correct answer is have the "db-migrate" typings def cover the union of node-db-migrate and db-migrate-base, which matches what npm install db-migrate gives you.
but I'd like to hear your thoughts.
Tobias Gurtzick
@wzrdtales
Aug 15 2016 17:10
@nickiannone db-migrate-base is used by all other drivers also, it depends on what you want to offer to the user on which level.
Nicholas Iannone
@nickiannone
Aug 15 2016 17:10
I'm trying to expose TS typings for the actual migration files produced by db-migrate create.
Tobias Gurtzick
@wzrdtales
Aug 15 2016 17:11
ok, so you just want TS for migrations and nothing else?
Nicholas Iannone
@nickiannone
Aug 15 2016 17:11
I also want to see if I can fork node-db-migrate and give it a --typescript-file CL flag or something, to get it to spit out TS instead of raw JS or Coffee
uh, essentially, yeah
Others more invested than I are free to port the rest of db-migrate to be bound as a TS library
but I'm just interested in getting our migrations to use TS, like the rest of our codebase
Tobias Gurtzick
@wzrdtales
Aug 15 2016 17:14
ok, I'm not that deep into typescript yet, but certainly it would be possible to get such a feature into db-migrate. There is currently also a request open for the babel transpiler to use es6/7 in migrations and I recently decided to give support back to the community by providing a plugin system for db-migrate for exactly things like what you currently do.
Also take a look here db-migrate/node-db-migrate#388 and here db-migrate/node-db-migrate#396
As you just want ts migrations that should be fine though, rewriting all of db-migrate into typescript would be another thing and that would be definitely subject to discussion.
Nicholas Iannone
@nickiannone
Aug 15 2016 17:16
I'm not imagining anything like that; the nice thing about TS is that you can just make a definitions file for existing JS, and expose that + a JS module
and they can (and usually are) maintained separate but parallel.
Look at DefinitelyTyped/DefinitelyTyped on GH
I just put out a TS definitions file for two other libraries (twilio and winston-dynamodb) over the past week and a half
Tobias Gurtzick
@wzrdtales
Aug 15 2016 17:19
yeah already seen it, also that it seems a bit unmaintainable to have so many definitions in just one repository, there is quite a lot in there.I definitely need to give TS a read, wanted to do that sometime anyway, maybe now is a good time :)
Nicholas Iannone
@nickiannone
Aug 15 2016 17:19
I've been sold on it since I realized it lets me use Intellisense in VS Code :D
Tobias Gurtzick
@wzrdtales
Aug 15 2016 17:20
I mostely use ternjs for that
Nicholas Iannone
@nickiannone
Aug 15 2016 17:20
I used tern in eclipse, and it kept choking on ES6 stuff
after like a week on this project, it just stopped working altogether for our codebase
Tobias Gurtzick
@wzrdtales
Aug 15 2016 17:21
that could be true, but in case of node not that big of a problem yet. at least not for the stuff of es6 that is supported in node natively yet.
Nicholas Iannone
@nickiannone
Aug 15 2016 17:21
mhm
I think it's more a damning of Eclipse than of tern
Tobias Gurtzick
@wzrdtales
Aug 15 2016 17:22
could be, I'm not a fan of IDEs anyway
mostly switching around emacs,vim,atom and sublime and the OS + lots of automation is doing the rest
Nicholas Iannone
@nickiannone
Aug 15 2016 17:23
neither am I, outside of VSCode. Heading to lunch, will resume discussion later
Tobias Gurtzick
@wzrdtales
Aug 15 2016 17:23
alright, feel free to reach out. have a good one.