Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
feat(nuxt): add box @nuxtjs/google-fonts package
Browse files Browse the repository at this point in the history
  • Loading branch information
productdevbook committed Jan 22, 2024
1 parent a104d11 commit 5b02ae9
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 26 deletions.
1 change: 1 addition & 0 deletions packages/box/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@iconify-json/ph": "^1.1.10",
"@neoconfetti/vue": "^2.2.1",
"@nuxtjs/color-mode": "^3.3.2",
"@nuxtjs/google-fonts": "^3.1.3",
"@nuxtjs/i18n": "^8.0.0",
"@nuxtjs/tailwindcss": "^6.11.0",
"@oku-ui/label": "^0.6.1",
Expand Down
30 changes: 30 additions & 0 deletions packages/nuxt/src/runtime/modules/box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { IconsPluginOptions } from '@egoist/tailwindcss-icons'
import type { ModuleOptions } from '@nuxtjs/i18n'
import consola from 'consola'
import type { ModuleOptions as TailwindCSSOptions } from '@nuxtjs/tailwindcss'
import type { ModuleOptions as GoogleFonts } from '@nuxtjs/google-fonts'
import { definePergelModule } from '../../core/definePergel'
import { useNitroImports, useNuxtImports } from '../../core/utils/useImports'
import { addDownloadTemplate } from '../../core/utils/createDownloadTemplate'
Expand Down Expand Up @@ -39,6 +40,7 @@ export default definePergelModule<BoxOptions, ResolvedBoxOptions>({
pinia: false,
vueUse: false,
neoconfetti: false,
googleFonts: false,
},
},
async setup({ nuxt, options }) {
Expand Down Expand Up @@ -132,6 +134,15 @@ export default definePergelModule<BoxOptions, ResolvedBoxOptions>({
],
from: 'zod',
},
{
from: 'zod',
imports: [{
from: 'zod',
as: 'Zod',
name: 'z',
type: true,
}],
},
],
})

Expand All @@ -146,6 +157,15 @@ export default definePergelModule<BoxOptions, ResolvedBoxOptions>({
],
from: 'zod',
},
{
from: 'zod',
imports: [{
from: 'zod',
as: 'Zod',
name: 'z',
type: true,
}],
},
],
})
}
Expand Down Expand Up @@ -330,6 +350,16 @@ export default definePergelModule<BoxOptions, ResolvedBoxOptions>({
if (options.packages.neoconfetti)
addPlugin(resolver.resolve('plugins/neoconfetti.ts'))

if (options.packages.googleFonts) {
await installModule('@nuxtjs/google-fonts', {
...typeof options.packages.googleFonts === 'object'
? options.packages.googleFonts as unknown as GoogleFonts
: {
families: ['Inter'],
},
} as Partial<GoogleFonts>)
}

addDownloadTemplate({
nuxt,
data: {
Expand Down
55 changes: 30 additions & 25 deletions packages/nuxt/src/runtime/modules/box/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { CollectionNames, IconsPluginOptions } from '@egoist/tailwindcss-ic
import type { PergelModuleOptions, ResolvedPergelModuleOptions } from '../../core/types/module'

export interface BoxOptions extends PergelModuleOptions {
brand?: 'pergel'
packages?: {
/**
* @default ['ph', 'carbon']
Expand All @@ -12,86 +11,92 @@ export interface BoxOptions extends PergelModuleOptions {
tailwindIcon?: CollectionNames[] | 'all' | IconsPluginOptions

/**
* @default true
* @default false
* @see https://tailwindcss.nuxtjs.org
*/
tailwindcss?: boolean

/**
* @default true
* @default false
* @see https://github.com/nuxt-modules/color-mode
*/
colorMode?: boolean
/**
* @default true
* @default false
* @see https://notivuedocs.netlify.app/push-usage/methods.html
*/
notivue?: boolean

/**
* @default true
* @default false
* @see https://github.com/radix-vue/radix-vue
*/
radixVue?: boolean

/**
* @default true
* @default false
* @see https://github.com/nuxt-modules/icon
*/
nuxtIcon?: boolean

/**
* @default true
* @default false
* @see https://github.com/colinhacks/zod
*/
zod?: boolean

/**
* @default true
* @default false
* @see https://vee-validate.logaretm.com/v4
*/
veeValidate?: boolean

/**
* @default true
* @default false
* @see https://i18n.nuxtjs.org
*/
i18n?: boolean

/**
* @default true
* @default false
* @see https://pinia.vuejs.org
*/
pinia?: boolean

/**
* @default true
* @default false
* @see https://vueuse.org
*/
vueUse?: boolean

/**
* @default true
* @default false
* @see https://github.com/PuruVJ/neoconfetti/tree/main/packages/vue
*/
neoconfetti: boolean
}
neoconfetti?: boolean

/**
* @default false
* @see https://google-fonts.nuxtjs.org/
*/
googleFonts?: boolean | { families: string[] }
}
}

export interface ResolvedBoxOptions extends ResolvedPergelModuleOptions {
packages: {
tailwindIcon?: CollectionNames[] | 'all' | IconsPluginOptions
tailwindcss?: boolean
colorMode?: boolean
notivue?: boolean
radixVue?: boolean
nuxtIcon?: boolean
zod?: boolean
veeValidate?: boolean
i18n?: boolean
pinia?: boolean
vueUse?: boolean
tailwindIcon: CollectionNames[] | 'all' | IconsPluginOptions
tailwindcss: boolean
colorMode: boolean
notivue: boolean
radixVue: boolean
nuxtIcon: boolean
zod: boolean
veeValidate: boolean
i18n: boolean
pinia: boolean
vueUse: boolean
neoconfetti: boolean
googleFonts: boolean | { families: string[] }
}
}
25 changes: 24 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b02ae9

Please sign in to comment.