-
Notifications
You must be signed in to change notification settings - Fork 37
Provide --compiler flag for up
, down
, list
#82
base: master
Are you sure you want to change the base?
Conversation
This allows TypeScript migrations, with a setup like the following: - A file `migrations/tsnode.js` containing a require-able module: require("ts-node/register") module.exports = () => {} See tj/node-migrate#108 (comment) for more here. - A command-line argument to register the ts extension with ts-node: $ ctf-migrate list --compiler "ts:./migrations/tsnode.js" --space-id $CONTENTFUL_SPACE_ID --environment-id $CONTENTFUL_ENVIRONMENT_ID --access-token $CONTENTFUL_MANAGEMENT_ACCESS_TOKEN -a
One additional caveat I just ran into that I wanted to call out:
|
Hey, thanks very much for this, and sorry for not replying earlier. Even though I like the simple/open approach you took, I think I'd like to have something like a flag in bootstrap (something like We could have this approach and also keep the Thoughts? |
@deluan Yep, absolutely, makes sense. It'll definitely be user-friendlier and seems like that approach could also allow migrations to be run in different languages (e.g. project started off in javascript but migrated to typescript a couple years later, and they don't have to rewrite old migrations to get them running). Just to set expectations & make sure nobody's waiting on me: I'm probably not going to tackle this anytime soon, just depending on my fork for now, which is going fine for my purposes. Feel free to close or repurpose this PR! |
Hello, will we get typescript support? for new projects that file error might not be an issue. |
I'll take a stab at this, hopefully will have a new release by end of this week |
Hey @fr0609 and @trptcolin, sorry for the delay. I'm not a TypeScript user myself, so testing this (setting up the dev env, etc..) is not something I've been able to do in my free time. What do you guys think about @devlato's approach on PR #131? |
This allows folks to write migrations in TypeScript, with a setup like the following:
migrations/tsnode.js
containing a require-able module:See tj/node-migrate#108 (comment) for more here.
And just to reiterate some of the tradeoffs I see from the related issue (#53):
Pros
Cons
No worries if you want to go a different way - just figured showing the code might be easier than talking about it (also might save others some time).