sveltekit-auth-example 1.0.8 → 1.0.9

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,3 +1,7 @@
1
+ # 1.0.9
2
+ * Bump dependencies
3
+ * Adjust for changes to SvelteKit with respect to vite
4
+
1
5
  # 1.0.7
2
6
  * Bump dependencies and verify against latest SvelteKit
3
7
  * Additional changes for register PostgreSQL function
package/README.md CHANGED
@@ -30,9 +30,9 @@ Pages use the session.user.role to determine whether they are authorized. While
30
30
  The forgot password functionality uses SendInBlue to send the email. You would need to have a SendInBlue account and set three environmental variables. Email sending is in /src/routes/auth/forgot.ts. This code could easily be replaced by nodemailer or something similar.
31
31
 
32
32
  ## Prerequisites
33
- - PostgreSQL 13 or higher
34
- - Node.js 16.13.0 or higher
35
- - npm 8.1.0 or higher
33
+ - PostgreSQL 14 or higher
34
+ - Node.js 16.16.0 or higher
35
+ - npm 8.14.0 or higher
36
36
  - Google API client
37
37
  - SendInBlue account (only used for emailing password reset link - the sample can run without it but forgot password will not work)
38
38
 
@@ -53,7 +53,7 @@ npm install
53
53
  psql -d postgres -f db_create.sql
54
54
  ```
55
55
 
56
- 2. Create a **Google API client ID** per [these instructions](https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid).
56
+ 2. Create a **Google API client ID** per [these instructions](https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid). Make sure you include `http://localhost:3000`, `http://localhost` in the Authorized JavaScript origins and `http://localhost:3000/auth/google/callback` in the Authorized redirect URIs for your Client ID for Web application. ** Do not access the site using http://127.0.0.1:3000 ** - use `http://localhost:3000` or it will not work.
57
57
 
58
58
  3. Create an **.env** file at the top level of the project with the following values (substituting your own id and PostgreSQL username and password):
