nuxt-users 1.1.4 → 1.1.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 CHANGED
@@ -1,6 +1,30 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## v1.1.5
5
+
6
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.4...v1.1.5)
7
+
8
+ ### 🩹 Fixes
9
+
10
+ - **deps:** Exclude bcrypt from client-side bundle ([a678a96](https://github.com/rrd108/nuxt-users/commit/a678a96))
11
+
12
+ ### 💅 Refactors
13
+
14
+ - **cli:** Commands to load options ([403a281](https://github.com/rrd108/nuxt-users/commit/403a281))
15
+
16
+ ### 🏡 Chore
17
+
18
+ - **release:** V1.1.4 ([4980c98](https://github.com/rrd108/nuxt-users/commit/4980c98))
19
+
20
+ ### ✅ Tests
21
+
22
+ - Ensures database cleanup on test completion ([a1a528c](https://github.com/rrd108/nuxt-users/commit/a1a528c))
23
+
24
+ ### ❤️ Contributors
25
+
26
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
27
+
4
28
  ## v1.1.4
5
29
 
6
30
  [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.0...v1.1.4)
package/dist/cli.mjs CHANGED
@@ -70,6 +70,25 @@ const getOptionsFromEnv = () => {
70
70
  }
71
71
  };
72
72
  };
73
+ const loadOptions = async () => {
74
+ try {
75
+ console.log("[Nuxt Users] Loading Nuxt project...");
76
+ const nuxt = await loadNuxt({ cwd: process.cwd() });
77
+ const nuxtUsersConfig = nuxt.options.runtimeConfig?.nuxtUsers;
78
+ await nuxt.close();
79
+ if (nuxtUsersConfig) {
80
+ console.log("[Nuxt Users] Using configuration from Nuxt project");
81
+ return nuxtUsersConfig;
82
+ } else {
83
+ console.log("[Nuxt Users] No nuxt-users configuration found, using environment variables");
84
+ return getOptionsFromEnv();
85
+ }
86
+ } catch (error) {
87
+ console.log("[Nuxt Users] Could not load Nuxt project, using environment variables");
88
+ console.error(error);
89
+ return getOptionsFromEnv();
90
+ }
91
+ };
73
92
 
74
93
  const migrate = defineCommand({
75
94
  meta: {
@@ -78,24 +97,7 @@ const migrate = defineCommand({
78
97
  },
79
98
  async run() {
80
99
  console.log("[Nuxt Users] Starting migration system...");
81
- let options;
82
- try {
83
- console.log("[Nuxt Users] Loading Nuxt project...");
84
- const nuxt = await loadNuxt({ cwd: process.cwd() });
85
- const nuxtUsersConfig = nuxt.options.runtimeConfig?.nuxtUsers;
86
- await nuxt.close();
87
- if (nuxtUsersConfig) {
88
- console.log("[Nuxt Users] Using configuration from Nuxt project");
89
- options = nuxtUsersConfig;
90
- } else {
91
- console.log("[Nuxt Users] No nuxt-users configuration found, using environment variables");
92
- options = getOptionsFromEnv();
93
- }
94
- } catch (error) {
95
- console.log("[Nuxt Users] Could not load Nuxt project, using environment variables");
96
- console.error(error);
97
- options = getOptionsFromEnv();
98
- }
100
+ const options = await loadOptions();
99
101
  try {
100
102
  await runMigrations(options);
101
103
  console.log("[Nuxt Users] Migration completed successfully!");
@@ -114,16 +116,19 @@ const createUser = defineCommand({
114
116
  },
115
117
  args: {
116
118
  email: {
119
+ alias: "e",
117
120
  type: "string",
118
121
  description: "User email address",
119
122
  required: true
120
123
  },
121
124
  name: {
125
+ alias: "n",
122
126
  type: "string",
123
127
  description: "User full name",
124
128
  required: true
125
129
  },
126
130
  password: {
131
+ alias: "p",
127
132
  type: "string",
128
133
  description: "User password",
129
134
  required: true
@@ -131,7 +136,7 @@ const createUser = defineCommand({
131
136
  },
132
137
  async run({ args }) {
133
138
  const { email, name, password } = args;
134
- const options = getOptionsFromEnv();
139
+ const options = await loadOptions();
135
140
  try {
136
141
  const user = await createUser$1({ email, name, password }, options);
137
142
  console.log(`[DB:Create User] User created successfully: ${user.email}`);
@@ -149,7 +154,7 @@ const createUsersTable = defineCommand({
149
154
  },
150
155
  async run() {
151
156
  console.log("[Nuxt Users] Creating users table...");
152
- const options = getOptionsFromEnv();
157
+ const options = await loadOptions();
153
158
  try {
154
159
  await createUsersTable$1(options);
155
160
  console.log("[Nuxt Users] Users table created successfully!");
@@ -167,7 +172,7 @@ const createPersonalAccessTokensTable = defineCommand({
167
172
  },
168
173
  async run() {
169
174
  console.log("[Nuxt Users] Creating personal access tokens table...");
170
- const options = getOptionsFromEnv();
175
+ const options = await loadOptions();
171
176
  try {
172
177
  await createPersonalAccessTokensTable$1(options);
173
178
  console.log("[Nuxt Users] Personal access tokens table created successfully!");
@@ -185,7 +190,7 @@ const createPasswordResetTokensTable = defineCommand({
185
190
  },
186
191
  async run() {
187
192
  console.log("[Nuxt Users] Creating password reset tokens table...");
188
- const options = getOptionsFromEnv();
193
+ const options = await loadOptions();
189
194
  try {
190
195
  await createPasswordResetTokensTable$1(options);
191
196
  console.log("[Nuxt Users] Password reset tokens table created successfully!");
@@ -203,7 +208,7 @@ const createMigrationsTable = defineCommand({
203
208
  },
204
209
  async run() {
205
210
  console.log("[Nuxt Users] Creating migrations table...");
206
- const options = getOptionsFromEnv();
211
+ const options = await loadOptions();
207
212
  try {
208
213
  await createMigrationsTable$1(options);
209
214
  console.log("[Nuxt Users] Migrations table created successfully!");
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-users",
3
3
  "configKey": "nuxtUsers",
4
- "version": "1.1.4",
4
+ "version": "1.1.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.6.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-users",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "A comprehensive user management module for Nuxt 3 applications with authentication, database support, and CLI tools",
5
5
  "keywords": [
6
6
  "nuxt",