Examples of wrapping a CLI for dotenv-flow
Disadvantage of requiring --
for flags.
# Note the required `--` for command flags
npm run prisma -- -v
# Another usage with env
env NODE_ENV=production npm run prisma migrate status -- --preview-feature
# Note again that flags necessary for prisma CLI need to be after `--`
# This errors with `Please provide the --preview-feature flag to use this command.`
npm run prisma migrate status --preview-feature
# And all of these work
npm run prisma migrate status -- --preview-feature
npm run prisma migrate -- status --preview-feature
npm run prisma -- migrate status --preview-feature
npm run -- prisma migrate status --preview-feature
npm -- run prisma migrate status --preview-feature
Proxing like this has the big advantage that prompts are working like with the original CLI.
# The "prisma" scripts first loads dotenv-flow and then spawns the Prisma CLI
NODE_ENV=production node prisma migrate status --preview-feature