nuxt-users 1.34.2 → 1.34.4

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/CHANGELOG.md CHANGED
@@ -1,6 +1,53 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## v1.34.4
5
+
6
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.34.3...v1.34.4)
7
+
8
+ ### 🩹 Fixes
9
+
10
+ - Conflicting runtimeconfig ([563dcca](https://github.com/rrd108/nuxt-users/commit/563dcca))
11
+ - Lint errors ([b590e6d](https://github.com/rrd108/nuxt-users/commit/b590e6d))
12
+ - **deps:** Update nuxtjs monorepo to v3.19.2 ([9963034](https://github.com/rrd108/nuxt-users/commit/9963034))
13
+ - Use runtimeconfig for nitro ([346ad0d](https://github.com/rrd108/nuxt-users/commit/346ad0d))
14
+
15
+ ### 🏡 Chore
16
+
17
+ - **release:** V1.34.3 ([23b3a30](https://github.com/rrd108/nuxt-users/commit/23b3a30))
18
+ - Fix whitespace ([2e24416](https://github.com/rrd108/nuxt-users/commit/2e24416))
19
+
20
+ ### ✅ Tests
21
+
22
+ - Add for config conflict ([59271e3](https://github.com/rrd108/nuxt-users/commit/59271e3))
23
+
24
+ ### ❤️ Contributors
25
+
26
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
27
+
28
+ ## v1.34.3
29
+
30
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.34.2...v1.34.3)
31
+
32
+ ### 🩹 Fixes
33
+
34
+ - Remember me closes #3 ([#3](https://github.com/rrd108/nuxt-users/issues/3))
35
+ - Hard reload ([187c828](https://github.com/rrd108/nuxt-users/commit/187c828))
36
+ - Conflicting runtimeconfig ([563dcca](https://github.com/rrd108/nuxt-users/commit/563dcca))
37
+ - Lint errors ([b590e6d](https://github.com/rrd108/nuxt-users/commit/b590e6d))
38
+
39
+ ### 🏡 Chore
40
+
41
+ - **release:** V1.34.2 ([60d87dc](https://github.com/rrd108/nuxt-users/commit/60d87dc))
42
+
43
+ ### ✅ Tests
44
+
45
+ - Add for config conflict ([59271e3](https://github.com/rrd108/nuxt-users/commit/59271e3))
46
+
47
+ ### ❤️ Contributors
48
+
49
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
50
+
4
51
  ## v1.34.2
5
52
 
6
53
  [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.34.1...v1.34.2)
package/dist/cli.mjs CHANGED
@@ -50,12 +50,29 @@ const getOptionsFromEnv = () => {
50
50
  const loadOptions = async () => {
51
51
  try {
52
52
  console.log("[Nuxt Users] Loading Nuxt project...");
53
- const nuxt = await loadNuxt({ cwd: process.cwd() });
54
- const nuxtUsersConfig = nuxt.options.nuxtUsers;
53
+ const nuxt = await loadNuxt({ cwd: process.cwd(), ready: false });
54
+ const topLevelConfig = nuxt.options.nuxtUsers;
55
+ const originalRuntimeConfig = await (async () => {
56
+ try {
57
+ const configPath = await import('node:path').then((p) => p.resolve(process.cwd(), "nuxt.config.ts"));
58
+ const config = await import(configPath).then((m) => m.default);
59
+ return config?.runtimeConfig?.nuxtUsers;
60
+ } catch {
61
+ return nuxt.options.runtimeConfig?.nuxtUsers;
62
+ }
63
+ })();
55
64
  await nuxt.close();
56
- if (nuxtUsersConfig) {
57
- console.log("[Nuxt Users] Using configuration from Nuxt project");
58
- return defu(nuxtUsersConfig, defaultOptions);
65
+ if (topLevelConfig || originalRuntimeConfig) {
66
+ console.log("[Nuxt Users] Using configuration from nuxt.config");
67
+ let mergedConfig = defu(topLevelConfig, originalRuntimeConfig, defaultOptions);
68
+ const configuredConnector = topLevelConfig?.connector || originalRuntimeConfig?.connector;
69
+ if (configuredConnector) {
70
+ mergedConfig = {
71
+ ...mergedConfig,
72
+ connector: configuredConnector
73
+ };
74
+ }
75
+ return mergedConfig;
59
76
  } else {
60
77
  console.log("[Nuxt Users] No nuxt-users configuration found, using environment variables");
61
78
  return getOptionsFromEnv();
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-users",
3
3
  "configKey": "nuxtUsers",
4
- "version": "1.34.2",
4
+ "version": "1.34.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.0"
package/dist/module.mjs CHANGED
@@ -205,29 +205,6 @@ const module = defineNuxtModule({
205
205
  nuxt.hook("nitro:config", async (nitroConfig) => {
206
206
  nitroConfig.experimental = nitroConfig.experimental || {};
207
207
  nitroConfig.experimental.database = true;
208
- nitroConfig.database = nitroConfig.database || {};
209
- if (!nitroConfig.database.default) {
210
- const finalConnectorConfig = nuxt.options.runtimeConfig.nuxtUsers;
211
- const connectorOptions = { ...finalConnectorConfig.connector.options };
212
- let nitroConnector;
213
- switch (finalConnectorConfig.connector.name) {
214
- case "sqlite":
215
- nitroConnector = "better-sqlite3";
216
- break;
217
- case "mysql":
218
- nitroConnector = "mysql2";
219
- break;
220
- case "postgresql":
221
- nitroConnector = "postgresql";
222
- break;
223
- default:
224
- nitroConnector = "better-sqlite3";
225
- }
226
- nitroConfig.database.default = {
227
- connector: nitroConnector,
228
- options: connectorOptions
229
- };
230
- }
231
208
  nitroConfig.experimental.tasks = true;
232
209
  nitroConfig.scanDirs = nitroConfig.scanDirs || [];
233
210
  nitroConfig.scanDirs.push(resolver.resolve("./runtime/server/tasks"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-users",
3
- "version": "1.34.2",
3
+ "version": "1.34.4",
4
4
  "description": "A comprehensive user management module for Nuxt 3 and Nuxt 4 applications with authentication, authorization, database support, and CLI tools",
5
5
  "keywords": [
6
6
  "nuxt",