@@ -10,7 +10,7 @@ import {
1010} from "../definitions/project" ;
1111
1212import type { PromptObject } from "prompts" ;
13- import { IOptions } from "../declarations" ;
13+ import { IOptions , IStaticConfig } from "../declarations" ;
1414import {
1515 ITerminalSpinner ,
1616 ITerminalSpinnerService ,
@@ -22,8 +22,6 @@ import { resolve } from "path";
2222import { readdir } from "fs/promises" ;
2323import { isInteractive } from "../common/helpers" ;
2424
25- const CLIPath = resolve ( __dirname , ".." , ".." , "bin" , "nativescript.js" ) ;
26-
2725function bytesToHumanReadable ( bytes : number ) : string {
2826 const units = [ "B" , "KB" , "MB" , "GB" , "TB" ] ;
2927 let unit = 0 ;
@@ -90,7 +88,8 @@ export class CleanCommand implements ICommand {
9088 private $prompter : IPrompter ,
9189 private $logger : ILogger ,
9290 private $options : IOptions ,
93- private $childProcess : IChildProcess
91+ private $childProcess : IChildProcess ,
92+ private $staticConfig : IStaticConfig
9493 ) { }
9594
9695 public async execute ( args : string [ ] ) : Promise < void > {
@@ -198,9 +197,12 @@ export class CleanCommand implements ICommand {
198197 paths ,
199198 ( p ) => {
200199 return this . $childProcess
201- . exec ( `node ${ CLIPath } clean --dry-run --json --disable-analytics` , {
202- cwd : p ,
203- } )
200+ . exec (
201+ `node ${ this . $staticConfig . cliBinPath } clean --dry-run --json --disable-analytics` ,
202+ {
203+ cwd : p ,
204+ }
205+ )
204206 . then ( ( res ) => {
205207 const paths : Record < string , number > = JSON . parse ( res ) . stats ;
206208 return Object . values ( paths ) . reduce ( ( a , b ) => a + b , 0 ) ;
@@ -290,7 +292,7 @@ export class CleanCommand implements ICommand {
290292
291293 const ok = await this . $childProcess
292294 . exec (
293- `node ${ CLIPath } clean ${
295+ `node ${ this . $staticConfig . cliBinPath } clean ${
294296 this . $options . dryRun ? "--dry-run" : ""
295297 } --json --disable-analytics`,
296298 {
0 commit comments