Skip to content

[cli] Add target to vc inspect output#11821

Merged
kodiakhq[bot] merged 21 commits intomainfrom
austinmerrick/zero-2020-show-custom-environment-in-vc-inspect-output
Jul 12, 2024
Merged

[cli] Add target to vc inspect output#11821
kodiakhq[bot] merged 21 commits intomainfrom
austinmerrick/zero-2020-show-custom-environment-in-vc-inspect-output

Conversation

@onsclom
Copy link
Copy Markdown
Contributor

@onsclom onsclom commented Jul 9, 2024

vc inspect did not output target before. This adds target output for existing "staging" and "production" values and custom environment names.

image

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 9, 2024

🦋 Changeset detected

Latest commit: c87c37c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
vercel Minor

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

@onsclom onsclom force-pushed the austinmerrick/zero-2020-show-custom-environment-in-vc-inspect-output branch from 345b9de to a83d2d7 Compare July 9, 2024 18:10
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;
Copy link
Copy Markdown
Contributor Author

@onsclom onsclom Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think displaying nothing is fine here. Pretty edge-casey.

👋 hello future someone reading this wondering why we didn't handle this case!

Copy link
Copy Markdown
Member

@TooTallNate TooTallNate Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@onsclom onsclom marked this pull request as ready for review July 9, 2024 18:41
trek
trek previously approved these changes Jul 9, 2024
print(
// @ts-ignore - customEnvironment needs to be defined on Deployment
customEnvironmentName && deployment.team?.slug
? `${link(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@TooTallNate
Copy link
Copy Markdown
Member

Let's add a unit test please.

customEnvironmentName && deployment.team?.slug
? `${link(
`${target}`,
`https://vercel.com/${deployment.team.slug}/${name}/settings/environments`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should link to the specific target's page.

? `${link(
`${target}`,
`https://vercel.com/${deployment.team.slug}/${name}/settings/environments`,
// @ts-ignore - customEnvironment needs to be defined on Deployment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest @ts-expect-error instead. But also, can we add the type to Deployment so it's not necessary?

@onsclom onsclom force-pushed the austinmerrick/zero-2020-show-custom-environment-in-vc-inspect-output branch from 15ae743 to d6c3f42 Compare July 12, 2024 17:38
print(` ${chalk.cyan('name')}\t${name}\n`);
const customEnvironmentName = deployment.customEnvironment?.name;
const target = customEnvironmentName ?? deployment.target ?? 'preview';
if (target) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always be truthy

@kodiakhq kodiakhq bot merged commit cf578d6 into main Jul 12, 2024
@kodiakhq kodiakhq bot deleted the austinmerrick/zero-2020-show-custom-environment-in-vc-inspect-output branch July 12, 2024 19:27
EndangeredMassa pushed a commit that referenced this pull request Jul 15, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants