@rlanz/sentry
Version:
A wrapper around the Sentry SDK to make it easier to use in a AdonisJS application
48 lines (47 loc) • 1.21 kB
JavaScript
/*
* @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';
/**
* Configures the package
*/
export async function configure(command) {
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');
});
}