Skip to content

Commit 2fe58c1

Browse files
committed
feat(module): allow to disable auto install of the nuxt i18n module
1 parent 78b8dfc commit 2fe58c1

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ That's it! You can now use FormKit PrimeVue Nuxt Module in your Nuxt app ✨
3434
- **formkitLocale** (default: `'en'`): Set the FormKit local (Only hen formkitAutoConfig is `true`).
3535
- **formkitPluginAnimate** (default: `true`): Enable FormKit animate plugin (Only hen formkitAutoConfig is `true`).
3636
- **formkitPluginAsterisk** (default: `true`): Enable FormKit asterisk plugin (Only hen formkitAutoConfig is `true`).
37+
- **installI18N** (default: `true`): Install nuxt i18n module automatically.
3738

3839
### Custom Global FormKit Configuration
3940

playground/app.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ const options = [
1212
const data = ref()
1313
1414
onMounted(() => {
15-
const defaultData = { email: 'tom@mydomain.com', additionalMails: [{ email: 'peter@mydomain.com' }, { email: 'paul@mydomain.com' }], myCalendar: new Date() }
15+
const defaultData = { email: 'tom@mydomain.com', additionalMails: [{ email: 'peter@mydomain.com' }, { email: 'paul@mydomain.com' }], myCalendar: new Date(), date: new Date() }
1616
addListGroupFunctions(defaultData, { email: 'name@mydomain.com' })
1717
data.value = defaultData
1818
})
1919
2020
const schema = reactive(
2121
[
2222
addElement('h5', ['Validation with FormKit - Inputs from PrimeVue']),
23+
{
24+
$formkit: 'primeOutputDate',
25+
name: 'date',
26+
label: 'Date',
27+
},
2328
{
2429
$formkit: 'primeInputText',
2530
name: 'email',
@@ -125,7 +130,6 @@ async function submitHandler() {
125130
<div style="padding: 1rem">
126131
<div>
127132
<h2>FormKit PrimeVue Nuxt Playground</h2>
128-
129133
<div v-if="data">
130134
<FormKitDataEdit
131135
:schema="schema"

playground/nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default defineNuxtConfig({
1111
formkitLocale: 'en',
1212
formkitPluginAnimate: true,
1313
formkitPluginAsterisk: true,
14+
installI18N: true,
1415
},
1516
i18n: {
1617
lazy: true,

src/module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface ModuleOptions {
1515
formkitLocale: 'en' | 'de' | 'fr' | 'es' | 'tr'
1616
formkitPluginAsterisk: boolean
1717
formkitPluginAnimate: boolean
18+
installI18N: boolean
1819
}
1920

2021
export default defineNuxtModule<ModuleOptions>({
@@ -33,6 +34,7 @@ export default defineNuxtModule<ModuleOptions>({
3334
formkitLocale: 'en',
3435
formkitPluginAnimate: true,
3536
formkitPluginAsterisk: true,
37+
installI18N: true,
3638
},
3739
async setup(_options, _nuxt) {
3840
_nuxt.options.runtimeConfig.public.formkitPrimevue = defu(_nuxt.options.runtimeConfig.public.formkitPrimevue,
@@ -46,7 +48,9 @@ export default defineNuxtModule<ModuleOptions>({
4648

4749
const resolver = createResolver(import.meta.url)
4850
await installModule('@primevue/nuxt-module')
49-
await installModule('@nuxtjs/i18n')
51+
52+
if (_options.installI18N)
53+
await installModule('@nuxtjs/i18n')
5054

5155
const css: string[] = _nuxt.options.css ?? []
5256
if (_options.includePrimeIcons) {

0 commit comments

Comments
 (0)