sveltekit-auth-example 2.0.1 → 2.0.3

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.
Files changed (43) hide show
  1. package/.eslintignore +1 -0
  2. package/.vscode/settings.json +7 -0
  3. package/.yarn/install-state.gz +0 -0
  4. package/CHANGELOG.md +167 -100
  5. package/README.md +6 -1
  6. package/eslint.config.js +31 -0
  7. package/package.json +67 -67
  8. package/prettier.config.mjs +9 -6
  9. package/src/app.d.ts +31 -29
  10. package/src/app.html +8 -3
  11. package/src/hooks.server.ts +15 -15
  12. package/src/lib/focus.ts +6 -6
  13. package/src/lib/google.ts +48 -49
  14. package/src/lib/server/db.ts +7 -6
  15. package/src/lib/server/sendgrid.ts +11 -11
  16. package/src/routes/+error.svelte +1 -1
  17. package/src/routes/+layout.server.ts +5 -5
  18. package/src/routes/+layout.svelte +133 -100
  19. package/src/routes/admin/+page.server.ts +1 -1
  20. package/src/routes/admin/+page.svelte +2 -2
  21. package/src/routes/api/v1/user/+server.ts +12 -13
  22. package/src/routes/auth/[slug]/+server.ts +12 -7
  23. package/src/routes/auth/forgot/+server.ts +22 -22
  24. package/src/routes/auth/google/+server.ts +43 -44
  25. package/src/routes/auth/reset/+server.ts +2 -2
  26. package/src/routes/auth/reset/[token]/+page.svelte +117 -95
  27. package/src/routes/auth/reset/[token]/+page.ts +3 -3
  28. package/src/routes/forgot/+page.svelte +74 -63
  29. package/src/routes/info/+page.svelte +1 -1
  30. package/src/routes/login/+page.svelte +140 -120
  31. package/src/routes/profile/+page.server.ts +9 -9
  32. package/src/routes/profile/+page.svelte +142 -88
  33. package/src/routes/register/+page.server.ts +3 -2
  34. package/src/routes/register/+page.svelte +159 -104
  35. package/src/routes/teachers/+page.server.ts +5 -5
  36. package/src/routes/teachers/+page.svelte +2 -2
  37. package/src/service-worker.ts +3 -3
  38. package/src/stores.ts +1 -1
  39. package/svelte.config.js +1 -1
  40. package/vite.config.ts +11 -0
  41. package/.eslintrc.cjs +0 -20
  42. package/.prettierignore +0 -13
  43. package/vite.config.js +0 -16
package/.eslintignore CHANGED
@@ -1,5 +1,6 @@
1
1
  .DS_Store
2
2
  node_modules
3
+ .yarn
3
4
  /build
4
5
  /.svelte-kit
5
6
  /package
@@ -0,0 +1,7 @@
1
+ {
2
+ "prettier.configPath": "prettier.config.mjs",
3
+ "prettier.ignorePath": ".eslintignore",
4
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
5
+ "eslint.debug": false,
6
+ "eslint.experimental.useFlatConfig": true
7
+ }
Binary file
package/CHANGELOG.md CHANGED
@@ -1,219 +1,286 @@
1
1
  # Backlog
2
- * Add password complexity checking on /register and /profile pages (only checks for length currently despite what the pages say)
3
- * fix prettier
2
+
3
+ - Add password complexity checking on /register and /profile pages (only checks for length currently despite what the pages say)
4
+
5
+ # 2.0.3
6
+ - Move to eslint's new eslint.config.js
7
+ - Convert vite.config to TypeScript
8
+
9
+ # 2.0.2
10
+
11
+ - Fix prettier
4
12
 
5
13
  # 2.0.1
6
- * Bump @sveltejs/adapter-node, @sveltejs/kit, @sveltejs/vite-plugin-svelte, svelte, svelte-check, vite, google-auth-library, @types/pg, @typescript-eslint/*, prettier, sass, vitest
14
+
15
+ - Bump @sveltejs/adapter-node, @sveltejs/kit, @sveltejs/vite-plugin-svelte, svelte, svelte-check, vite, google-auth-library, @types/pg, @typescript-eslint/\*, prettier, sass, vitest
7
16
 
8
17
  # 2.0.0 Upgrade for SvelteKit to 2.0
9
- * Migrated to SvelteKit way of managing cookies (vs. setting headers). The latter no longer works.
10
- * Corrected AuthenticationResult.statusCode type
11
- * Removed throw from SvelteKit functions redirect and error
12
- * Bump @sendgrid/mail, node, yarn, svelte, @sveltejs/kit, @sveltejs/vite-plugin-svelte, svelte-check, google-auth-library, vite, typescript, eslint, eslint-config-prettier, prettier-plugin-svelte, vitest, @types*, @typescript-eslint*, prettier
18
+
19
+ - Migrated to SvelteKit way of managing cookies (vs. setting headers). The latter no longer works.
20
+ - Corrected AuthenticationResult.statusCode type
21
+ - Removed throw from SvelteKit functions redirect and error
22
+ - Bump @sendgrid/mail, node, yarn, svelte, @sveltejs/kit, @sveltejs/vite-plugin-svelte, svelte-check, google-auth-library, vite, typescript, eslint, eslint-config-prettier, prettier-plugin-svelte, vitest, @types*, @typescript-eslint*, prettier
13
23
 
14
24
  # 1.0.59
15
- * Bump pg, sveltekit, @types*, bootstrap, eslint, google-auth-library, sass, svelte, svelte-check, tslib, typescript, vite, vitest
25
+
26
+ - Bump pg, sveltekit, @types\*, bootstrap, eslint, google-auth-library, sass, svelte, svelte-check, tslib, typescript, vite, vitest
16
27
 
17
28
  # 1.0.58
18
- * Bump pg, sveltekit, adapter-node, bootstrap, svelte, sass, jsonwebtoken, google-auth-library, vite, vitest
29
+
30
+ - Bump pg, sveltekit, adapter-node, bootstrap, svelte, sass, jsonwebtoken, google-auth-library, vite, vitest
19
31
 
20
32
  # 1.0.57
21
- * Minor bumps for pg, tslib, typescript
33
+
34
+ - Minor bumps for pg, tslib, typescript
22
35
 
23
36
  # 1.0.56
24
- * Svelte 4, minor updates for other dependencies
37
+
38
+ - Svelte 4, minor updates for other dependencies
25
39
 
26
40
  # 1.0.55
27
- * Add comment to indicate property that should be removed if ssl is turned off on the PostgreSQL server (thanks Brazos)
28
- * Update public.reset_password stored procedure to plpgsql (thanks Brazos)
41
+
42
+ - Add comment to indicate property that should be removed if ssl is turned off on the PostgreSQL server (thanks Brazos)
43
+ - Update public.reset_password stored procedure to plpgsql (thanks Brazos)
29
44
 
30
45
  # 1.0.54
31
- * Bump sveltekit, @types/pg, @typescript*, boostrap, eslint, prettier-plugin-svelte, sass, tslib, typescript, vitest
46
+
47
+ - Bump sveltekit, @types/pg, @typescript\*, boostrap, eslint, prettier-plugin-svelte, sass, tslib, typescript, vitest
32
48
 
33
49
  # 1.0.53
34
- * Fix service-worker.ts typing
35
- * Bump pg, sveltekit, svelte, vite, tslib and other devDependencies
50
+
51
+ - Fix service-worker.ts typing
52
+ - Bump pg, sveltekit, svelte, vite, tslib and other devDependencies
36
53
 
37
54
  # 1.0.52
38
- * Bump @sveltejs/kit, svelte, vite, vitest, pg, adapter-node, google-auth-library, eslint, sass, @typescript*, typescript, prettier, eslint-config-prettier, prettier-plugin-svelte, svelte-check
55
+
56
+ - Bump @sveltejs/kit, svelte, vite, vitest, pg, adapter-node, google-auth-library, eslint, sass, @typescript\*, typescript, prettier, eslint-config-prettier, prettier-plugin-svelte, svelte-check
39
57
 
40
58
  # 1.0.50
41
- * Bump @sveltejs/kit, vite, @typescript*
59
+
60
+ - Bump @sveltejs/kit, vite, @typescript\*
42
61
 
43
62
  # 1.0.50
44
- * Bump @sveltejs/kit, sass, vite
63
+
64
+ - Bump @sveltejs/kit, sass, vite
45
65
 
46
66
  # 1.0.49
47
- * Bump @sveltejs/kit, adapter-node, @typescript*, sass, vitest
67
+
68
+ - Bump @sveltejs/kit, adapter-node, @typescript\*, sass, vitest
48
69
 
49
70
  # 1.0.48
50
- * Bump node, npm, @sveltejs/kit, adapter-node, eslint, prettier
71
+
72
+ - Bump node, npm, @sveltejs/kit, adapter-node, eslint, prettier
51
73
 
52
74
  # 1.0.47
53
- * Bump @sveltejs/kit, adapter-node, @types/google.accounts, @typescript*, eslint, sass, typescript, vite, vitest
75
+
76
+ - Bump @sveltejs/kit, adapter-node, @types/google.accounts, @typescript\*, eslint, sass, typescript, vite, vitest
54
77
 
55
78
  # 1.0.46
56
- * Bump @sveltejs/kit, pg, tslib, vitest
79
+
80
+ - Bump @sveltejs/kit, pg, tslib, vitest
57
81
 
58
82
  # 1.0.45
59
- * Bump @sveltejs/kit, adapter-node, svelte-check, @typescript*, eslint, prettier, vitest, @types/jsonwebtoken
83
+
84
+ - Bump @sveltejs/kit, adapter-node, svelte-check, @typescript\*, eslint, prettier, vitest, @types/jsonwebtoken
60
85
 
61
86
  # 1.0.44
62
- * Bump @sveltejs/kit, svelte
87
+
88
+ - Bump @sveltejs/kit, svelte
63
89
 
64
90
  # 1.0.43
65
- * Bump @sveltejs/kit, svelte-check, vitest, @typescript*, prettier
91
+
92
+ - Bump @sveltejs/kit, svelte-check, vitest, @typescript\*, prettier
66
93
 
67
94
  # 1.0.42
68
- * Bump @sveltejs/kit, vite, @typescript*, eslint-config-prettier, @types/google.accounts
95
+
96
+ - Bump @sveltejs/kit, vite, @typescript\*, eslint-config-prettier, @types/google.accounts
69
97
 
70
98
  # 1.0.41
71
- * Bump @sveltejs/kit, vite, jsonwebtoken, svelte-check, sass
99
+
100
+ - Bump @sveltejs/kit, vite, jsonwebtoken, svelte-check, sass
72
101
 
73
102
  # 1.0.39
74
- * Bump Svelte, SvelteKit, adapter-node, vite, svelte-preprocess,sass, svelte-check, typescript, prettier, prettier-plugin-svelte
103
+
104
+ - Bump Svelte, SvelteKit, adapter-node, vite, svelte-preprocess,sass, svelte-check, typescript, prettier, prettier-plugin-svelte
75
105
 
76
106
  # 1.0.38
77
- * Switch from SendInBlue to Sendgrid for email
78
- * Bump SvelteKit, adapter-node, and vite
107
+
108
+ - Switch from SendInBlue to Sendgrid for email
109
+ - Bump SvelteKit, adapter-node, and vite
79
110
 
80
111
  # 1.0.37
81
- * Bump SvelteKit, svelte-check, and a few dev dependencies
112
+
113
+ - Bump SvelteKit, svelte-check, and a few dev dependencies
82
114
 
83
115
  # 1.0.36
84
- * Bump SvelteKit, adapter-node, Bootstrap, prettier
116
+
117
+ - Bump SvelteKit, adapter-node, Bootstrap, prettier
85
118
 
86
119
  # 1.0.35
87
- * Update SvelteKit, vite, Typescript
120
+
121
+ - Update SvelteKit, vite, Typescript
88
122
 
89
123
  # 1.0.34
90
- * Update SvelteKit
124
+
125
+ - Update SvelteKit
91
126
 
92
127
  # 1.0.33
93
- * Update dependencies
128
+
129
+ - Update dependencies
94
130
 
95
131
  # 1.0.32
96
- * Remove window from reference to google.accounts
97
- * Add apple-touch-icon.png
98
- * Update dependencies
99
- * Remove dead code
132
+
133
+ - Remove window from reference to google.accounts
134
+ - Add apple-touch-icon.png
135
+ - Update dependencies
136
+ - Remove dead code
100
137
 
101
138
  # 1.0.31
102
- * Cleanup
103
- * Update SvelteKit
139
+
140
+ - Cleanup
141
+ - Update SvelteKit
104
142
 
105
143
  # 1.0.30
106
- * Fixed bug where opening /login or /register would fail to render Sign in With Google button (onMount in +layout.svelte loads after children's onMount)
107
- * Fix bad path for favicon
108
- * Update dependencies
144
+
145
+ - Fixed bug where opening /login or /register would fail to render Sign in With Google button (onMount in +layout.svelte loads after children's onMount)
146
+ - Fix bad path for favicon
147
+ - Update dependencies
109
148
 
110
149
  # 1.0.29
111
- * Fixed bug in hooks.server.ts - new version of SvelteKit complains about modifying cookie after `const response = await resolve(event)` so moved it up two lines.
112
- * Update dependencies
150
+
151
+ - Fixed bug in hooks.server.ts - new version of SvelteKit complains about modifying cookie after `const response = await resolve(event)` so moved it up two lines.
152
+ - Update dependencies
113
153
 
114
154
  # 1.0.28
115
- * Update dependencies
155
+
156
+ - Update dependencies
116
157
 
117
158
  # 1.0.27
118
- * Update dependencies
159
+
160
+ - Update dependencies
119
161
 
120
162
  # 1.0.26
121
- * On the client, track whether the login session has expired and if so, clear $loginSession
122
- * Update dependencies
163
+
164
+ - On the client, track whether the login session has expired and if so, clear $loginSession
165
+ - Update dependencies
123
166
 
124
167
  # 1.0.25
125
- * Bump dependencies
126
- * Simplify Sign In With Google
168
+
169
+ - Bump dependencies
170
+ - Simplify Sign In With Google
127
171
 
128
172
  # 1.0.24
129
- * Bump dependencies
173
+
174
+ - Bump dependencies
130
175
 
131
176
  # 1.0.23
132
- * Restructured server-side libraries to $lib/server based on https://github.com/sveltejs/kit/pull/6623
133
- * General cleanup
177
+
178
+ - Restructured server-side libraries to $lib/server based on https://github.com/sveltejs/kit/pull/6623
179
+ - General cleanup
134
180
 
135
181
  # 1.0.22
136
- * Move google-auth-library and jsonwebtoken to devDependencies from dependencies and other cleanup to package.json
182
+
183
+ - Move google-auth-library and jsonwebtoken to devDependencies from dependencies and other cleanup to package.json
137
184
 
138
185
  # 1.0.21
139
- * Refactor to use $env/static/private and public, dropping dotenv dependency
140
- * Remove @types/cookie and bootstrap-icons dependencies
186
+
187
+ - Refactor to use $env/static/private and public, dropping dotenv dependency
188
+ - Remove @types/cookie and bootstrap-icons dependencies
141
189
 
142
190
  # 1.0.20
143
- * Bump dependencies
144
- * Add service-worker
145
- * Add dropdown, avatarm and user's first name to navbar once user is logged in
146
- * Refactor user session and update typing
191
+
192
+ - Bump dependencies
193
+ - Add service-worker
194
+ - Add dropdown, avatarm and user's first name to navbar once user is logged in
195
+ - Refactor user session and update typing
147
196
 
148
197
  # 1.0.19
149
- * Added SvelteKit's cookies implementation in RequestEvent
150
- * [Bug] Logout then go to http://localhost/admin gives error on auth.ts:39
198
+
199
+ - Added SvelteKit's cookies implementation in RequestEvent
200
+ - [Bug] Logout then go to http://localhost/admin gives error on auth.ts:39
151
201
 
152
202
  # 1.0.18
153
- * Bump dependencies
203
+
204
+ - Bump dependencies
154
205
 
155
206
  # 1.0.17
156
- * Bump dependencies
207
+
208
+ - Bump dependencies
157
209
 
158
210
  # 1.0.16
159
- * [Bug] Fixed LayoutServerLoad typing
211
+
212
+ - [Bug] Fixed LayoutServerLoad typing
160
213
 
161
214
  # 1.0.15
162
- * [Bug] Replaced use of Action type in +server.ts files (only works for +page.server.ts)
215
+
216
+ - [Bug] Replaced use of Action type in +server.ts files (only works for +page.server.ts)
163
217
 
164
218
  # 1.0.14
165
- * Refactor routing to be folder, not file-based - https://github.com/sveltejs/kit/discussions/5774 (file system router). More info: https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3294867
166
- * Move bootstrap SCSS import to JavaScript in +layout.svelte
167
- * Refactor as session was removed in https://github.com/sveltejs/kit/discussions/5883
219
+
220
+ - Refactor routing to be folder, not file-based - https://github.com/sveltejs/kit/discussions/5774 (file system router). More info: https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3294867
221
+ - Move bootstrap SCSS import to JavaScript in +layout.svelte
222
+ - Refactor as session was removed in https://github.com/sveltejs/kit/discussions/5883
168
223
 
169
224
  # 1.0.13
170
- * Bump dependencies
225
+
226
+ - Bump dependencies
171
227
 
172
228
  # 1.0.12
173
- * Remove unnecessary reference from app.d.ts
174
- * Remove commented lines in svelte.config.js
229
+
230
+ - Remove unnecessary reference from app.d.ts
231
+ - Remove commented lines in svelte.config.js
175
232
 
176
233
  # 1.0.10
177
- * Bump dependencies
178
- * Adjust for changes to SvelteKit
179
- * Improve typings
234
+
235
+ - Bump dependencies
236
+ - Adjust for changes to SvelteKit
237
+ - Improve typings
180
238
 
181
239
  # 1.0.9
182
- * Bump dependencies
183
- * Adjust for changes to SvelteKit with respect to vite
240
+
241
+ - Bump dependencies
242
+ - Adjust for changes to SvelteKit with respect to vite
184
243
 
185
244
  # 1.0.7
186
- * Bump dependencies and verify against latest SvelteKit
187
- * Additional changes for register PostgreSQL function
245
+
246
+ - Bump dependencies and verify against latest SvelteKit
247
+ - Additional changes for register PostgreSQL function
188
248
 
189
249
  # 1.0.5
190
- * Bump dependencies
191
- * [Fix] Flaw in register allowing user to register over top of an existing account
192
- * Additional checks of submitted data
250
+
251
+ - Bump dependencies
252
+ - [Fix] Flaw in register allowing user to register over top of an existing account
253
+ - Additional checks of submitted data
193
254
 
194
255
  # 1.0.4
195
- * Bump dependencies
256
+
257
+ - Bump dependencies
196
258
 
197
259
  # 1.0.4
198
- * [Fix] If you login with a Google account, you cannot Update the Profile (UI is looking for password and confirm password which don't make sense in this context)
199
- * Added Content Security Policy
260
+
261
+ - [Fix] If you login with a Google account, you cannot Update the Profile (UI is looking for password and confirm password which don't make sense in this context)
262
+ - Added Content Security Policy
200
263
 
201
264
  # 1.0.3
202
- * [Fix] user created or updated when password mismatches (@lxy-yz)
203
- * Updated project dependencies
204
- * Replaced Sveltestrap's Toast with native Bootstrap 5 JavaScript to avoid error with @popperjs import (lacks type=module)
205
- * Added declarations for Session and Locals for type safety
265
+
266
+ - [Fix] user created or updated when password mismatches (@lxy-yz)
267
+ - Updated project dependencies
268
+ - Replaced Sveltestrap's Toast with native Bootstrap 5 JavaScript to avoid error with @popperjs import (lacks type=module)
269
+ - Added declarations for Session and Locals for type safety
206
270
 
207
271
  # 1.0.2
208
- * [Fix] Updated endpoints and hooks to conform to SvelteKit's API changes.
209
- * Updated project dependencies
272
+
273
+ - [Fix] Updated endpoints and hooks to conform to SvelteKit's API changes.
274
+ - Updated project dependencies
210
275
 
211
276
  # 1.0.1
212
- * Switched to dotenv vs. VITE_ env values for better security
213
- * Load Sign in with Google via code instead of static template
214
- * Fix logout (didn't work if session expired)
215
- * Fix login button rendering if that's the starting page
277
+
278
+ - Switched to dotenv vs. VITE\_ env values for better security
279
+ - Load Sign in with Google via code instead of static template
280
+ - Fix logout (didn't work if session expired)
281
+ - Fix login button rendering if that's the starting page
216
282
 
217
283
  # Backlog
218
- * [Low] Add password complexity check
219
- * [Low] Add Google reCaptcha 3
284
+
285
+ - [Low] Add password complexity check
286
+ - [Low] Add Google reCaptcha 3
package/README.md CHANGED
@@ -10,6 +10,7 @@ It's a Single Page App (SPA) built with SvelteKit and a PostgreSQL database back
10
10
  The project includes a Content Security Policy (CSP) in svelte.config.js.
11
11
 
12
12
  The website supports two types of authentication:
13
+
13
14
  1. **Local accounts** via username (email) and password
14
15
  - The login form (/src/routes/login/+page.svelte) sends the login info as JSON to endpoint /auth/login
15
16
  - The endpoint passes the JSON to PostgreSQL function authenticate(json) which hashes the password and compares it to the stored hashed password in the users table. The function returns JSON containing a session ID (v4 UUID) and user object (sans password).
@@ -31,6 +32,7 @@ The website supports two types of authentication:
31
32
  The forgot password / password reset functionality uses a JWT and [**SendGrid**](https://www.sendgrid.com) to send the email. You would need to have a **SendGrid** account and set two environmental variables. Email sending is in /src/routes/auth/forgot.ts. This code could easily be replaced by nodemailer or something similar. Note: I have no affliation with **SendGrid** (used their API in another project).
32
33
 
33
34
  ## Prerequisites
35
+
34
36
  - PostgreSQL 14.10 or higher
35
37
  - Node.js 18.19.0 or higher
36
38
  - Google API client
@@ -41,6 +43,7 @@ The forgot password / password reset functionality uses a JWT and [**SendGrid**]
41
43
  Here are the steps:
42
44
 
43
45
  1. Get the project and setup the database
46
+
44
47
  ```bash
45
48
  # Clone the repo to your current directory
46
49
  git clone https://github.com/nstuyvesant/sveltekit-auth-example.git
@@ -58,6 +61,7 @@ psql -d postgres -f db_create.sql
58
61
  3. [Create a free Twilio SendGrid account](https://signup.sendgrid.com) and generate an API Key following [this documentation](https://docs.sendgrid.com/ui/account-and-settings/api-keys) and add a sender as documented [here](https://docs.sendgrid.com/ui/sending-email/senders).
59
62
 
60
63
  4. Create an **.env** file at the top level of the project with the following values (substituting your own id and PostgreSQL username and password):
64
+
61
65
  ```bash
62
66
  DATABASE_URL=postgres://user:password@localhost:5432/auth
63
67
  DOMAIN=http://localhost:3000
@@ -77,10 +81,11 @@ yarn dev -- --open
77
81
  ## Valid logins
78
82
 
79
83
  The db_create.sql script adds three users to the database with obvious roles:
84
+
80
85
  - admin@example.com password admin123
81
86
  - teacher@example.com password teacher123
82
87
  - student@example.com password student123
83
88
 
84
89
  ## My ask of you
85
90
 
86
- Please report any issues [here](https://github.com/nstuyvesant/sveltekit-auth-example/issues). [Pull requests](https://github.com/nstuyvesant/sveltekit-auth-example/pulls) are encouraged especially as SvelteKit is evolving rapidly.
91
+ Please report any issues [here](https://github.com/nstuyvesant/sveltekit-auth-example/issues). [Pull requests](https://github.com/nstuyvesant/sveltekit-auth-example/pulls) are encouraged especially as SvelteKit is evolving rapidly.
@@ -0,0 +1,31 @@
1
+ export default {
2
+ root: true,
3
+ parser: '@typescript-eslint/parser',
4
+ extends: [
5
+ 'eslint:recommended',
6
+ 'plugin:@typescript-eslint/recommended',
7
+ 'plugin:svelte/recommended',
8
+ 'prettier'
9
+ ],
10
+ plugins: ['@typescript-eslint'],
11
+ ignorePatterns: ['*.cjs'],
12
+ parserOptions: {
13
+ sourceType: 'module',
14
+ ecmaVersion: 2020,
15
+ extraFileExtensions: ['.svelte']
16
+ },
17
+ env: {
18
+ browser: true,
19
+ es2017: true,
20
+ node: true
21
+ },
22
+ overrides: [
23
+ {
24
+ files: ['*.svelte'],
25
+ parser: 'svelte-eslint-parser',
26
+ parserOptions: {
27
+ parser: '@typescript-eslint/parser'
28
+ }
29
+ }
30
+ ]
31
+ }
package/package.json CHANGED
@@ -1,69 +1,69 @@
1
1
  {
2
- "name": "sveltekit-auth-example",
3
- "description": "SvelteKit Authentication Example",
4
- "version": "2.0.1",
5
- "author": "Nate Stuyvesant",
6
- "license": "https://github.com/nstuyvesant/sveltekit-auth-example/blob/master/LICENSE",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/nstuyvesant/sveltekit-auth-example.git"
10
- },
11
- "bugs": {
12
- "url": "https://github.com/nstuyvesant/sveltekit-auth-example/issues"
13
- },
14
- "keywords": [
15
- "svelte",
16
- "sveltekit",
17
- "authentication",
18
- "example",
19
- "google",
20
- "postgresql"
21
- ],
22
- "scripts": {
23
- "start": "node build",
24
- "dev": "vite dev",
25
- "build": "vite build",
26
- "package": "svelte-kit package",
27
- "preview": "vite preview",
28
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
29
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
30
- "lint": "prettier --check . && eslint .",
31
- "format": "prettier --write ."
32
- },
33
- "engines": {
34
- "node": "^18.19.0"
35
- },
36
- "type": "module",
37
- "dependencies": {
38
- "@sendgrid/mail": "^8.1.0",
39
- "pg": "^8.11.3"
40
- },
41
- "devDependencies": {
42
- "@sveltejs/adapter-node": "^4.0.1",
43
- "@sveltejs/kit": "^2.5.0",
44
- "@sveltejs/vite-plugin-svelte": "^3.0.2",
45
- "@types/bootstrap": "5.2.10",
46
- "@types/google.accounts": "^0.0.14",
47
- "@types/jsonwebtoken": "^9.0.5",
48
- "@types/pg": "^8.11.0",
49
- "@typescript-eslint/eslint-plugin": "^6.19.1",
50
- "@typescript-eslint/parser": "^6.19.1",
51
- "bootstrap": "^5.3.2",
52
- "eslint": "^8.56.0",
53
- "eslint-config-prettier": "^9.1.0",
54
- "eslint-plugin-svelte3": "^4.0.0",
55
- "google-auth-library": "^9.5.0",
56
- "jsonwebtoken": "^9.0.2",
57
- "prettier": "^3.2.4",
58
- "prettier-plugin-svelte": "^3.1.2",
59
- "sass": "^1.70.0",
60
- "svelte": "^4.2.9",
61
- "svelte-check": "^3.6.3",
62
- "tslib": "^2.6.2",
63
- "typescript": "^5.3.3",
64
- "vite": "^5.0.12",
65
- "vitest": "^1.2.2"
66
- },
67
- "packageManager": "yarn@4.0.2",
68
- "prettier": "./prettier.config.mjs"
2
+ "name": "sveltekit-auth-example",
3
+ "description": "SvelteKit Authentication Example",
4
+ "version": "2.0.3",
5
+ "author": "Nate Stuyvesant",
6
+ "license": "https://github.com/nstuyvesant/sveltekit-auth-example/blob/master/LICENSE",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/nstuyvesant/sveltekit-auth-example.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/nstuyvesant/sveltekit-auth-example/issues"
13
+ },
14
+ "keywords": [
15
+ "svelte",
16
+ "sveltekit",
17
+ "authentication",
18
+ "example",
19
+ "google",
20
+ "postgresql"
21
+ ],
22
+ "scripts": {
23
+ "start": "node build",
24
+ "dev": "vite dev",
25
+ "build": "vite build",
26
+ "package": "svelte-kit package",
27
+ "preview": "vite preview",
28
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
29
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
30
+ "lint": "prettier --check . && eslint . --ignore-path ./.eslintignore",
31
+ "format": "prettier --write . --ignore-path ./.eslintignore"
32
+ },
33
+ "engines": {
34
+ "node": "^18.19.0"
35
+ },
36
+ "type": "module",
37
+ "dependencies": {
38
+ "@sendgrid/mail": "^8.1.0",
39
+ "pg": "^8.11.3"
40
+ },
41
+ "devDependencies": {
42
+ "@sveltejs/adapter-node": "^4.0.1",
43
+ "@sveltejs/kit": "^2.5.0",
44
+ "@sveltejs/vite-plugin-svelte": "^3.0.2",
45
+ "@types/bootstrap": "5.2.10",
46
+ "@types/google.accounts": "^0.0.14",
47
+ "@types/jsonwebtoken": "^9.0.5",
48
+ "@types/pg": "^8.11.0",
49
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
50
+ "@typescript-eslint/parser": "^6.19.1",
51
+ "bootstrap": "^5.3.2",
52
+ "eslint": "^8.56.0",
53
+ "eslint-config-prettier": "^9.1.0",
54
+ "eslint-plugin-svelte": "^2.35.1",
55
+ "google-auth-library": "^9.5.0",
56
+ "jsonwebtoken": "^9.0.2",
57
+ "prettier": "^3.2.4",
58
+ "prettier-plugin-svelte": "^3.1.2",
59
+ "sass": "^1.70.0",
60
+ "svelte": "^4.2.9",
61
+ "svelte-check": "^3.6.3",
62
+ "tslib": "^2.6.2",
63
+ "typescript": "^5.3.3",
64
+ "vite": "^5.0.12",
65
+ "vitest": "^1.2.2"
66
+ },
67
+ "packageManager": "yarn@4.0.2",
68
+ "prettier": "./prettier.config.mjs"
69
69
  }
@@ -1,14 +1,17 @@
1
1
  export default {
2
2
  $schema: 'https://json.schemastore.org/prettierrc',
3
- plugins: ['prettier-plugin-svelte'],
4
3
  useTabs: true,
4
+ tabWidth: 2,
5
5
  semi: false,
6
+ arrowParens: 'avoid',
6
7
  singleQuote: true,
7
8
  trailingComma: 'none',
8
9
  printWidth: 100,
9
- pluginSearchDirs: ['.'],
10
- overrides: [{
11
- files: '*.svelte',
12
- options: { parser: 'svelte' }
13
- }]
10
+ plugins: ['prettier-plugin-svelte'],
11
+ overrides: [
12
+ {
13
+ files: '*.svelte',
14
+ options: { parser: 'svelte' }
15
+ }
16
+ ]
14
17
  }