@@ -5,7 +5,10 @@ import pc from "picocolors";
5
5
import { Precondition } from "./config.js" ;
6
6
import { executeCli } from "../utils/common.js" ;
7
7
8
- function getGlobalPreconditions ( executingCli : string ) : { name : string ; preconditions : Precondition [ ] | undefined } {
8
+ function getGlobalPreconditions (
9
+ executingCli : string ,
10
+ workingDirectory : string ,
11
+ ) : { name : string ; preconditions : Precondition [ ] | undefined } {
9
12
return {
10
13
name : executingCli ,
11
14
preconditions : [
@@ -21,7 +24,7 @@ function getGlobalPreconditions(executingCli: string): { name: string; precondit
21
24
// there are no pending changes. If the below command is run outside of a git repository,
22
25
// git will exit with a failing exit code, which will trigger the catch statement.
23
26
// also see https://remarkablemark.org/blog/2017/10/12/check-git-dirty/#git-status
24
- await executeCli ( "git" , [ "status" , "--short" ] , process . cwd ( ) , {
27
+ await executeCli ( "git" , [ "status" , "--short" ] , workingDirectory , {
25
28
onData : ( data , program , resolve ) => {
26
29
outputText += data ;
27
30
} ,
@@ -44,6 +47,7 @@ function getGlobalPreconditions(executingCli: string): { name: string; precondit
44
47
export async function validatePreconditions < Args extends OptionDefinition > (
45
48
adderDetails : AdderDetails < Args > [ ] ,
46
49
executingCliName : string ,
50
+ workingDirectory : string ,
47
51
isTesting : boolean ,
48
52
) {
49
53
const multipleAdders = adderDetails . length > 1 ;
@@ -56,7 +60,7 @@ export async function validatePreconditions<Args extends OptionDefinition>(
56
60
preconditions : checks . preconditions ,
57
61
} ;
58
62
} ) ;
59
- const combinedPreconditions = [ getGlobalPreconditions ( executingCliName ) , ...adderPreconditions ] ;
63
+ const combinedPreconditions = [ getGlobalPreconditions ( executingCliName , workingDirectory ) , ...adderPreconditions ] ;
60
64
61
65
for ( const { name, preconditions } of combinedPreconditions ) {
62
66
if ( ! preconditions ) continue ;
0 commit comments