Skip to content

Commit 3ccd66d

Browse files
committed
fix: add cool off between executeInstructions and generate manifest
1 parent 1d4b4ab commit 3ccd66d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

commands/Invoke.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { BaseCommand, args } from '@adonisjs/ace'
1212
import { Manifest } from '../src/Manifest'
1313
import { ADONIS_ACE_CWD } from '../config/env'
1414

15+
const sleep = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout))
16+
1517
/**
1618
* Invoke post install instructions
1719
*/
@@ -44,6 +46,19 @@ export default class Invoke extends BaseCommand {
4446

4547
const { executeInstructions } = await import('@adonisjs/sink')
4648
await executeInstructions(this.name, cwd, this.application)
49+
50+
/**
51+
* When we execute the instructions that updates the `.adonisrc.json` file, we watcher
52+
* copies it's contents to the `build` directory.
53+
*
54+
* Once the copy is in progress, running the ace instructions leads to reading an empty
55+
* `.adonisrc.json` file.
56+
*
57+
* Now there is no simple way to know when the separate process watching and processing
58+
* files will copy the `.adonisrc.json` file. So we add a small cool off period in
59+
* between.
60+
*/
61+
await sleep(400)
4762
await new Manifest(cwd, this.logger).generate()
4863
}
4964
}

0 commit comments

Comments
 (0)