You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The --variant flag was removed in #101 in favour of graph@variant positional argument. Formatted positional arguments are problematic in environments without substitution or templating capabilities i.e. npm/yarn scripts.
There isn't a viable way for the script caller to select the variant. This either requires wrapping the rover call in another script in order to template the variant or introduce variant specific script entries i.e. schema:check:staging, schema:check:production, etc... The latter quickly gets unwieldy as we add script entries for other rover operations like publish.
This works for a single package but it requires all callers to know to graph ID (something that is largely static) which is owned by n external service i.e. Apollo Studio).
However even this approach breaks down once you enter a monorepo environment. Consider a lerna based monorepo, we would want to do the following
lerna run schema:check
This would execute yarn run schema:check in all monorepo packages. Unless all packages depend on the single graph were no longer able to use positional arguments. The --variant flag solves this since flags are passed on by lerna (and other monorepo tools) and node package managers.
lerna run schema:check --variant=staging
The text was updated successfully, but these errors were encountered:
xzyfer
added
feature 🎉
new commands, flags, functionality, and improved error messages
triage
issues and PRs that need to be triaged
labels
Feb 2, 2022
Description
The
--variant
flag was removed in #101 in favour ofgraph@variant
positional argument. Formatted positional arguments are problematic in environments without substitution or templating capabilities i.e. npm/yarn scripts.Consider the following
package.json
.There isn't a viable way for the script caller to select the variant. This either requires wrapping the rover call in another script in order to template the variant or introduce variant specific script entries i.e.
schema:check:staging
,schema:check:production
, etc... The latter quickly gets unwieldy as we add script entries for other rover operations likepublish
.Re-introducing the
--variant
flag resolves this issue by allowing the caller to select the variant.What about npm_config_*
It's true that npm offers naive templating for scripts that would allow the following
However this is not consistently supported across node package managers, most notably
yarn
has a 4yr outstanding PR for a comparable feature.What about passing in the positional argument
The following is (mostly) possible today
This works for a single package but it requires all callers to know to graph ID (something that is largely static) which is owned by n external service i.e. Apollo Studio).
However even this approach breaks down once you enter a monorepo environment. Consider a lerna based monorepo, we would want to do the following
This would execute
yarn run schema:check
in all monorepo packages. Unless all packages depend on the single graph were no longer able to use positional arguments. The--variant
flag solves this since flags are passed on by lerna (and other monorepo tools) and node package managers.The text was updated successfully, but these errors were encountered: