nuxt-users 1.1.2 → 1.1.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/.vscode/settings.json +18 -0
- package/CHANGELOG.md +174 -0
- package/README.md +12 -2
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +269 -0
- package/dist/module.d.mts +1 -51
- package/dist/module.d.ts +7 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +11 -81
- package/dist/runtime/assets/colors.css +1 -0
- package/dist/runtime/components/ForgotPasswordForm.vue +21 -23
- package/dist/runtime/components/LoginForm.vue +42 -30
- package/dist/runtime/components/LoginForm.vue.d.ts +8 -8
- package/dist/runtime/components/ResetPasswordForm.vue +40 -33
- package/dist/runtime/plugin.js +13 -3
- package/dist/runtime/server/api/login.post.js +1 -1
- package/dist/runtime/server/services/password.js +1 -2
- package/dist/shared/nuxt-users.Dtq4WcpY.d.mts +58 -0
- package/dist/shared/nuxt-users.Dtq4WcpY.d.ts +58 -0
- package/dist/shared/nuxt-users.eSQUrS6l.mjs +333 -0
- package/dist/utils.d.mts +37 -0
- package/dist/utils.d.ts +37 -0
- package/dist/utils.mjs +3 -0
- package/package.json +59 -27
- package/data/default.sqlite3 +0 -0
- package/dist/runtime/server/utils/create-migrations-table.d.ts +0 -2
- package/dist/runtime/server/utils/create-migrations-table.js +0 -35
- package/dist/runtime/server/utils/create-password-reset-tokens-table.d.ts +0 -2
- package/dist/runtime/server/utils/create-password-reset-tokens-table.js +0 -40
- package/dist/runtime/server/utils/create-personal-access-tokens-table.d.ts +0 -2
- package/dist/runtime/server/utils/create-personal-access-tokens-table.js +0 -56
- package/dist/runtime/server/utils/create-user.d.ts +0 -1
- package/dist/runtime/server/utils/create-user.js +0 -1
- package/dist/runtime/server/utils/create-users-table.d.ts +0 -2
- package/dist/runtime/server/utils/create-users-table.js +0 -44
- package/dist/runtime/server/utils/db.d.ts +0 -8
- package/dist/runtime/server/utils/db.js +0 -61
- package/dist/runtime/server/utils/migrate.d.ts +0 -4
- package/dist/runtime/server/utils/migrate.js +0 -63
- package/dist/runtime/server/utils/user.d.ts +0 -21
- package/dist/runtime/server/utils/user.js +0 -50
- package/src/cli/create-migrations-table.ts +0 -24
- package/src/cli/create-password-reset-tokens-table.ts +0 -24
- package/src/cli/create-personal-access-tokens-table.ts +0 -24
- package/src/cli/create-user.ts +0 -40
- package/src/cli/create-users-table.ts +0 -24
- package/src/cli/main.ts +0 -28
- package/src/cli/migrate.ts +0 -24
- package/src/cli/project-info.ts +0 -45
- package/src/cli/utils.ts +0 -70
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"eslint.experimental.useFlatConfig": true,
|
|
3
|
+
"editor.formatOnSave": true,
|
|
4
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
|
5
|
+
"editor.codeActionsOnSave": {
|
|
6
|
+
"source.fixAll.eslint": "explicit"
|
|
7
|
+
},
|
|
8
|
+
"[javascript]": {
|
|
9
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
10
|
+
},
|
|
11
|
+
"[typescript]": {
|
|
12
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
13
|
+
},
|
|
14
|
+
"[vue]": {
|
|
15
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
16
|
+
},
|
|
17
|
+
"eslint.validate": ["javascript", "typescript", "vue"]
|
|
18
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## v1.1.4
|
|
5
|
+
|
|
6
|
+
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.0...v1.1.4)
|
|
7
|
+
|
|
8
|
+
### 🩹 Fixes
|
|
9
|
+
|
|
10
|
+
- CLI tool for database management ([0a4793f](https://github.com/rrd108/nuxt-users/commit/0a4793f))
|
|
11
|
+
- Handling cli commands ([120c396](https://github.com/rrd108/nuxt-users/commit/120c396))
|
|
12
|
+
- Database handling and setup ([11ddc20](https://github.com/rrd108/nuxt-users/commit/11ddc20))
|
|
13
|
+
- Proper check for migrations table ([08701a1](https://github.com/rrd108/nuxt-users/commit/08701a1))
|
|
14
|
+
- Migration command in warning message ([1a62e50](https://github.com/rrd108/nuxt-users/commit/1a62e50))
|
|
15
|
+
- Improves database connector error handling ([db3b670](https://github.com/rrd108/nuxt-users/commit/db3b670))
|
|
16
|
+
- Use sql connector defined in nuxt.config ([b37900d](https://github.com/rrd108/nuxt-users/commit/b37900d))
|
|
17
|
+
- Module metadata and build process ([3da5410](https://github.com/rrd108/nuxt-users/commit/3da5410))
|
|
18
|
+
- **ci:** Install optional dependencies ([38d6ee8](https://github.com/rrd108/nuxt-users/commit/38d6ee8))
|
|
19
|
+
- Adds necessary database drivers for testing ([f1815f4](https://github.com/rrd108/nuxt-users/commit/f1815f4))
|
|
20
|
+
- **ci:** Installs peer dependencies in CI workflows ([423d4e9](https://github.com/rrd108/nuxt-users/commit/423d4e9))
|
|
21
|
+
- Test paths ([047f0e8](https://github.com/rrd108/nuxt-users/commit/047f0e8))
|
|
22
|
+
- Type errors ([3d5b35c](https://github.com/rrd108/nuxt-users/commit/3d5b35c))
|
|
23
|
+
- Consolidates build config and external deps ([48b4980](https://github.com/rrd108/nuxt-users/commit/48b4980))
|
|
24
|
+
- **ci:** Downgrade mariadb ([b1be244](https://github.com/rrd108/nuxt-users/commit/b1be244))
|
|
25
|
+
- Adds db0 to external dependencies ([b276c58](https://github.com/rrd108/nuxt-users/commit/b276c58))
|
|
26
|
+
|
|
27
|
+
### 💅 Refactors
|
|
28
|
+
|
|
29
|
+
- CLI commands to use environment variables ([3fc6c9f](https://github.com/rrd108/nuxt-users/commit/3fc6c9f))
|
|
30
|
+
- Remove unused types ([06b5e9f](https://github.com/rrd108/nuxt-users/commit/06b5e9f))
|
|
31
|
+
- Database connection logic ([f5baadf](https://github.com/rrd108/nuxt-users/commit/f5baadf))
|
|
32
|
+
- Moves user existence check to user utils ([62cc871](https://github.com/rrd108/nuxt-users/commit/62cc871))
|
|
33
|
+
- Remove unused options ([b391013](https://github.com/rrd108/nuxt-users/commit/b391013))
|
|
34
|
+
- Adds a color palette and styles login forms ([d3bffab](https://github.com/rrd108/nuxt-users/commit/d3bffab))
|
|
35
|
+
- Adds color palette and improves styling ([7cfab67](https://github.com/rrd108/nuxt-users/commit/7cfab67))
|
|
36
|
+
- Db check to plugin ([d466e2f](https://github.com/rrd108/nuxt-users/commit/d466e2f))
|
|
37
|
+
- Consolidates utils and CLI build ([21e9f3c](https://github.com/rrd108/nuxt-users/commit/21e9f3c))
|
|
38
|
+
- Remove unused option ([d9e3525](https://github.com/rrd108/nuxt-users/commit/d9e3525))
|
|
39
|
+
- Utils import paths ([e3b59c3](https://github.com/rrd108/nuxt-users/commit/e3b59c3))
|
|
40
|
+
- Module utils and improves CLI output ([e80b160](https://github.com/rrd108/nuxt-users/commit/e80b160))
|
|
41
|
+
|
|
42
|
+
### 🏡 Chore
|
|
43
|
+
|
|
44
|
+
- **release:** V1.1.0 ([bfc24f6](https://github.com/rrd108/nuxt-users/commit/bfc24f6))
|
|
45
|
+
- Adds script to deploy documentation to server ([81f7f74](https://github.com/rrd108/nuxt-users/commit/81f7f74))
|
|
46
|
+
- Adds script to deploy documentation ([7e2f642](https://github.com/rrd108/nuxt-users/commit/7e2f642))
|
|
47
|
+
- **release:** V1.1.1 ([e3bda8a](https://github.com/rrd108/nuxt-users/commit/e3bda8a))
|
|
48
|
+
- **release:** V1.1.2 ([3a2d2ae](https://github.com/rrd108/nuxt-users/commit/3a2d2ae))
|
|
49
|
+
- **release:** V1.1.3 ([b32a05f](https://github.com/rrd108/nuxt-users/commit/b32a05f))
|
|
50
|
+
- Updates dependencies in yarn.lock ([f29a369](https://github.com/rrd108/nuxt-users/commit/f29a369))
|
|
51
|
+
- Adds nodemailer to externals and dependencies ([b717d49](https://github.com/rrd108/nuxt-users/commit/b717d49))
|
|
52
|
+
- Removes stub build from dev prepare script ([dd96376](https://github.com/rrd108/nuxt-users/commit/dd96376))
|
|
53
|
+
- Remove examples ([d2f5c04](https://github.com/rrd108/nuxt-users/commit/d2f5c04))
|
|
54
|
+
- Remove comments ([6b45d71](https://github.com/rrd108/nuxt-users/commit/6b45d71))
|
|
55
|
+
- Renames unbuild config file ([bd7299f](https://github.com/rrd108/nuxt-users/commit/bd7299f))
|
|
56
|
+
|
|
57
|
+
### ✅ Tests
|
|
58
|
+
|
|
59
|
+
- Cleanup added ([50369a9](https://github.com/rrd108/nuxt-users/commit/50369a9))
|
|
60
|
+
- Ensures database cleanup on test completion ([a1a528c](https://github.com/rrd108/nuxt-users/commit/a1a528c))
|
|
61
|
+
|
|
62
|
+
### ❤️ Contributors
|
|
63
|
+
|
|
64
|
+
- Rrd108 ([@rrd108](https://github.com/rrd108))
|
|
65
|
+
|
|
66
|
+
## v1.1.3
|
|
67
|
+
|
|
68
|
+
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.0...v1.1.3)
|
|
69
|
+
|
|
70
|
+
### 🩹 Fixes
|
|
71
|
+
|
|
72
|
+
- CLI tool for database management ([0a4793f](https://github.com/rrd108/nuxt-users/commit/0a4793f))
|
|
73
|
+
- Handling cli commands ([120c396](https://github.com/rrd108/nuxt-users/commit/120c396))
|
|
74
|
+
- Database handling and setup ([11ddc20](https://github.com/rrd108/nuxt-users/commit/11ddc20))
|
|
75
|
+
- Proper check for migrations table ([08701a1](https://github.com/rrd108/nuxt-users/commit/08701a1))
|
|
76
|
+
- Migration command in warning message ([1a62e50](https://github.com/rrd108/nuxt-users/commit/1a62e50))
|
|
77
|
+
|
|
78
|
+
### 💅 Refactors
|
|
79
|
+
|
|
80
|
+
- CLI commands to use environment variables ([3fc6c9f](https://github.com/rrd108/nuxt-users/commit/3fc6c9f))
|
|
81
|
+
- Remove unused types ([06b5e9f](https://github.com/rrd108/nuxt-users/commit/06b5e9f))
|
|
82
|
+
- Database connection logic ([f5baadf](https://github.com/rrd108/nuxt-users/commit/f5baadf))
|
|
83
|
+
- Moves user existence check to user utils ([62cc871](https://github.com/rrd108/nuxt-users/commit/62cc871))
|
|
84
|
+
- Remove unused options ([b391013](https://github.com/rrd108/nuxt-users/commit/b391013))
|
|
85
|
+
- Adds a color palette and styles login forms ([d3bffab](https://github.com/rrd108/nuxt-users/commit/d3bffab))
|
|
86
|
+
- Adds color palette and improves styling ([7cfab67](https://github.com/rrd108/nuxt-users/commit/7cfab67))
|
|
87
|
+
- Db check to plugin ([d466e2f](https://github.com/rrd108/nuxt-users/commit/d466e2f))
|
|
88
|
+
- Consolidates utils and CLI build ([21e9f3c](https://github.com/rrd108/nuxt-users/commit/21e9f3c))
|
|
89
|
+
- Remove unused option ([d9e3525](https://github.com/rrd108/nuxt-users/commit/d9e3525))
|
|
90
|
+
|
|
91
|
+
### 🏡 Chore
|
|
92
|
+
|
|
93
|
+
- **release:** V1.1.0 ([bfc24f6](https://github.com/rrd108/nuxt-users/commit/bfc24f6))
|
|
94
|
+
- Adds script to deploy documentation to server ([81f7f74](https://github.com/rrd108/nuxt-users/commit/81f7f74))
|
|
95
|
+
- Adds script to deploy documentation ([7e2f642](https://github.com/rrd108/nuxt-users/commit/7e2f642))
|
|
96
|
+
- **release:** V1.1.1 ([e3bda8a](https://github.com/rrd108/nuxt-users/commit/e3bda8a))
|
|
97
|
+
- **release:** V1.1.2 ([3a2d2ae](https://github.com/rrd108/nuxt-users/commit/3a2d2ae))
|
|
98
|
+
|
|
99
|
+
### ❤️ Contributors
|
|
100
|
+
|
|
101
|
+
- Rrd108 ([@rrd108](https://github.com/rrd108))
|
|
102
|
+
|
|
103
|
+
## v1.1.2
|
|
104
|
+
|
|
105
|
+
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.0...v1.1.2)
|
|
106
|
+
|
|
107
|
+
### 🩹 Fixes
|
|
108
|
+
|
|
109
|
+
- CLI tool for database management ([0a4793f](https://github.com/rrd108/nuxt-users/commit/0a4793f))
|
|
110
|
+
- Handling cli commands ([120c396](https://github.com/rrd108/nuxt-users/commit/120c396))
|
|
111
|
+
- Database handling and setup ([11ddc20](https://github.com/rrd108/nuxt-users/commit/11ddc20))
|
|
112
|
+
|
|
113
|
+
### 💅 Refactors
|
|
114
|
+
|
|
115
|
+
- CLI commands to use environment variables ([3fc6c9f](https://github.com/rrd108/nuxt-users/commit/3fc6c9f))
|
|
116
|
+
- Remove unused types ([06b5e9f](https://github.com/rrd108/nuxt-users/commit/06b5e9f))
|
|
117
|
+
- Database connection logic ([f5baadf](https://github.com/rrd108/nuxt-users/commit/f5baadf))
|
|
118
|
+
|
|
119
|
+
### 🏡 Chore
|
|
120
|
+
|
|
121
|
+
- **release:** V1.1.0 ([bfc24f6](https://github.com/rrd108/nuxt-users/commit/bfc24f6))
|
|
122
|
+
- Adds script to deploy documentation to server ([81f7f74](https://github.com/rrd108/nuxt-users/commit/81f7f74))
|
|
123
|
+
- Adds script to deploy documentation ([7e2f642](https://github.com/rrd108/nuxt-users/commit/7e2f642))
|
|
124
|
+
- **release:** V1.1.1 ([e3bda8a](https://github.com/rrd108/nuxt-users/commit/e3bda8a))
|
|
125
|
+
|
|
126
|
+
### ❤️ Contributors
|
|
127
|
+
|
|
128
|
+
- Rrd108 ([@rrd108](https://github.com/rrd108))
|
|
129
|
+
|
|
130
|
+
## v1.1.1
|
|
131
|
+
|
|
132
|
+
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.0...v1.1.1)
|
|
133
|
+
|
|
134
|
+
### 🩹 Fixes
|
|
135
|
+
|
|
136
|
+
- CLI tool for database management ([0a4793f](https://github.com/rrd108/nuxt-users/commit/0a4793f))
|
|
137
|
+
- Handling cli commands ([120c396](https://github.com/rrd108/nuxt-users/commit/120c396))
|
|
138
|
+
|
|
139
|
+
### 💅 Refactors
|
|
140
|
+
|
|
141
|
+
- CLI commands to use environment variables ([3fc6c9f](https://github.com/rrd108/nuxt-users/commit/3fc6c9f))
|
|
142
|
+
- Remove unused types ([06b5e9f](https://github.com/rrd108/nuxt-users/commit/06b5e9f))
|
|
143
|
+
- Database connection logic ([f5baadf](https://github.com/rrd108/nuxt-users/commit/f5baadf))
|
|
144
|
+
|
|
145
|
+
### 🏡 Chore
|
|
146
|
+
|
|
147
|
+
- **release:** V1.1.0 ([bfc24f6](https://github.com/rrd108/nuxt-users/commit/bfc24f6))
|
|
148
|
+
- Adds script to deploy documentation to server ([81f7f74](https://github.com/rrd108/nuxt-users/commit/81f7f74))
|
|
149
|
+
- Adds script to deploy documentation ([7e2f642](https://github.com/rrd108/nuxt-users/commit/7e2f642))
|
|
150
|
+
|
|
151
|
+
### ❤️ Contributors
|
|
152
|
+
|
|
153
|
+
- Rrd108 ([@rrd108](https://github.com/rrd108))
|
|
154
|
+
|
|
155
|
+
## v1.1.0
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
### 🚀 Enhancements
|
|
159
|
+
|
|
160
|
+
- Implement Sanctum-style token authentication ([8b6d1d3](https://github.com/rrd108/nuxt-users/commit/8b6d1d3))
|
|
161
|
+
- Create and save token ([063cabf](https://github.com/rrd108/nuxt-users/commit/063cabf))
|
|
162
|
+
- Implement password reset functionality ([bf9d2bc](https://github.com/rrd108/nuxt-users/commit/bf9d2bc))
|
|
163
|
+
- Implement password reset functionality with FormKit forms ([c025be2](https://github.com/rrd108/nuxt-users/commit/c025be2))
|
|
164
|
+
- Make database table names customizable ([6db3c28](https://github.com/rrd108/nuxt-users/commit/6db3c28))
|
|
165
|
+
|
|
166
|
+
### 🩹 Fixes
|
|
167
|
+
|
|
168
|
+
- **ci:** Switch to mariadb for mysql tests ([8ddc60b](https://github.com/rrd108/nuxt-users/commit/8ddc60b))
|
|
169
|
+
- **deps:** Update nuxtjs monorepo to v3.17.7 ([89e3d3d](https://github.com/rrd108/nuxt-users/commit/89e3d3d))
|
|
170
|
+
|
|
171
|
+
### ❤️ Contributors
|
|
172
|
+
|
|
173
|
+
- Rrd108 ([@rrd108](https://github.com/rrd108))
|
|
174
|
+
|
package/README.md
CHANGED
|
@@ -37,8 +37,6 @@ npx nuxt-users migrate
|
|
|
37
37
|
npx nuxt-users create-user user@example.com "John Doe" password123
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
> **Note**: For SQLite (default), the module automatically creates the database file. If installation hangs with other databases, add `skipDatabaseChecks: true` to your configuration. See [Troubleshooting](/docs/troubleshooting/hanging-during-install) for more details.
|
|
41
|
-
|
|
42
40
|
## Documentation
|
|
43
41
|
|
|
44
42
|
📚 **Full documentation is available at: [docs/](/docs/)**
|
|
@@ -69,3 +67,15 @@ cd docs && yarn dev
|
|
|
69
67
|
## License
|
|
70
68
|
|
|
71
69
|
MIT
|
|
70
|
+
|
|
71
|
+
## Dev misc
|
|
72
|
+
|
|
73
|
+
### Using yalc
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Publish the module's new version
|
|
77
|
+
yalc publish
|
|
78
|
+
|
|
79
|
+
# Install the module in the consumer app
|
|
80
|
+
yalc add nuxt-users
|
|
81
|
+
```
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineCommand, runMain } from 'citty';
|
|
3
|
+
import 'db0';
|
|
4
|
+
import 'bcrypt';
|
|
5
|
+
import { r as runMigrations, a as createUser$1, d as createUsersTable$1, e as createPersonalAccessTokensTable$1, g as createPasswordResetTokensTable$1, h as createMigrationsTable$1 } from './shared/nuxt-users.eSQUrS6l.mjs';
|
|
6
|
+
import { loadNuxt } from '@nuxt/kit';
|
|
7
|
+
|
|
8
|
+
const defaultOptions = {
|
|
9
|
+
connector: {
|
|
10
|
+
name: "sqlite",
|
|
11
|
+
options: {
|
|
12
|
+
path: "./data/users.sqlite3"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
tables: {
|
|
16
|
+
migrations: "migrations",
|
|
17
|
+
users: "users",
|
|
18
|
+
personalAccessTokens: "personal_access_tokens",
|
|
19
|
+
passwordResetTokens: "password_reset_tokens"
|
|
20
|
+
},
|
|
21
|
+
mailer: {
|
|
22
|
+
host: "smtp.ethereal.email",
|
|
23
|
+
port: 587,
|
|
24
|
+
secure: false,
|
|
25
|
+
auth: {
|
|
26
|
+
user: "user@ethereal.email",
|
|
27
|
+
pass: "password"
|
|
28
|
+
},
|
|
29
|
+
defaults: {
|
|
30
|
+
from: '"Nuxt Users Module" <noreply@example.com>'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
passwordResetBaseUrl: "http://localhost:3000"
|
|
34
|
+
};
|
|
35
|
+
const getOptionsFromEnv = () => {
|
|
36
|
+
const connectorName = process.env.DB_CONNECTOR || "sqlite";
|
|
37
|
+
let connectorOptions;
|
|
38
|
+
switch (connectorName) {
|
|
39
|
+
case "sqlite":
|
|
40
|
+
connectorOptions = {
|
|
41
|
+
path: process.env.DB_PATH || "./data/default.sqlite3"
|
|
42
|
+
};
|
|
43
|
+
break;
|
|
44
|
+
case "mysql":
|
|
45
|
+
connectorOptions = {
|
|
46
|
+
host: process.env.DB_HOST || "localhost",
|
|
47
|
+
port: Number.parseInt(process.env.DB_PORT || "3306"),
|
|
48
|
+
user: process.env.DB_USER || "root",
|
|
49
|
+
password: process.env.DB_PASSWORD || "",
|
|
50
|
+
database: process.env.DB_NAME || "nuxt_users"
|
|
51
|
+
};
|
|
52
|
+
break;
|
|
53
|
+
case "postgresql":
|
|
54
|
+
connectorOptions = {
|
|
55
|
+
host: process.env.DB_HOST || "localhost",
|
|
56
|
+
port: Number.parseInt(process.env.DB_PORT || "5432"),
|
|
57
|
+
user: process.env.DB_USER || "postgres",
|
|
58
|
+
password: process.env.DB_PASSWORD || "",
|
|
59
|
+
database: process.env.DB_NAME || "nuxt_users"
|
|
60
|
+
};
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
throw new Error(`Unsupported database connector: ${connectorName}`);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
...defaultOptions,
|
|
67
|
+
connector: {
|
|
68
|
+
name: connectorName,
|
|
69
|
+
options: connectorOptions
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const migrate = defineCommand({
|
|
75
|
+
meta: {
|
|
76
|
+
name: "migrate",
|
|
77
|
+
description: "Run database migrations for the Nuxt Users module"
|
|
78
|
+
},
|
|
79
|
+
async run() {
|
|
80
|
+
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
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
await runMigrations(options);
|
|
101
|
+
console.log("[Nuxt Users] Migration completed successfully!");
|
|
102
|
+
process.exit(0);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error("[Nuxt Users] Migration failed:", error);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const createUser = defineCommand({
|
|
111
|
+
meta: {
|
|
112
|
+
name: "create-user",
|
|
113
|
+
description: "Create a new user in the database"
|
|
114
|
+
},
|
|
115
|
+
args: {
|
|
116
|
+
email: {
|
|
117
|
+
type: "string",
|
|
118
|
+
description: "User email address",
|
|
119
|
+
required: true
|
|
120
|
+
},
|
|
121
|
+
name: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "User full name",
|
|
124
|
+
required: true
|
|
125
|
+
},
|
|
126
|
+
password: {
|
|
127
|
+
type: "string",
|
|
128
|
+
description: "User password",
|
|
129
|
+
required: true
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
async run({ args }) {
|
|
133
|
+
const { email, name, password } = args;
|
|
134
|
+
const options = getOptionsFromEnv();
|
|
135
|
+
try {
|
|
136
|
+
const user = await createUser$1({ email, name, password }, options);
|
|
137
|
+
console.log(`[DB:Create User] User created successfully: ${user.email}`);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error("[DB:Create User] Error:", error);
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const createUsersTable = defineCommand({
|
|
146
|
+
meta: {
|
|
147
|
+
name: "create-users-table",
|
|
148
|
+
description: "Create the users table in the database"
|
|
149
|
+
},
|
|
150
|
+
async run() {
|
|
151
|
+
console.log("[Nuxt Users] Creating users table...");
|
|
152
|
+
const options = getOptionsFromEnv();
|
|
153
|
+
try {
|
|
154
|
+
await createUsersTable$1(options);
|
|
155
|
+
console.log("[Nuxt Users] Users table created successfully!");
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.error("[DB:Create Users Table] Error:", error);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const createPersonalAccessTokensTable = defineCommand({
|
|
164
|
+
meta: {
|
|
165
|
+
name: "create-personal-access-tokens-table",
|
|
166
|
+
description: "Create the personal access tokens table in the database"
|
|
167
|
+
},
|
|
168
|
+
async run() {
|
|
169
|
+
console.log("[Nuxt Users] Creating personal access tokens table...");
|
|
170
|
+
const options = getOptionsFromEnv();
|
|
171
|
+
try {
|
|
172
|
+
await createPersonalAccessTokensTable$1(options);
|
|
173
|
+
console.log("[Nuxt Users] Personal access tokens table created successfully!");
|
|
174
|
+
} catch (error) {
|
|
175
|
+
console.error("[DB:Create Personal Access Tokens Table] Error:", error);
|
|
176
|
+
process.exit(1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const createPasswordResetTokensTable = defineCommand({
|
|
182
|
+
meta: {
|
|
183
|
+
name: "create-password-reset-tokens-table",
|
|
184
|
+
description: "Create the password reset tokens table in the database"
|
|
185
|
+
},
|
|
186
|
+
async run() {
|
|
187
|
+
console.log("[Nuxt Users] Creating password reset tokens table...");
|
|
188
|
+
const options = getOptionsFromEnv();
|
|
189
|
+
try {
|
|
190
|
+
await createPasswordResetTokensTable$1(options);
|
|
191
|
+
console.log("[Nuxt Users] Password reset tokens table created successfully!");
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.error("[DB:Create Password Reset Tokens Table] Error:", error);
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const createMigrationsTable = defineCommand({
|
|
200
|
+
meta: {
|
|
201
|
+
name: "create-migrations-table",
|
|
202
|
+
description: "Create the migrations table in the database"
|
|
203
|
+
},
|
|
204
|
+
async run() {
|
|
205
|
+
console.log("[Nuxt Users] Creating migrations table...");
|
|
206
|
+
const options = getOptionsFromEnv();
|
|
207
|
+
try {
|
|
208
|
+
await createMigrationsTable$1(options);
|
|
209
|
+
console.log("[Nuxt Users] Migrations table created successfully!");
|
|
210
|
+
} catch (error) {
|
|
211
|
+
console.error("[DB:Create Migrations Table] Error:", error);
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const projectInfo = defineCommand({
|
|
218
|
+
meta: {
|
|
219
|
+
name: "project-info",
|
|
220
|
+
description: "Get information about the Nuxt project and module configuration"
|
|
221
|
+
},
|
|
222
|
+
async run() {
|
|
223
|
+
try {
|
|
224
|
+
console.log("[Nuxt Users] Loading Nuxt project...");
|
|
225
|
+
const nuxt = await loadNuxt({ cwd: process.cwd() });
|
|
226
|
+
console.log("\u2705 Nuxt project loaded successfully!");
|
|
227
|
+
console.log("\u{1F4C1} Source directory:", nuxt.options.srcDir);
|
|
228
|
+
console.log("\u{1F310} Base URL:", nuxt.options.app?.baseURL || "/");
|
|
229
|
+
const nuxtUsersConfig = nuxt.options.runtimeConfig?.nuxtUsers;
|
|
230
|
+
if (nuxtUsersConfig) {
|
|
231
|
+
console.log("\u{1F527} Nuxt Users module configuration:");
|
|
232
|
+
console.log(" Database connector:", nuxtUsersConfig.connector?.name);
|
|
233
|
+
console.log(" Users table:", nuxtUsersConfig.tables?.users);
|
|
234
|
+
console.log(" Personal access tokens table:", nuxtUsersConfig.tables?.personalAccessTokens);
|
|
235
|
+
console.log(" Password reset tokens table:", nuxtUsersConfig.tables?.passwordResetTokens);
|
|
236
|
+
} else {
|
|
237
|
+
console.log("\u26A0\uFE0F Nuxt Users module not configured in runtime config");
|
|
238
|
+
}
|
|
239
|
+
const publicConfig = nuxt.options.runtimeConfig?.public?.nuxtUsers;
|
|
240
|
+
if (publicConfig) {
|
|
241
|
+
console.log("\u{1F30D} Public runtime config:");
|
|
242
|
+
console.log(" Users table exists:", publicConfig.tables?.users);
|
|
243
|
+
console.log(" Personal access tokens table exists:", publicConfig.tables?.personalAccessTokens);
|
|
244
|
+
console.log(" Password reset tokens table exists:", publicConfig.tables?.passwordResetTokens);
|
|
245
|
+
}
|
|
246
|
+
} catch (error) {
|
|
247
|
+
console.error("\u274C Could not load Nuxt project:", error);
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
const main = defineCommand({
|
|
254
|
+
meta: {
|
|
255
|
+
name: "nuxt-users",
|
|
256
|
+
description: "CLI for Nuxt Users Module - Manage users, migrations, and database operations",
|
|
257
|
+
version: "1.1.3"
|
|
258
|
+
},
|
|
259
|
+
subCommands: {
|
|
260
|
+
migrate,
|
|
261
|
+
"create-user": createUser,
|
|
262
|
+
"create-users-table": createUsersTable,
|
|
263
|
+
"create-personal-access-tokens-table": createPersonalAccessTokensTable,
|
|
264
|
+
"create-password-reset-tokens-table": createPasswordResetTokensTable,
|
|
265
|
+
"create-migrations-table": createMigrationsTable,
|
|
266
|
+
"project-info": projectInfo
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
runMain(main);
|
package/dist/module.d.mts
CHANGED
|
@@ -1,55 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
|
|
3
|
-
type DatabaseType = 'sqlite' | 'mysql' | 'postgresql';
|
|
4
|
-
type DatabaseConfig = {
|
|
5
|
-
path?: string;
|
|
6
|
-
host?: string;
|
|
7
|
-
port?: number;
|
|
8
|
-
user?: string;
|
|
9
|
-
password?: string;
|
|
10
|
-
database?: string;
|
|
11
|
-
connectTimeout?: number;
|
|
12
|
-
acquireTimeout?: number;
|
|
13
|
-
connectionTimeoutMillis?: number;
|
|
14
|
-
};
|
|
15
|
-
interface ModuleOptions {
|
|
16
|
-
connector?: {
|
|
17
|
-
name: DatabaseType;
|
|
18
|
-
options: DatabaseConfig;
|
|
19
|
-
};
|
|
20
|
-
tables: {
|
|
21
|
-
users: string;
|
|
22
|
-
personalAccessTokens: string;
|
|
23
|
-
passwordResetTokens: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Mailer configuration options for sending emails (e.g., password resets)
|
|
27
|
-
* Uses nodemailer
|
|
28
|
-
*/
|
|
29
|
-
mailer?: MailerOptions;
|
|
30
|
-
/**
|
|
31
|
-
* Base URL for password reset links
|
|
32
|
-
* @default 'http://localhost:3000' // Example, will be set in module defaults
|
|
33
|
-
*/
|
|
34
|
-
passwordResetBaseUrl?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Skip database checks during module setup to prevent hanging
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
skipDatabaseChecks?: boolean;
|
|
40
|
-
}
|
|
41
|
-
interface MailerOptions {
|
|
42
|
-
host: string;
|
|
43
|
-
port: number;
|
|
44
|
-
secure?: boolean;
|
|
45
|
-
auth: {
|
|
46
|
-
user: string;
|
|
47
|
-
pass: string;
|
|
48
|
-
};
|
|
49
|
-
defaults?: {
|
|
50
|
-
from: string;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
2
|
+
import { M as ModuleOptions } from './shared/nuxt-users.Dtq4WcpY.mjs';
|
|
53
3
|
|
|
54
4
|
declare const defaultOptions: ModuleOptions;
|
|
55
5
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { M as ModuleOptions } from './shared/nuxt-users.Dtq4WcpY.js';
|
|
3
|
+
|
|
4
|
+
declare const defaultOptions: ModuleOptions;
|
|
5
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
6
|
+
|
|
7
|
+
export { _default as default, defaultOptions };
|