59
59
  ```bash
@@ -83,4 +83,4 @@ The db_create.sql script adds three users to the database with obvious roles:
83
83
 
84
84
  ## My ask of you
85
85
 
86
- Please report any issues or areas where the code can be optimized. I am still learning Svelte and SvelteKit. All feedback is appreciated.
86
+ Please report any issues or areas where the code can be optimized.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sveltekit-auth-example",
3
3
  "description": "SvelteKit Authentication Example",
4
- "version": "1.0.8",
4
+ "version": "1.0.9",
5
5
  "private": false,
6
6
  "author": "Nate Stuyvesant",
7
7
  "license": "https://github.com/nstuyvesant/sveltekit-auth-example/blob/master/LICENSE",
@@ -22,24 +22,25 @@
22
22
  "example"
23
23
  ],
24
24
  "scripts": {
25
- "dev": "svelte-kit dev",
25
+ "start": "node build",
26
+ "dev": "vite dev",
26
27
  "serve": "npm run dev -- --open",
27
- "build": "svelte-kit build",
28
- "preview": "svelte-kit preview",
28
+ "build": "vite build",
29
+ "preview": "vite preview",
29
30
  "check": "svelte-check --tsconfig ./tsconfig.json",
30
31
  "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
31
32
  "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
32
33
  "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
33
34
  },
34
35
  "engines": {
35
- "node": "~16.15.1",
36
- "npm": "^8.13.1"
36
+ "node": "~16.16.0",
37
+ "npm": "^8.14.0"
37
38
  },
38
39
  "type": "module",
39
40
  "dependencies": {
40
41
  "cookie": "^0.5.0",
41
42
  "dotenv": "^16.0.1",
42
- "google-auth-library": "^8.0.3",
43
+ "google-auth-library": "^8.1.1",
43
44
  "jsonwebtoken": "^8.5.1",
44
45
  "pg": "^8.7.3",
45
46
  "pg-native": "^3.0.0"
@@ -47,22 +48,24 @@
47
48
  "devDependencies": {
48
49
  "@sveltejs/adapter-node": "latest",
49
50
  "@sveltejs/kit": "latest",
51
+ "@types/cookie": "^0.5.1",
50
52
  "@types/jsonwebtoken": "^8.5.8",
51
53
  "@types/pg": "^8.6.5",
52
- "@typescript-eslint/eslint-plugin": "^5.30.0",
53
- "@typescript-eslint/parser": "^5.30.0",
54
+ "@typescript-eslint/eslint-plugin": "^5.30.6",
55
+ "@typescript-eslint/parser": "^5.30.6",
54
56
  "bootstrap": "^5.1.3",
55
- "bootstrap-icons": "^1.8.3",
56
- "eslint": "^8.18.0",
57
+ "bootstrap-icons": "^1.9.0",
58
+ "eslint": "^8.19.0",
57
59
  "eslint-config-prettier": "^8.5.0",
58
60
  "eslint-plugin-svelte3": "^4.0.0",
59
61
  "prettier": "^2.7.1",
60
62
  "prettier-plugin-svelte": "^2.7.0",
61
63
  "sass": "^1.53.0",
62
- "svelte": "^3.48.0",
64
+ "svelte": "^3.49.0",
63
65
  "svelte-check": "^2.8.0",
64
66
  "svelte-preprocess": "^4.10.7",
65
67
  "tslib": "^2.4.0",
66
- "typescript": "^4.7.4"
68
+ "typescript": "^4.7.4",
69
+ "vite": "^3.0.0"
67
70
  }
68
71
  }
package/svelte.config.js CHANGED
@@ -5,6 +5,7 @@ const production = process.env.NODE_ENV === 'production'
5
5
 
6
6
  const baseCsp = [
7
7
  'self',
8
+ 'ws://127.0.0.1:3000/',
8
9
  // 'strict-dynamic', // issues with datepicker on classes, add to calendar scripts
9
10
  'https://www.gstatic.com/recaptcha/', // recaptcha
10
11
  'https://accounts.google.com/gsi/', // sign-in w/google
@@ -33,11 +34,6 @@ const config = {
33
34
  'base-uri': ['self'],
34
35
  // 'require-trusted-types-for': ["'script'"] // will require effort to get this working
35
36
  }
36
- },
37
- vite: {
38
- serviceWorker: {
39
- files: (filepath) => !/\.DS_Store/.test(filepath)
40
- }
41
37
  }
42
38
  }
43
39
  }
package/tsconfig.json CHANGED
@@ -1,32 +1,13 @@
1
1
  {
2
2
  "extends": "./.svelte-kit/tsconfig.json",
3
3
  "compilerOptions": {
4
- "moduleResolution": "node",
5
- "module": "es2020",
6
- "lib": ["es2020", "DOM"],
7
- "target": "es2019",
8
- /**
9
- svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
10
- to enforce using \`import type\` instead of \`import\` for Types.
11
- */
12
- "importsNotUsedAsValues": "error",
13
- "isolatedModules": true,
14
- "resolveJsonModule": true,
15
- /**
16
- To have warnings/errors of the Svelte compiler at the correct position,
17
- enable source maps by default.
18
- */
19
- "sourceMap": true,
20
- "esModuleInterop": true,
21
- "skipLibCheck": true,
22
- "forceConsistentCasingInFileNames": true,
23
- "baseUrl": ".",
24
4
  "allowJs": true,
25
5
  "checkJs": true,
26
- "paths": {
27
- "$lib": ["src/lib"],
28
- "$lib/*": ["src/lib/*"]
29
- }
30
- },
31
- "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "resolveJsonModule": true,
9
+ "skipLibCheck": true,
10
+ "sourceMap": true,
11
+ "strict": true
12
+ }
32
13
  }
package/vite.config.js ADDED
@@ -0,0 +1,16 @@
1
+ import { sveltekit } from '@sveltejs/kit/vite'
2
+
3
+ /** @type {import('vite').UserConfig} */
4
+ const config = {
5
+ plugins: [sveltekit()],
6
+ serviceWorker: {
7
+ files: (filepath) => !/\.DS_Store/.test(filepath)
8
+ },
9
+ server: {
10
+ host: 'localhost',
11
+ port: 3000,
12
+ open: 'http://localhost:3000'
13
+ }
14
+ }
15
+
16
+ export default config