Skip to content

Commit 0f05c3f

Browse files
authored
Merge pull request #10 from Code-Hex/update/packages
update any packages
2 parents 1883637 + 611e5ce commit 0f05c3f

24 files changed

+1937
-3296
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
dist
1+
dist
2+
vitest.config.ts
3+
.eslintrc.js

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = defineConfig({
1717
},
1818
rules: {
1919
quotes: ['error', 'single'],
20-
semi: ['error', 'never'],
20+
semi: 'off',
2121
'no-debugger': ['error'],
2222
'no-empty': ['warn', { allowEmptyCatch: true }],
2323
'no-process-exit': 'off',

.github/workflows/ci.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,25 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212
- name: Setup Node
13-
uses: actions/setup-node@v2
13+
uses: actions/setup-node@v3
1414
with:
15-
node-version: 17
16-
- name: Cache Yarn
17-
uses: actions/cache@v2
18-
with:
19-
path: '**/node_modules'
20-
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
21-
restore-keys: |
22-
${{ runner.os }}-yarn-
15+
node-version: 18
16+
cache: 'yarn'
2317
- run: yarn install --frozen-lockfile
2418
- run: yarn test
2519
env:
2620
CI: true
2721
eslint:
2822
runs-on: ubuntu-latest
2923
steps:
30-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v3
3125
- name: Setup Node
32-
uses: actions/setup-node@v2
26+
uses: actions/setup-node@v3
3327
with:
3428
node-version: 18
35-
- name: Cache Yarn
36-
uses: actions/cache@v2
37-
with:
38-
path: '**/node_modules'
39-
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
40-
restore-keys: |
41-
${{ runner.os }}-yarn-
29+
cache: 'yarn'
4230
- run: yarn install --frozen-lockfile
4331
- run: yarn lint-fix
4432
- run: yarn prettier

.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"trailingComma": "es5",
33
"printWidth": 120,
44
"singleQuote": true,
5-
"arrowParens": "avoid"
5+
"arrowParens": "avoid",
6+
"semi": true
67
}

jest.config.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

package.json

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase-auth-cloudflare-workers",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Zero-dependencies firebase auth library for Cloudflare Workers.",
55
"author": "codehex",
66
"license": "MIT",
@@ -13,7 +13,7 @@
1313
"README.md"
1414
],
1515
"scripts": {
16-
"test": "jest",
16+
"test": "vitest run",
1717
"build": "run-p build:*",
1818
"build:main": "tsc -p tsconfig.main.json",
1919
"build:module": "tsc -p tsconfig.module.json",
@@ -27,24 +27,22 @@
2727
},
2828
"dependencies": {},
2929
"devDependencies": {
30-
"@cloudflare/workers-types": "^3.14.0",
31-
"@types/jest": "^28.1.3",
32-
"@typescript-eslint/eslint-plugin": "^5.30.5",
33-
"@typescript-eslint/parser": "^5.30.5",
34-
"eslint": "^8.19.0",
35-
"eslint-config-prettier": "^8.5.0",
36-
"eslint-define-config": "^1.5.1",
37-
"eslint-import-resolver-typescript": "^3.2.4",
30+
"@cloudflare/workers-types": "^4.20231025.0",
31+
"@typescript-eslint/eslint-plugin": "^6.10.0",
32+
"@typescript-eslint/parser": "^6.10.0",
33+
"eslint": "^8.53.0",
34+
"eslint-config-prettier": "^9.0.0",
35+
"eslint-define-config": "^1.24.1",
36+
"eslint-import-resolver-typescript": "^3.6.1",
3837
"eslint-plugin-eslint-comments": "^3.2.0",
39-
"eslint-plugin-import": "^2.26.0",
40-
"firebase-tools": "^11.2.0",
41-
"jest": "^28.1.2",
42-
"jest-environment-miniflare": "^2.5.1",
38+
"eslint-plugin-import": "^2.29.0",
39+
"firebase-tools": "^12.8.1",
40+
"miniflare": "^3.20231025.1",
4341
"npm-run-all": "^4.1.5",
44-
"prettier": "^2.7.1",
45-
"ts-jest": "^28.0.5",
46-
"typescript": "^4.7.4",
47-
"wrangler": "^2.0.16"
42+
"prettier": "^3.0.3",
43+
"typescript": "^5.2.2",
44+
"vitest": "^0.34.6",
45+
"wrangler": "^3.15.0"
4846
},
4947
"keywords": [
5048
"web",

src/base64.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export const decodeBase64Url = (str: string): Uint8Array => {
2-
return decodeBase64(str.replace(/_|-/g, m => ({ _: '/', '-': '+' }[m] ?? m)));
2+
return decodeBase64(str.replace(/_|-/g, m => ({ _: '/', '-': '+' })[m] ?? m));
33
};
44

55
export const encodeBase64Url = (buf: ArrayBufferLike): string =>
6-
encodeBase64(buf).replace(/\/|\+/g, m => ({ '/': '_', '+': '-' }[m] ?? m));
6+
encodeBase64(buf).replace(/\/|\+/g, m => ({ '/': '_', '+': '-' })[m] ?? m);
77

88
// This approach is written in MDN.
99
// btoa does not support utf-8 characters. So we need a little bit hack.

src/errors.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
* @constructor
77
*/
88
export class JwtError extends Error {
9-
constructor(readonly code: JwtErrorCode, readonly message: string) {
9+
constructor(
10+
readonly code: JwtErrorCode,
11+
readonly message: string
12+
) {
1013
super(message);
1114
(this as any).__proto__ = JwtError.prototype;
1215
}
@@ -160,7 +163,11 @@ export interface ErrorInfo {
160163
* @constructor
161164
*/
162165
export class PrefixedFirebaseError extends FirebaseError {
163-
constructor(private codePrefix: string, code: string, message: string) {
166+
constructor(
167+
private codePrefix: string,
168+
code: string,
169+
message: string
170+
) {
164171
super({
165172
code: `${codePrefix}/${code}`,
166173
message,

src/jwk-fetcher.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ const isJWKMetadata = (value: any): value is JWKMetadata =>
1717
* Class to fetch public keys from a client certificates URL.
1818
*/
1919
export class UrlKeyFetcher implements KeyFetcher {
20-
constructor(private readonly fetcher: Fetcher, private readonly keyStorer: KeyStorer) {}
20+
constructor(
21+
private readonly fetcher: Fetcher,
22+
private readonly keyStorer: KeyStorer
23+
) {}
2124

2225
/**
2326
* Fetches the public keys for the Google certs.

src/jwt-decoder.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export type DecodedToken = {
2828
};
2929

3030
export class RS256Token {
31-
constructor(private rawToken: string, public readonly decodedToken: DecodedToken) {}
31+
constructor(
32+
private rawToken: string,
33+
public readonly decodedToken: DecodedToken
34+
) {}
3235
/**
3336
*
3437
* @param token - The JWT to verify.

0 commit comments

Comments
 (0)