nuxt-users 1.8.3 → 1.8.5
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 +41 -0
- package/dist/cli.mjs +3 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +23 -0
- package/dist/runtime/composables/useNuxtUsersDatabase.d.ts +15 -0
- package/dist/runtime/composables/useNuxtUsersDatabase.js +14 -0
- package/dist/runtime/server/utils/index.d.ts +1 -0
- package/dist/runtime/server/utils/index.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## v1.8.5
|
|
5
|
+
|
|
6
|
+
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.8.4...v1.8.5)
|
|
7
|
+
|
|
8
|
+
### 🩹 Fixes
|
|
9
|
+
|
|
10
|
+
- Database sharing feature ([3a2e12f](https://github.com/rrd108/nuxt-users/commit/3a2e12f))
|
|
11
|
+
|
|
12
|
+
### 🏡 Chore
|
|
13
|
+
|
|
14
|
+
- **release:** V1.8.4 ([ab7fa92](https://github.com/rrd108/nuxt-users/commit/ab7fa92))
|
|
15
|
+
- Fix lint ([beb3e43](https://github.com/rrd108/nuxt-users/commit/beb3e43))
|
|
16
|
+
|
|
17
|
+
### ✅ Tests
|
|
18
|
+
|
|
19
|
+
- Add to check cli error ([fd338ca](https://github.com/rrd108/nuxt-users/commit/fd338ca))
|
|
20
|
+
|
|
21
|
+
### ❤️ Contributors
|
|
22
|
+
|
|
23
|
+
- Rrd108 ([@rrd108](https://github.com/rrd108))
|
|
24
|
+
|
|
25
|
+
## v1.8.4
|
|
26
|
+
|
|
27
|
+
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.8.3...v1.8.4)
|
|
28
|
+
|
|
29
|
+
### 🩹 Fixes
|
|
30
|
+
|
|
31
|
+
- Adds post-build script execution ([73a4c76](https://github.com/rrd108/nuxt-users/commit/73a4c76))
|
|
32
|
+
|
|
33
|
+
### 🏡 Chore
|
|
34
|
+
|
|
35
|
+
- **release:** V1.8.3 ([fd3b973](https://github.com/rrd108/nuxt-users/commit/fd3b973))
|
|
36
|
+
|
|
37
|
+
### ✅ Tests
|
|
38
|
+
|
|
39
|
+
- Add to check cli error ([fd338ca](https://github.com/rrd108/nuxt-users/commit/fd338ca))
|
|
40
|
+
|
|
41
|
+
### ❤️ Contributors
|
|
42
|
+
|
|
43
|
+
- Rrd108 ([@rrd108](https://github.com/rrd108))
|
|
44
|
+
|
|
4
45
|
## v1.8.3
|
|
5
46
|
|
|
6
47
|
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.8.2...v1.8.3)
|
package/dist/cli.mjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { defineCommand, runMain } from 'citty';
|
|
3
3
|
import { defaultOptions } from './module.mjs';
|
|
4
4
|
import { loadNuxt } from '@nuxt/kit';
|
|
5
|
+
import { defu } from 'defu';
|
|
5
6
|
import { runMigrations, createUser as createUser$1, createUsersTable as createUsersTable$1, createPersonalAccessTokensTable as createPersonalAccessTokensTable$1, createPasswordResetTokensTable as createPasswordResetTokensTable$1, createMigrationsTable as createMigrationsTable$1 } from '../dist/runtime/server/utils/index.js';
|
|
6
7
|
import { getPasswordValidationOptions, validatePassword } from './utils.mjs';
|
|
7
|
-
import 'defu';
|
|
8
8
|
|
|
9
9
|
const getOptionsFromEnv = () => {
|
|
10
10
|
const connectorName = process.env.DB_CONNECTOR || "sqlite";
|
|
@@ -52,7 +52,7 @@ const loadOptions = async () => {
|
|
|
52
52
|
await nuxt.close();
|
|
53
53
|
if (nuxtUsersConfig) {
|
|
54
54
|
console.log("[Nuxt Users] Using configuration from Nuxt project");
|
|
55
|
-
return nuxtUsersConfig;
|
|
55
|
+
return defu(nuxtUsersConfig, defaultOptions);
|
|
56
56
|
} else {
|
|
57
57
|
console.log("[Nuxt Users] No nuxt-users configuration found, using environment variables");
|
|
58
58
|
return getOptionsFromEnv();
|
|
@@ -247,7 +247,7 @@ const main = defineCommand({
|
|
|
247
247
|
meta: {
|
|
248
248
|
name: "nuxt-users",
|
|
249
249
|
description: "CLI for Nuxt Users Module - Manage users, migrations, and database operations",
|
|
250
|
-
version: "1.8.
|
|
250
|
+
version: "1.8.4"
|
|
251
251
|
},
|
|
252
252
|
subCommands: {
|
|
253
253
|
migrate,
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -128,6 +128,29 @@ const module = defineNuxtModule({
|
|
|
128
128
|
});
|
|
129
129
|
nuxt.hook("nitro:config", async (nitroConfig) => {
|
|
130
130
|
nitroConfig.experimental = nitroConfig.experimental || {};
|
|
131
|
+
nitroConfig.experimental.database = true;
|
|
132
|
+
nitroConfig.database = nitroConfig.database || {};
|
|
133
|
+
if (!nitroConfig.database.default) {
|
|
134
|
+
const connectorOptions = { ...runtimeConfigOptions.connector.options };
|
|
135
|
+
let nitroConnector;
|
|
136
|
+
switch (runtimeConfigOptions.connector.name) {
|
|
137
|
+
case "sqlite":
|
|
138
|
+
nitroConnector = "better-sqlite3";
|
|
139
|
+
break;
|
|
140
|
+
case "mysql":
|
|
141
|
+
nitroConnector = "mysql2";
|
|
142
|
+
break;
|
|
143
|
+
case "postgresql":
|
|
144
|
+
nitroConnector = "postgresql";
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
nitroConnector = "better-sqlite3";
|
|
148
|
+
}
|
|
149
|
+
nitroConfig.database.default = {
|
|
150
|
+
connector: nitroConnector,
|
|
151
|
+
options: connectorOptions
|
|
152
|
+
};
|
|
153
|
+
}
|
|
131
154
|
nitroConfig.experimental.tasks = true;
|
|
132
155
|
nitroConfig.scanDirs = nitroConfig.scanDirs || [];
|
|
133
156
|
nitroConfig.scanDirs.push(resolver.resolve("./runtime/server/tasks"));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const useNuxtUsersDatabase: () => Promise<{
|
|
2
|
+
database: import("db0").Database<import("db0").Connector<Database.Database>>;
|
|
3
|
+
options: {
|
|
4
|
+
tables: {
|
|
5
|
+
migrations: string;
|
|
6
|
+
users: string;
|
|
7
|
+
personalAccessTokens: string;
|
|
8
|
+
passwordResetTokens: string;
|
|
9
|
+
};
|
|
10
|
+
connector: {
|
|
11
|
+
name: import("../../types.js").DatabaseType;
|
|
12
|
+
options: import("../../types.js").DatabaseConfig;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const useNuxtUsersDatabase = async () => {
|
|
2
|
+
const { useRuntimeConfig } = await import("#imports");
|
|
3
|
+
const { useDb } = await import("../server/utils/db.js");
|
|
4
|
+
const { nuxtUsers } = useRuntimeConfig();
|
|
5
|
+
const options = nuxtUsers;
|
|
6
|
+
const database = await useDb(options);
|
|
7
|
+
return {
|
|
8
|
+
database,
|
|
9
|
+
options: {
|
|
10
|
+
tables: options.tables,
|
|
11
|
+
connector: options.connector
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -5,3 +5,4 @@ export { createPersonalAccessTokensTable } from './create-personal-access-tokens
|
|
|
5
5
|
export { createPasswordResetTokensTable } from './create-password-reset-tokens-table.js';
|
|
6
6
|
export { createMigrationsTable } from './create-migrations-table.js';
|
|
7
7
|
export { runMigrations } from './migrate.js';
|
|
8
|
+
export { useNuxtUsersDatabase } from '../../composables/useNuxtUsersDatabase.js';
|
|
@@ -5,3 +5,4 @@ export { createPersonalAccessTokensTable } from "./create-personal-access-tokens
|
|
|
5
5
|
export { createPasswordResetTokensTable } from "./create-password-reset-tokens-table.js";
|
|
6
6
|
export { createMigrationsTable } from "./create-migrations-table.js";
|
|
7
7
|
export { runMigrations } from "./migrate.js";
|
|
8
|
+
export { useNuxtUsersDatabase } from "../../composables/useNuxtUsersDatabase.js";
|
package/package.json
CHANGED