Skip to content

feat(sv-utils): add commandExists - #1323

Merged
teemingc merged 8 commits into
sveltejs:version-1from
sacrosanctic:command-exists
Sep 18, 2026
Merged

teemingc merged 8 commits into
sveltejs:version-1from
sacrosanctic:command-exists

Conversation

@sacrosanctic

@sacrosanctic sacrosanctic commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Closes #
Alternative to #1322

Description

Replaces the existing execSync('<bin>', ['--version']) with a battle tested solution based on command-exists (src).

This should:

Checklist

  • Update snapshots (if applicable)
  • Add a changeset (if applicable)
  • Allow maintainers to edit this PR
  • I care about what I'm doing, no matter the tool I use (Notepad, Sublime, VSCode, AI...)

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 16, 2026

Copy link
Copy Markdown

Install the latest version of sv from 69a41db:

pnx https://pkg.svelte.dev/sv/c/69a41db81c033778fd3a83d15a8e77bcc8533657 create

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/cli/pr/1323

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 69a41db

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

This PR includes changesets to release 2 packages
Name Type
@sveltejs/sv-utils Patch
sv Patch

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

@jycouet jycouet left a comment

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 like it a lot.

Should we move commandExists to sv-utils ? And with a nice JSDoc on top?

@jycouet

jycouet commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Hooo, and thx for targeting version-1, I think it's better

@sacrosanctic

Copy link
Copy Markdown
Contributor Author

Should we move commandExists to sv-utils ? And with a nice JSDoc on top?

I was thinking we can test it internally first, make sure it actually works.

Hooo, and thx for targeting version-1, I think it's better

Haha, that was a mistake. I had intended to target main. But glad it worked out.

@jycouet

jycouet commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Nahhh, let's put it directly in the right place imo. 😁

@sacrosanctic

Copy link
Copy Markdown
Contributor Author

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

Can you approve this commit and we can ask @PixelForm to verify?

Nahhh, let's put it directly in the right place imo. 😁

Are you referring to sv-utils?

@svelte-docs-bot

Copy link
Copy Markdown

@jycouet

jycouet commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

Can you approve this commit and we can ask @PixelForm to verify?

You can try it with npx https://pkg.svelte.dev/sv/c/53f9df5e14944b3b2ffd6ba88dd044bfe108226f create

Nahhh, let's put it directly in the right place imo. 😁

Are you referring to sv-utils?

Yes

@sacrosanctic sacrosanctic changed the title feat(sv): add commandExists feat(sv-utils): add commandExists Sep 16, 2026
Comment thread packages/sv/src/testing.ts Outdated
@sacrosanctic

Copy link
Copy Markdown
Contributor Author

on second thought, maybe we dont need the sanitization

@jycouet jycouet left a comment

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.

LGTM, thank you

});

it('returns false for a command that does not exist', () => {
expect(commandExists('definitely-not-a-real-command-xyz-42')).toBe(false);

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 have a name for my next bin now! thx :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, is there an equiv like example.com

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 it's good like this 👌

@teemingc teemingc linked an issue Sep 18, 2026 that may be closed by this pull request
@teemingc
teemingc merged commit 9b86f62 into sveltejs:version-1 Sep 18, 2026
7 of 8 checks passed
@sacrosanctic
sacrosanctic deleted the command-exists branch September 18, 2026 20:45
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.

Problem setting up a new SvelteKit project

3 participants