-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ts
38 lines (32 loc) · 1.01 KB
/
configure.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* @ayato-san/adonis-commands
*
* (c) Ayato-san
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import type Configure from '@adonisjs/core/commands/configure'
import { stubsRoot } from './stubs/main.js'
export async function configure(command: Configure) {
let screaming: boolean | undefined = command.parsedFlags.screaming
/**
* Prompt to select the architecture when --screaming flag is not used.
*/
if (screaming === undefined) {
screaming = await command.prompt.confirm('Do you want to use screaming architecture?')
} else {
screaming = !!screaming
}
const codemods = await command.createCodemods()
/**
* Create the configuration file
*/
await codemods.makeUsingStub(stubsRoot, 'config/main.stub', { screaming: !!screaming })
/**
* Register commands and provider to the rcfile
*/
await codemods.updateRcFile((rcFile) => {
rcFile.addCommand('@ayato-san/adonis-commands/commands')
})
}