[cli] Add target to vc inspect output#11821
Conversation
🦋 Changeset detectedLatest commit: c87c37c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
345b9de to
a83d2d7
Compare
…ent-in-vc-inspect-output
If the deployment has a custom environment, the user is flagged into custom environments. Later on, we can always link to the /setting/environments page.
| print(` ${chalk.cyan('name')}\t${name}\n`); | ||
| // @ts-ignore - customEnvironment needs to be defined on Deployment | ||
| const customEnvironmentName = deployment.customEnvironment?.name; | ||
| const target = customEnvironmentName ?? deployment.target; |
There was a problem hiding this comment.
deployment.target has type "staging" | "production" | "null" | "undefined". Even after spending time digging into this, I'm still unsure what null or undefined values mean.
If the deployment doesn't have a custom environment name, and target is null or undefined, should it default to displaying something?
There was a problem hiding this comment.
I think displaying nothing is fine here. Pretty edge-casey.
👋 hello future someone reading this wondering why we didn't handle this case!
There was a problem hiding this comment.
null means "preview", so we should special-case that. undefined I think does not ever happen, but probably fine to default that to "preview" as well.
| print( | ||
| // @ts-ignore - customEnvironment needs to be defined on Deployment | ||
| customEnvironmentName && deployment.team?.slug | ||
| ? `${link( |
There was a problem hiding this comment.
I think the consensus we had regarding links is that if the terminal does not support them, don't render the link. That is to say, we should add a fallback (2nd param of the link() function) which returns only the name of the target.
|
Let's add a unit test please. |
This means the target is preview.
| customEnvironmentName && deployment.team?.slug | ||
| ? `${link( | ||
| `${target}`, | ||
| `https://vercel.com/${deployment.team.slug}/${name}/settings/environments`, |
There was a problem hiding this comment.
I think we should link to the specific target's page.
…ent-in-vc-inspect-output
…ent-in-vc-inspect-output
| ? `${link( | ||
| `${target}`, | ||
| `https://vercel.com/${deployment.team.slug}/${name}/settings/environments`, | ||
| // @ts-ignore - customEnvironment needs to be defined on Deployment |
There was a problem hiding this comment.
I would suggest @ts-expect-error instead. But also, can we add the type to Deployment so it's not necessary?
15ae743 to
d6c3f42
Compare
| print(` ${chalk.cyan('name')}\t${name}\n`); | ||
| const customEnvironmentName = deployment.customEnvironment?.name; | ||
| const target = customEnvironmentName ?? deployment.target ?? 'preview'; | ||
| if (target) { |
…ent-in-vc-inspect-output
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## [email protected] ### Minor Changes - Add target output to `vc inspect` ([#11821](#11821)) - Send `customEnvironmentSlugOrId` to the create deployment endpoint ([#11789](#11789)) - Add `vc target ls` command ([#11790](#11790)) ### Patch Changes - Various improvements to vc target ls ([#11840](#11840)) - Updated dependencies \[[`3eb40c8c2`](3eb40c8), [`d0fe663af`](d0fe663), [`b1e4a4011`](b1e4a40), [`55ab52512`](55ab525)]: - @vercel/[email protected] - @vercel/[email protected] - @vercel/[email protected] - @vercel/[email protected] - @vercel/[email protected] ## @vercel/[email protected] ### Minor Changes - Send `customEnvironmentSlugOrId` to the create deployment endpoint ([#11789](#11789)) ### Patch Changes - Updated dependencies \[[`3eb40c8c2`](3eb40c8)]: - @vercel/[email protected] ## @vercel/[email protected] ### Patch Changes - reject mismatched corepack and detected package managers ([#11603](#11603)) ## @vercel/[email protected] ### Patch Changes - Updated dependencies \[[`3eb40c8c2`](3eb40c8)]: - @vercel/[email protected] ## @vercel/[email protected] ### Patch Changes - Ensure we do not include ending slash in matched path ([#11830](#11830)) ## @vercel/[email protected] ### Patch Changes - Updated dependencies \[[`3eb40c8c2`](3eb40c8)]: - @vercel/[email protected] ## @vercel/[email protected] ### Patch Changes - Update `@remix-run/dev` fork to v2.10.2 ([#11837](#11837)) ## @vercel/[email protected] ### Patch Changes - [framework-fixtures]: Bump the core group across 1 directory with 3 updates ([#11773](#11773)) - Updated dependencies \[]: - @vercel/[email protected] ## @vercel-internals/[email protected] ### Patch Changes - Updated dependencies \[[`3eb40c8c2`](3eb40c8)]: - @vercel/[email protected] Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
vc inspectdid not output target before. This adds target output for existing "staging" and "production" values and custom environment names.