-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ts
More file actions
59 lines (52 loc) · 1.57 KB
/
Copy pathconfigure.ts
File metadata and controls
59 lines (52 loc) · 1.57 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
|--------------------------------------------------------------------------
| 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 type Configure from '@adonisjs/core/commands/configure'
import { stubsRoot } from './stubs/main.js'
/**
* Configures the package
*/
export async function configure(command: Configure) {
const codemods = await command.createCodemods()
/**
* Publish config file
*/
await codemods.makeUsingStub(stubsRoot, 'config/zeytech_chat.stub', {})
/**
* Public migrations
*/
await codemods.makeUsingStub(stubsRoot, 'migrations/init_chat_histories_table.stub', {})
/**
* Define environment variables
*/
await codemods.defineEnvVariables({
ZEYTECH_CHAT_USERNAME: '',
ZEYTECH_CHAT_PASSWORD: '',
})
/**
* Define environment variables validations
*/
await codemods.defineEnvValidations({
variables: {
ZEYTECH_CHAT_USERNAME: `Env.schema.string.optional()`,
ZEYTECH_CHAT_PASSWORD: `Env.schema.string()`,
},
leadingComment: 'Variables for configuring Zeytech Chat package',
})
/**
* Register provider
*/
await codemods.updateRcFile((rcFile) => {
rcFile.addProvider('@zeytech/chat-adonisjs/zeytech_chat_provider')
})
}