@thisismissem/adonisjs-respond-with
Version:
A small plugin for Adonis.js to make responding with different content-types easier.
30 lines (29 loc) • 1.01 kB
JavaScript
/*
|--------------------------------------------------------------------------
| 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';
export async function configure(command) {
const codemods = await command.createCodemods();
/**
* Define the configuration file
*/
await codemods.makeUsingStub(stubsRoot, 'config/respond_with.stub', {
packageName: '@thisismissem/adonisjs-respond-with',
});
/**
* Register provider
*/
await codemods.updateRcFile((rcFile) => {
rcFile.addProvider(`@thisismissem/adonisjs-respond-with/provider`);
});
}