Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 4d47d9a

Browse files
committed
build(nuxt): copy runtime
1 parent c0b05ff commit 4d47d9a

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ dist
55
# documentation for adding ESLint for Vue 3 projects running on Vite.
66
# For this reason, we ignore the playground directory.
77
playground
8-
snapshots.js
8+
snapshots.js
9+
chakra.universal.t.js

examples/nuxt-app/app.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
justify-content="center"
66
align-items="center"
77
>
8+
<CButton>Hello Chakra</CButton>
89
<chakra.button
910
@click="toggleColorMode"
1011
px="4"
@@ -16,6 +17,8 @@
1617
Click me to toggle | {{ colorMode }}
1718
</chakra.button>
1819

20+
<client-only><c-avatar name="Jonathan Bakebwa" /></client-only>
21+
1922
<chakra.button px="4" py="3" bg="$brand" font-weight="bold">
2023
Extended Component
2124
</chakra.button>

packages/nuxt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Jonathan Bakebwa [email protected]",
1818
"license": "MIT",
1919
"scripts": {
20-
"build": "tsup && pnpm build:types",
20+
"build": "tsup --onSuccess 'cp -a src/templates dist' && pnpm build:types",
2121
"build:fast": "tsup",
2222
"dev": "tsup --watch",
2323
"clean": "rimraf dist .turbo",

packages/nuxt/src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default defineNuxtModule<ChakraModuleOptions>({
9595
addPlugin(resolve(runtimeDir, "chakra.factory.universal"))
9696
addPluginTemplate(
9797
{
98-
src: resolve(templatesDir, "chakra.universal.t.ts"),
98+
src: resolve(templatesDir, "chakra.universal.t.js"),
9999
options: {
100100
extendTheme,
101101
cssReset,

packages/nuxt/src/templates/chakra.universal.t.ts renamed to packages/nuxt/src/templates/chakra.universal.t.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@ import Chakra, {
33
cookieStorageManagerSSR,
44
extendChakra,
55
ColorModeConstants,
6-
ColorModeScriptProps,
76
extendTheme
87
} from "@chakra-ui/vue-next"
98
import { parseCookies } from "h3"
109

11-
type AllowedSSRColorMode = Exclude<
12-
ColorModeScriptProps["initialColorMode"],
13-
"system"
14-
>
1510

1611
const extendedTheme = <%= (function() {
1712
// keep a list of serialized functions
@@ -42,14 +37,14 @@ const extendedTheme = <%= (function() {
4237
export default defineNuxtPlugin((nuxtApp) => {
4338

4439
// SSR Color Mode Handling
45-
let ssrColorMode: AllowedSSRColorMode
40+
let ssrColorMode
4641
const event = nuxtApp.ssrContext?.event
4742

4843
if (event) {
4944
const parsedCookies = parseCookies(event)
5045
const colorMode = parsedCookies[ColorModeConstants.CookieStorageKey]
5146
if (colorMode) {
52-
ssrColorMode = colorMode as AllowedSSRColorMode
47+
ssrColorMode = colorMode
5348
} else {
5449
// TODO: Replace with options color mode
5550
ssrColorMode = "light"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { defineNuxtConfig } from 'nuxt/config'
2-
import emotionModule from '../..'
1+
import { defineNuxtConfig } from "nuxt/config"
2+
import chakraModule from "../.."
33

44
export default defineNuxtConfig({
5-
modules: [emotionModule]
5+
modules: [chakraModule],
66
})

packages/nuxt/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
// "extends": "../../tsconfig.json",
33
"extends": "./playground/.nuxt/tsconfig.json",
4-
"include": ["src", "./index.tsx", "./index.ts"]
4+
"include": ["src", "./index.tsx", "./index.ts"],
5+
"exclude": ["src/templates"]
56
}

0 commit comments

Comments
 (0)