-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ts
35 lines (31 loc) · 1.09 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
/*
|--------------------------------------------------------------------------
| Configure hook
|--------------------------------------------------------------------------
|
| The configure hook is called when someone runs "node ace configure <package>"
| command. You are free to perform any operations inside this function to
| configure the package.
|
| To make things easier, you have access to the underlying "ConfigureCommand"
| instance and you can use codemods to modify the source files.
|
*/
import ConfigureCommand from '@adonisjs/core/commands/configure'
import { stubsRoot } from './stubs/main.js'
export async function configure(_command: ConfigureCommand) {
const codemods = await _command.createCodemods()
/**
* Publish config file
*/
await codemods.makeUsingStub(stubsRoot, 'config/socketio.stub', {})
/**
* Register provider
*/
await codemods.updateRcFile((rcFile) => {
rcFile
.addProvider('@softmila/adonisjs-socketio/socketio_provider')
.addCommand('@softmila/adonisjs-socketio/commands')
.setCommandAlias('iomiddleware', 'make:io:middleware')
})
}