@@ -5,6 +5,7 @@ import colors from '../utils/colors';
5
5
import { ResolvedCommandKitConfig } from '../config/utils' ;
6
6
import { generateTypesPackage } from '../utils/types-package' ;
7
7
import { execSync } from 'node:child_process' ;
8
+ import { COMMANDKIT_CWD } from '../utils/constants' ;
8
9
9
10
let ts : typeof import ( 'typescript' ) | undefined ;
10
11
@@ -40,21 +41,6 @@ export function panic(message: any): never {
40
41
process . exit ( 1 ) ;
41
42
}
42
43
43
- /**
44
- * @private
45
- * @internal
46
- */
47
- export function findPackageJSON ( ) {
48
- const cwd = process . cwd ( ) ;
49
- const target = join ( cwd , 'package.json' ) ;
50
-
51
- if ( ! fs . existsSync ( target ) ) {
52
- panic ( 'Could not find package.json in current directory.' ) ;
53
- }
54
-
55
- return JSON . parse ( fs . readFileSync ( target , 'utf8' ) ) ;
56
- }
57
-
58
44
/**
59
45
* @private
60
46
* @internal
@@ -89,7 +75,7 @@ function detectPackageManager() {
89
75
} ;
90
76
91
77
for ( const [ lockfile , manager ] of Object . entries ( lockfiles ) ) {
92
- if ( fs . existsSync ( join ( process . cwd ( ) , lockfile ) ) ) {
78
+ if ( fs . existsSync ( join ( COMMANDKIT_CWD , lockfile ) ) ) {
93
79
packageManager = manager ;
94
80
break ;
95
81
}
@@ -118,7 +104,7 @@ export async function loadTypeScript(e?: string) {
118
104
const prefix = packageManager === 'deno' ? 'npm:' : '' ;
119
105
execSync ( `${ packageManager } add -D ${ prefix } typescript` , {
120
106
stdio : 'inherit' ,
121
- cwd : process . cwd ( ) ,
107
+ cwd : COMMANDKIT_CWD ,
122
108
} ) ;
123
109
124
110
console . log (
@@ -169,7 +155,7 @@ export async function loadConfigFileFromPath(
169
155
170
156
await generateTypesPackage ( ) ;
171
157
172
- const nodeModulesPath = process . cwd ( ) ;
158
+ const nodeModulesPath = COMMANDKIT_CWD ;
173
159
174
160
const tmpFile = join ( nodeModulesPath , 'compiled-commandkit.config.mjs' ) ;
175
161
@@ -223,8 +209,8 @@ export function erase(dir: string) {
223
209
* @internal
224
210
*/
225
211
export async function copyLocaleFiles ( _from : string , _to : string ) {
226
- const resolvedFrom = join ( process . cwd ( ) , _from ) ;
227
- const resolvedTo = join ( process . cwd ( ) , _to ) ;
212
+ const resolvedFrom = join ( COMMANDKIT_CWD , _from ) ;
213
+ const resolvedTo = join ( COMMANDKIT_CWD , _to ) ;
228
214
229
215
const localePaths = [ 'app/locales' ] ;
230
216
const srcLocalePaths = localePaths . map ( ( path ) => join ( resolvedFrom , path ) ) ;
0 commit comments