-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop direct dependencies for config and dotenv #499
Comments
But they are already Lines 83 to 86 in e883e5b
|
Unfortunately, optionalDependencies still install, they just don't fail the As a result, pg-node-migrate installs both dotenv and config. 😕 It's pretty poorly named. |
So maybe we could move both to |
That would be my recommendation, to move them into peerDependencies. The code is already try/catching the requires responsibily. The only reason it's a breaking change is someone could be depending on |
Problem is, that dotenv and config are really optional dependencies, it is not necessary to use them, bad is that npm installs them regardless. Moving them to peerDependencies would result in a warning during installation for people who do not use them. |
@dolezel I'd be okay with dropping them completely. The try/catch does its job properly. Happy to put together a PR for it. What are your thoughts everyone RE that being a breaking change?
|
Description
Currently, when we have
NODE_ENV=production
set, attempting to runnode-pg-migrate
will throw warnings with no way to silence them.Reproduction
Additional Context
The always-throwing-warning was introduced with 1.9.0 of
config
as part of their Strict Mode release. While you can tell node-config to warn instead of throw, the errors cannot be shut off, even when you are not using config in your app. This happens because we have a direct dependency onconfig
(anddotenv
) meaning that we'll always require and run them even if our consuming code doesn't use them.As a proposed fix, I suggest we leave our require + try/catch intact, and just move
config
anddotenv
into peerDependencies just like we do withpg
.💥 This will introduce a breaking change A change to peerDependencies means that anyone who was assuming a
.env
or aconfig/default-<environment>.json
file would "just work" will have migrations that do not run without adding the peer dependency.Workaround
In the meantime, if you're in a CI environment and don't require
NODE_ENV
for the migration operation, this comment indicates that you can explicitly remove theNODE_ENV
value by runningNODE_ENV= node-pg-migrate up
. It's not an ideal workaround, but it is something in case you're running into weird CI issues.References
The text was updated successfully, but these errors were encountered: