-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ts
More file actions
27 lines (24 loc) · 1.01 KB
/
configure.ts
File metadata and controls
27 lines (24 loc) · 1.01 KB
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
/*
|--------------------------------------------------------------------------
| 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 { stubsRoot } from './stubs/main.js'
import ConfigureCommand from '@adonisjs/core/commands/configure'
export async function configure(command: ConfigureCommand) {
const codemods = await command.createCodemods()
await codemods.makeUsingStub(stubsRoot, 'config/websocket.stub', {})
await codemods.makeUsingStub(stubsRoot, 'start/websocket.stub', {})
await codemods.updateRcFile((rcFile) => {
rcFile.addProvider('@xnicecraft/adonisjs-socketio/websocket_provider')
rcFile.addPreloadFile('#start/websocket')
})
}