@aventusjs/cli 0.0.46 → 0.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs'
2
2
  import { dirname, join, normalize, sep } from 'path'
3
+ import { randomUUID } from 'node:crypto'
3
4
 
4
5
  export type Version = `${number}.${number}.${number}`
5
6
  export interface InputOptions {
@@ -217,10 +218,10 @@ export abstract class AventusTemplate {
217
218
  }
218
219
 
219
220
  protected waitingResponse: { [cmd: string]: (response: string | null) => void } = {};
220
- private runCommandWithAnswer(cmd: string, config?: any): Promise<string | null> {
221
+ private runCommandWithAnswer(cmd: string, config?: any, responseKey = cmd): Promise<string | null> {
221
222
  return new Promise<string | null>((resolve) => {
222
- this.waitingResponse[cmd] = (response: string | null) => {
223
- delete this.waitingResponse[cmd];
223
+ this.waitingResponse[responseKey] = (response: string | null) => {
224
+ delete this.waitingResponse[responseKey];
224
225
  resolve(response);
225
226
  }
226
227
  log(JSON.stringify({ cmd, config }));
@@ -442,7 +443,8 @@ export abstract class AventusTemplate {
442
443
  }
443
444
 
444
445
  protected async aventusCommand(cmd: string, args?: any[]): Promise<void> {
445
- await this.runCommand("aventusCommand", { command: cmd, arguments: args });
446
+ const responseKey = randomUUID();
447
+ await this.runCommandWithAnswer("aventusCommand", { command: cmd, arguments: args, responseKey }, responseKey);
446
448
  }
447
449
 
448
450
  protected showErrorMessage(msg: string): void {