shadcn-nuxt 0.10.4 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.d.mts CHANGED
@@ -2,7 +2,7 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
3
  interface ModuleOptions {
4
4
  /**
5
- * Prefix for all the imported component
5
+ * Prefix for all the imported component.
6
6
  */
7
7
  prefix?: string;
8
8
  /**
@@ -11,6 +11,6 @@ interface ModuleOptions {
11
11
  */
12
12
  componentDir?: string;
13
13
  }
14
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
14
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
15
15
 
16
16
  export { type ModuleOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
3
  interface ModuleOptions {
4
4
  /**
5
- * Prefix for all the imported component
5
+ * Prefix for all the imported component.
6
6
  */
7
7
  prefix?: string;
8
8
  /**
@@ -11,6 +11,6 @@ interface ModuleOptions {
11
11
  */
12
12
  componentDir?: string;
13
13
  }
14
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
14
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
15
15
 
16
16
  export { type ModuleOptions, _default as default };
package/dist/module.json CHANGED
@@ -1,5 +1,9 @@
1
1
  {
2
2
  "name": "shadcn",
3
3
  "configKey": "shadcn",
4
- "version": "0.10.4"
4
+ "version": "0.11.2",
5
+ "builder": {
6
+ "@nuxt/module-builder": "0.8.4",
7
+ "unbuild": "unknown"
8
+ }
5
9
  }
package/dist/module.mjs CHANGED
@@ -1,8 +1,16 @@
1
1
  import { readdirSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- import { defineNuxtModule, createResolver, addComponent } from '@nuxt/kit';
3
+ import { defineNuxtModule, createResolver, useLogger, addTemplate, findPath, installModule, addComponent } from '@nuxt/kit';
4
4
  import { parseSync } from '@oxc-parser/wasm';
5
5
 
6
+ const UTILS = `import { type ClassValue, clsx } from 'clsx'
7
+ import { twMerge } from 'tailwind-merge'
8
+
9
+ export function cn(...inputs: ClassValue[]) {
10
+ return twMerge(clsx(inputs))
11
+ }
12
+ `;
13
+
6
14
  const module = defineNuxtModule({
7
15
  meta: {
8
16
  name: "shadcn",
@@ -15,13 +23,27 @@ const module = defineNuxtModule({
15
23
  async setup({ prefix, componentDir }, nuxt) {
16
24
  const COMPONENT_DIR_PATH = componentDir;
17
25
  const ROOT_DIR_PATH = nuxt.options.rootDir;
26
+ const UTILS_ALIAS = "@/lib/utils";
18
27
  const { resolve, resolvePath } = createResolver(ROOT_DIR_PATH);
28
+ const logger = useLogger("shadcn-nuxt");
29
+ const utilsTemplate = addTemplate({
30
+ filename: "shadcn-nuxt/utils.ts",
31
+ getContents: () => UTILS,
32
+ write: true
33
+ });
34
+ nuxt.options.alias = { [UTILS_ALIAS]: utilsTemplate.dst, ...nuxt.options.alias };
35
+ const isRootUtilsExists = await findPath("./lib/utils.ts", { cwd: ROOT_DIR_PATH });
36
+ if (isRootUtilsExists)
37
+ logger.warn("[shadcn-nuxt] `lib/utils.ts` is auto generated by the module and can be safely removed.");
38
+ const componentsPath = resolve(COMPONENT_DIR_PATH);
19
39
  nuxt.hook("components:dirs", (dirs) => {
20
40
  dirs.unshift({
21
- path: resolve(COMPONENT_DIR_PATH),
41
+ path: componentsPath,
22
42
  extensions: []
23
43
  });
24
44
  });
45
+ await installModule("@nuxtjs/tailwindcss");
46
+ await installModule("@nuxtjs/color-mode");
25
47
  try {
26
48
  readdirSync(resolve(COMPONENT_DIR_PATH)).forEach(async (dir) => {
27
49
  try {
@@ -38,7 +60,8 @@ const module = defineNuxtModule({
38
60
  // name of the component to be used in vue templates
39
61
  export: key,
40
62
  // (optional) if the component is a named (rather than default) export
41
- filePath: resolve(filePath)
63
+ filePath: resolve(filePath),
64
+ priority: 1
42
65
  });
43
66
  });
44
67
  } catch (err) {
package/dist/types.d.mts CHANGED
@@ -1,16 +1 @@
1
-
2
- import type { ModuleOptions } from './module.js'
3
-
4
-
5
- declare module '@nuxt/schema' {
6
- interface NuxtConfig { ['shadcn']?: Partial<ModuleOptions> }
7
- interface NuxtOptions { ['shadcn']?: ModuleOptions }
8
- }
9
-
10
- declare module 'nuxt/schema' {
11
- interface NuxtConfig { ['shadcn']?: Partial<ModuleOptions> }
12
- interface NuxtOptions { ['shadcn']?: ModuleOptions }
13
- }
14
-
15
-
16
- export type { ModuleOptions, default } from './module.js'
1
+ export { type ModuleOptions, default } from './module.js'
package/dist/types.d.ts CHANGED
@@ -1,16 +1 @@
1
-
2
- import type { ModuleOptions } from './module'
3
-
4
-
5
- declare module '@nuxt/schema' {
6
- interface NuxtConfig { ['shadcn']?: Partial<ModuleOptions> }
7
- interface NuxtOptions { ['shadcn']?: ModuleOptions }
8
- }
9
-
10
- declare module 'nuxt/schema' {
11
- interface NuxtConfig { ['shadcn']?: Partial<ModuleOptions> }
12
- interface NuxtOptions { ['shadcn']?: ModuleOptions }
13
- }
14
-
15
-
16
- export type { ModuleOptions, default } from './module'
1
+ export { type ModuleOptions, default } from './module'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shadcn-nuxt",
3
3
  "type": "module",
4
- "version": "0.10.4",
4
+ "version": "0.11.2",
5
5
  "description": "Add shadcn-vue module to Nuxt",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -25,18 +25,19 @@
25
25
  "dist"
26
26
  ],
27
27
  "dependencies": {
28
- "@nuxt/kit": "^3.11.2",
29
- "@oxc-parser/wasm": "^0.1.0"
28
+ "@nuxt/kit": "^3.12.4",
29
+ "@oxc-parser/wasm": "^0.29.0",
30
+ "typescript": "^5.6.3"
30
31
  },
31
32
  "devDependencies": {
32
- "@nuxt/devtools": "latest",
33
- "@nuxt/eslint-config": "^0.3.6",
34
- "@nuxt/module-builder": "^0.5.5",
35
- "@nuxt/schema": "^3.11.2",
36
- "@nuxt/test-utils": "^3.12.0",
37
- "@types/node": "^20.12.7",
38
- "nuxt": "^3.11.2",
39
- "vitest": "^0.33.0"
33
+ "@nuxt/eslint-config": "^0.5.0",
34
+ "@nuxt/module-builder": "^0.8.2",
35
+ "@nuxt/schema": "^3.12.4",
36
+ "@nuxt/test-utils": "^3.14.0",
37
+ "@nuxtjs/color-mode": "^3.5.1",
38
+ "@nuxtjs/tailwindcss": "^6.12.2",
39
+ "@types/node": "^20.14.15",
40
+ "nuxt": "^3.12.4"
40
41
  },
41
42
  "scripts": {
42
43
  "dev": "nuxi dev playground",
@@ -45,6 +46,7 @@
45
46
  "lint": "eslint .",
46
47
  "test": "vitest run",
47
48
  "test:watch": "vitest watch",
48
- "release": "pnpm run prepack && pnpm publish && git push --follow-tags"
49
+ "release": "pnpm run prepack && pnpm publish && git push --follow-tags",
50
+ "pub:release": "pnpm prepack && pnpm publish --no-git-checks --access public"
49
51
  }
50
52
  }