Thank you for sharing! I have a question, where should i put this code? const tsNode = require('ts-node'); module.exports = tsNode.register;
Thank you in advance!
Hello,
I use to place it in a file called ts-compiler.js in a folder called src/migration-utils You can take a look in the sample repo.
ts-compiler.js
src/migration-utils
Then you can use as an option in the migration command invocations: --compiler=\"ts:./src/migrations-utils/ts-compiler.js\"
--compiler=\"ts:./src/migrations-utils/ts-compiler.js\"
It's in the sample repo, but I'll share the migration commands in the package.json here:
package.json
"migrate:create": "migrate create --template-file ./src/migrations-utils/template.ts --migrations-dir=\"./src/migrations\" --compiler=\"ts:./src/migrations-utils/ts-compiler.js\"", "migrate:up": "migrate --migrations-dir=\"./src/migrations\" --compiler=\"ts:./src/migrations-utils/ts-compiler.js\" up", "migrate:down": "migrate --migrations-dir=\"./src/migrations\" --compiler=\"ts:./src/migrations-utils/ts-compiler.js\" down"
Hope this nugget will help you :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you for sharing!
I have a question, where should i put this code?
const tsNode = require('ts-node');
module.exports = tsNode.register;
Thank you in advance!
Hello,
I use to place it in a file called
ts-compiler.js
in a folder calledsrc/migration-utils
You can take a look in the sample repo.
Then you can use as an option in the migration command invocations:
--compiler=\"ts:./src/migrations-utils/ts-compiler.js\"
It's in the sample repo, but I'll share the migration commands in the
package.json
here:Hope this nugget will help you :)