From ba79c79453a04e309947cc44b53de56453a3f089 Mon Sep 17 00:00:00 2001 From: selemondev-triply Date: Thu, 29 Aug 2024 15:01:59 +0300 Subject: [PATCH 1/2] feat(app): #537 auto install the module This pull request is intended to install the module during the installation of the module Closes: #537 --- packages/module/src/module.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/module/src/module.ts b/packages/module/src/module.ts index fc360ca1d..e272c5643 100644 --- a/packages/module/src/module.ts +++ b/packages/module/src/module.ts @@ -1,7 +1,7 @@ import { readFileSync, readdirSync } from 'node:fs' import { join } from 'node:path' import { parseSync } from '@oxc-parser/wasm' -import { addComponent, addTemplate, createResolver, defineNuxtModule, findPath, useLogger } from '@nuxt/kit' +import { addComponent, addTemplate, createResolver, defineNuxtModule, findPath, installModule, useLogger } from '@nuxt/kit' import { UTILS } from '../../cli/src/utils/templates' // TODO: add test to make sure all registry is being parse correctly @@ -59,6 +59,14 @@ export default defineNuxtModule({ }) }) + // Installs the `@nuxtjs/color-mode` module. + + await installModule('@nuxtjs/color-mode', { + colorMode: { + classSuffix: '', + }, + }) + // Manually scan `componentsDir` for components and register them for auto imports try { readdirSync(resolve(COMPONENT_DIR_PATH)) @@ -73,7 +81,7 @@ export default defineNuxtModule({ const exportedKeys: string[] = ast.program.body .filter(node => node.type === 'ExportNamedDeclaration') - // @ts-expect-error parse return any + // @ts-expect-error parse return any .flatMap(node => node.specifiers.map(specifier => specifier.exported.name)) .filter((key: string) => /^[A-Z]/.test(key)) From 35f4ad82f7230edd45192571dc69e39e3318784e Mon Sep 17 00:00:00 2001 From: selemondev-triply Date: Thu, 29 Aug 2024 15:19:32 +0300 Subject: [PATCH 2/2] docs: update Nuxt dark mode --- apps/www/src/content/docs/dark-mode/nuxt.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/www/src/content/docs/dark-mode/nuxt.md b/apps/www/src/content/docs/dark-mode/nuxt.md index 4bf1150c8..60859d6b7 100644 --- a/apps/www/src/content/docs/dark-mode/nuxt.md +++ b/apps/www/src/content/docs/dark-mode/nuxt.md @@ -7,7 +7,7 @@ description: Adding dark mode to your nuxt app. -### Install Dependencies + ### Add a mode toggle Place a mode toggle on your site to toggle between light and dark mode. +The `@nuxtjs/color-mode` module is automatically installed and configured during the installation of the `shadcn-nuxt` module, so you literally have nothing to do. + We're using [`useColorMode`](https://color-mode.nuxtjs.org/#usage) from [`Nuxt Color Mode`](https://color-mode.nuxtjs.org/). +Optional, to include icons for theme button. +```bash +npm install -D @iconify/vue @iconify-json/radix-icons +``` + ```vue