-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ts
54 lines (48 loc) · 1.16 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* @rlanz/sentry
*
* (c) Romain Lanz
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { stubsRoot } from './stubs/main.js'
import type Configure from '@adonisjs/core/commands/configure'
/**
* Configures the package
*/
export async function configure(command: Configure) {
const codemods = await command.createCodemods()
/**
* Publish config file
*/
await codemods.makeUsingStub(stubsRoot, 'config/sentry.stub', {})
/**
* Define environment variables
*/
await codemods.defineEnvVariables({ SENTRY_DSN: '<your_dsn_url>' })
/**
* Define environment variables validations
*/
await codemods.defineEnvValidations({
variables: {
SENTRY_DSN: 'Env.schema.string()',
},
leadingComment: 'Variables for configuring @rlanz/sentry package',
})
/**
* Register middleware
*/
await codemods.registerMiddleware('router', [
{
path: '@rlanz/sentry/middleware',
position: 'before',
},
])
/**
* Register provider
*/
await codemods.updateRcFile((rcFile) => {
rcFile.addProvider('@rlanz/sentry/provider')
})
}