Skip to content

Commit 68d1596

Browse files
chore(auth-providers): switch firebase web to esbuild (#11467)
Switches from babel to esbuild for building the src to dist. Follows the same pattern we have currently for the rest of them - not perfect but moving in the right direction.
1 parent 29dd25a commit 68d1596

File tree

9 files changed

+89
-21
lines changed

9 files changed

+89
-21
lines changed

packages/auth-providers/firebase/web/.babelrc.js

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { buildCjs, buildEsm } from '@redwoodjs/framework-tools'
2+
import {
3+
generateTypesCjs,
4+
generateTypesEsm,
5+
insertCommonJsPackageJson,
6+
} from '@redwoodjs/framework-tools/generateTypes'
7+
8+
// ESM build and type generation
9+
await buildEsm()
10+
await generateTypesEsm()
11+
12+
// CJS build, type generation, and package.json insert
13+
await buildCjs()
14+
await generateTypesCjs()
15+
await insertCommonJsPackageJson({
16+
buildFileUrl: import.meta.url,
17+
})

packages/auth-providers/firebase/web/package.json

+35-9
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,58 @@
77
"directory": "packages/auth-providers/firebase/web"
88
},
99
"license": "MIT",
10-
"main": "./dist/index.js",
10+
"type": "module",
11+
"exports": {
12+
".": {
13+
"import": {
14+
"types": "./dist/index.d.ts",
15+
"default": "./dist/index.js"
16+
},
17+
"default": {
18+
"types": "./dist/cjs/index.d.ts",
19+
"default": "./dist/cjs/index.js"
20+
}
21+
},
22+
"./dist/firebase": {
23+
"import": {
24+
"types": "./dist/firebase.d.ts",
25+
"default": "./dist/firebase.js"
26+
},
27+
"default": {
28+
"types": "./dist/cjs/firebase.d.ts",
29+
"default": "./dist/cjs/firebase.js"
30+
}
31+
}
32+
},
33+
"main": "./dist/cjs/index.js",
34+
"module": "./dist/index.js",
1135
"types": "./dist/index.d.ts",
1236
"files": [
1337
"dist"
1438
],
1539
"scripts": {
16-
"build": "yarn build:js && yarn build:types",
17-
"build:js": "babel src -d dist --extensions \".js,.jsx,.ts,.tsx\" --copy-files --no-copy-ignored",
40+
"build": "tsx ./build.ts",
1841
"build:pack": "yarn pack -o redwoodjs-auth-firebase-web.tgz",
19-
"build:types": "tsc --build --verbose",
42+
"build:types": "tsc --build --verbose ./tsconfig.build.json",
43+
"build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json",
2044
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
45+
"check:attw": "yarn rw-fwtools-attw",
46+
"check:package": "concurrently npm:check:attw yarn:publint",
2147
"prepublishOnly": "NODE_ENV=production yarn build",
2248
"test": "vitest run",
2349
"test:watch": "vitest watch"
2450
},
2551
"dependencies": {
26-
"@babel/runtime-corejs3": "7.25.0",
27-
"@redwoodjs/auth": "workspace:*",
28-
"core-js": "3.38.0"
52+
"@redwoodjs/auth": "workspace:*"
2953
},
3054
"devDependencies": {
31-
"@babel/cli": "7.24.8",
32-
"@babel/core": "^7.22.20",
55+
"@redwoodjs/framework-tools": "workspace:*",
3356
"@types/react": "^18.2.55",
57+
"concurrently": "8.2.2",
3458
"firebase": "10.13.1",
59+
"publint": "0.2.10",
3560
"react": "19.0.0-rc-8269d55d-20240802",
61+
"tsx": "4.17.0",
3662
"typescript": "5.5.4",
3763
"vitest": "2.0.5"
3864
},

packages/auth-providers/firebase/web/src/__tests__/firebase.test.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { vi, beforeAll, beforeEach, describe, it, expect } from 'vitest'
66

77
import type { CurrentUser } from '@redwoodjs/auth'
88

9-
import type { FirebaseClient } from '../firebase'
10-
import { createAuth } from '../firebase'
9+
import type { FirebaseClient } from '../firebase.js'
10+
import { createAuth } from '../firebase.js'
1111

1212
const user: User = {
1313
uid: 'unique_user_id',
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { createAuth } from './firebase'
1+
export { createAuth } from './firebase.js'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "../../../../tsconfig.compilerOption.json",
3+
"compilerOptions": {
4+
"strict": true,
5+
"rootDir": "src",
6+
"outDir": "dist",
7+
"tsBuildInfoFile": "./tsconfig.build.tsbuildinfo"
8+
},
9+
"include": ["src"],
10+
"references": [
11+
{
12+
"path": "./../../../auth/tsconfig.build.json"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.build.json",
3+
"compilerOptions": {
4+
"outDir": "dist/cjs",
5+
"tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo"
6+
}
7+
}

packages/auth-providers/firebase/web/tsconfig.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
"extends": "../../../../tsconfig.compilerOption.json",
33
"compilerOptions": {
44
"strict": true,
5-
"rootDir": "src",
6-
"outDir": "dist"
5+
"module": "Node16",
6+
"moduleResolution": "Node16"
77
},
8-
"include": ["src"],
9-
"references": [{ "path": "../../../auth/tsconfig.build.json" }]
8+
"include": ["."],
9+
"references": [
10+
{ "path": "../../../auth/tsconfig.build.json" },
11+
{ "path": "../../../framework-tools" }
12+
],
13+
"exclude": ["dist", "node_modules", "**/__mocks__", "**/__tests__/fixtures"]
1014
}

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -7602,14 +7602,14 @@ __metadata:
76027602
version: 0.0.0-use.local
76037603
resolution: "@redwoodjs/auth-firebase-web@workspace:packages/auth-providers/firebase/web"
76047604
dependencies:
7605-
"@babel/cli": "npm:7.24.8"
7606-
"@babel/core": "npm:^7.22.20"
7607-
"@babel/runtime-corejs3": "npm:7.25.0"
76087605
"@redwoodjs/auth": "workspace:*"
7606+
"@redwoodjs/framework-tools": "workspace:*"
76097607
"@types/react": "npm:^18.2.55"
7610-
core-js: "npm:3.38.0"
7608+
concurrently: "npm:8.2.2"
76117609
firebase: "npm:10.13.1"
7610+
publint: "npm:0.2.10"
76127611
react: "npm:19.0.0-rc-8269d55d-20240802"
7612+
tsx: "npm:4.17.0"
76137613
typescript: "npm:5.5.4"
76147614
vitest: "npm:2.0.5"
76157615
peerDependencies:

0 commit comments

Comments
 (0)