db-migrate / db-migrate/node-db-migrate

Support a --require flag

Open
#531 15 comments 1 reaction 0 assignees View on GitHub
feature
Dominant language
JavaScript
Stars
2.3k
Forks
361
PR merge metrics
No merged PRs in 30d

Description

## I'm submitting a...



[ ] Bug report
[x] Feature request

## Current behavior

Currently, in order to run `@babel/node`, you have to include a plugin.

## Expected behavior

I would like to see a `--require` flag added to the CLI.

## Minimal reproduction of the problem with instructions

N/A

## What is the motivation/use case for changing the behavior?

We're now writing all of our JavaScript code using the `async`/`await` syntax in our JavaScript. This syntax will eventually be integrated into Node, but for now, we're using Babel. Many Node CLI tools include a `--require` flag that can be used to load modules directly from the command line, making it easy to add `@babel/register` to the project. There are also other ES6/ES7 niceties we're using that aren't currently supported by Node, and it's plausible there will be additional ones in the future.

This could be done with a plugin, but it strikes me as unnecessary when there's already a standardized solution to this problem. Plugins also require maintenance. For example, [db-migrate-plugin-babel](https://github.com/benjie/db-migrate-plugin-babel/blob/master/index.js#L11) is using the old `babel-node` instead of the new `@babel/register`. I'll submit an issue to that project, but that wouldn't be necessary with `--register`.

## Environment



db-migrate version: 0.10.2
db-migrate-pg: 0.2.5

Additional information:
- Node version: 9.2.0
- Platform: Linux (via node Docker image)

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/53403387-support-a-require-flag?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.