diff --git a/configure.ts b/configure.ts index 1f20d8f..8c4b031 100644 --- a/configure.ts +++ b/configure.ts @@ -8,25 +8,26 @@ */ 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 command.publishStub('config.stub') + await codemods.makeUsingStub(stubsRoot, 'config/i18n.stub', {}) /** * Publish middleware file */ - await command.publishStub('detect_user_locale.stub', { + await codemods.makeUsingStub(stubsRoot, 'make/middleware/detect_user_locale.stub', { entity: command.app.generators.createEntity('detect_user_locale'), }) - const codemods = await command.createCodemods() - /** * Register middleware */ diff --git a/index.ts b/index.ts index 6b72453..629730b 100644 --- a/index.ts +++ b/index.ts @@ -9,6 +9,5 @@ export { I18n } from './src/i18n.js' export { configure } from './configure.js' -export { stubsRoot } from './stubs/main.js' export { I18nManager } from './src/i18n_manager.js' export { defineConfig, formatters, loaders } from './src/define_config.js' diff --git a/stubs/config.stub b/stubs/config/i18n.stub similarity index 100% rename from stubs/config.stub rename to stubs/config/i18n.stub diff --git a/stubs/detect_user_locale.stub b/stubs/make/middleware/detect_user_locale.stub similarity index 100% rename from stubs/detect_user_locale.stub rename to stubs/make/middleware/detect_user_locale.stub