Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/friendly-lemons-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

fix: git detection inside preconditions failed
9 changes: 5 additions & 4 deletions packages/cli/commands/add/preconditions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { exec } from 'tinyexec';
import { exec } from 'node:child_process';
import { promisify } from 'node:util';
import type { AddonSetupResult, AddonWithoutExplicitArgs, Precondition } from '@sveltejs/cli-core';
import { UnsupportedError } from '../../utils/errors.ts';

Expand All @@ -21,9 +22,9 @@ export function getGlobalPreconditions(
// there are no pending changes. If the below command is run outside of a git repository,
// git will exit with a failing exit code, which will trigger the catch statement.
// also see https://remarkablemark.org/blog/2017/10/12/check-git-dirty/#git-status
const { stdout } = await exec('git', ['status', '--short'], {
nodeOptions: { cwd },
throwOnError: true
const asyncExec = promisify(exec);
const { stdout } = await asyncExec('git statzs --short', {
Comment thread
manuel3108 marked this conversation as resolved.
Outdated
cwd
});

if (stdout) {
Expand Down