Skip to content

Commit

Permalink
fix(auth-providers): Move away from babel for building 'api' packages (
Browse files Browse the repository at this point in the history
…#11301)

This switches from babel to esbuild for building the 'api' auth provider
packages.

I added `exports` to the package.json. I added all existing files to the
exports field.

I updated the tsconfig files to use `Node16` module and module
resolution. I explicitly set the tsbuildinfo file too. My thinking is
that we can be explicit to start with. Once we have all our packages
over to esbuild and know the lay of the land then we can
deduplicate/refactor our configs.

This is a chore but does effect what gets shipped so I'll label it as
fix and mark it as next-release.
  • Loading branch information
Josh-Walker-GM authored Aug 18, 2024
1 parent 78b897a commit ddfb080
Show file tree
Hide file tree
Showing 33 changed files with 307 additions and 105 deletions.
1 change: 0 additions & 1 deletion packages/auth-providers/auth0/api/.babelrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/auth-providers/auth0/api/build.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { build } from '@redwoodjs/framework-tools'

await build()
31 changes: 24 additions & 7 deletions packages/auth-providers/auth0/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,49 @@
"directory": "packages/auth-providers/auth0/api"
},
"license": "MIT",
"type": "commonjs",
"exports": {
".": {
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./dist/decoder": {
"default": {
"types": "./dist/decoder.d.ts",
"default": "./dist/decoder.js"
}
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "yarn build:js && yarn build:types",
"build:js": "babel src -d dist --extensions \".js,.jsx,.ts,.tsx\" --copy-files --no-copy-ignored",
"build": "tsx ./build.mts && yarn build:types",
"build:pack": "yarn pack -o redwoodjs-auth-auth0-api.tgz",
"build:types": "tsc --build --verbose",
"build:types": "tsc --build --verbose ./tsconfig.json",
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
"check:attw": "yarn attw -P",
"check:package": "concurrently npm:check:attw yarn:publint",
"prepublishOnly": "NODE_ENV=production yarn build",
"test": "vitest run",
"test:watch": "vitest watch"
},
"dependencies": {
"@babel/runtime-corejs3": "7.25.0",
"core-js": "3.38.0",
"jsonwebtoken": "9.0.2",
"jwks-rsa": "3.1.0"
},
"devDependencies": {
"@babel/cli": "7.24.8",
"@babel/core": "^7.22.20",
"@arethetypeswrong/cli": "0.15.4",
"@redwoodjs/api": "workspace:*",
"@redwoodjs/framework-tools": "workspace:*",
"@types/jsonwebtoken": "9.0.6",
"concurrently": "8.2.2",
"publint": "0.2.10",
"tsx": "4.17.0",
"typescript": "5.5.4",
"vitest": "2.0.5"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/auth-providers/auth0/api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"compilerOptions": {
"strict": true,
"rootDir": "src",
"outDir": "dist"
"outDir": "dist",
"module": "Node16",
"moduleResolution": "Node16",
"tsBuildInfoFile": "./tsconfig.tsbuildinfo"
},
"include": ["src"],
"references": [{ "path": "../../../api" }]
Expand Down

This file was deleted.

3 changes: 3 additions & 0 deletions packages/auth-providers/azureActiveDirectory/api/build.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { build } from '@redwoodjs/framework-tools'

await build()
31 changes: 24 additions & 7 deletions packages/auth-providers/azureActiveDirectory/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,50 @@
"directory": "packages/auth-providers/azureActiveDirectory/api"
},
"license": "MIT",
"type": "commonjs",
"exports": {
".": {
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./dist/decoder": {
"default": {
"types": "./dist/decoder.d.ts",
"default": "./dist/decoder.js"
}
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "yarn build:js && yarn build:types",
"build:js": "babel src -d dist --extensions \".js,.jsx,.ts,.tsx\" --copy-files --no-copy-ignored",
"build": "tsx ./build.mts && yarn build:types",
"build:pack": "yarn pack -o redwoodjs-auth-azure-active-directory-api.tgz",
"build:types": "tsc --build --verbose",
"build:types": "tsc --build --verbose ./tsconfig.json",
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
"check:attw": "yarn attw -P",
"check:package": "concurrently npm:check:attw yarn:publint",
"prepublishOnly": "NODE_ENV=production yarn build",
"test": "vitest run",
"test:watch": "vitest watch"
},
"dependencies": {
"@babel/runtime-corejs3": "7.25.0",
"core-js": "3.38.0",
"jsonwebtoken": "9.0.2",
"jwks-rsa": "3.1.0"
},
"devDependencies": {
"@babel/cli": "7.24.8",
"@babel/core": "^7.22.20",
"@arethetypeswrong/cli": "0.15.4",
"@redwoodjs/api": "workspace:*",
"@redwoodjs/framework-tools": "workspace:*",
"@types/aws-lambda": "8.10.143",
"@types/jsonwebtoken": "9.0.6",
"concurrently": "8.2.2",
"publint": "0.2.10",
"tsx": "4.17.0",
"typescript": "5.5.4",
"vitest": "2.0.5"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"compilerOptions": {
"strict": true,
"rootDir": "src",
"outDir": "dist"
"outDir": "dist",
"module": "Node16",
"moduleResolution": "Node16",
"tsBuildInfoFile": "./tsconfig.tsbuildinfo"
},
"include": ["src"],
"references": [{ "path": "../../../api" }]
Expand Down
1 change: 0 additions & 1 deletion packages/auth-providers/clerk/api/.babelrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/auth-providers/clerk/api/build.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { build } from '@redwoodjs/framework-tools'

await build()
33 changes: 25 additions & 8 deletions packages/auth-providers/clerk/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,48 @@
"directory": "packages/auth-providers/clerk/api"
},
"license": "MIT",
"type": "commonjs",
"exports": {
".": {
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./dist/decoder": {
"default": {
"types": "./dist/decoder.d.ts",
"default": "./dist/decoder.js"
}
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "yarn build:js && yarn build:types",
"build:js": "babel src -d dist --extensions \".js,.jsx,.ts,.tsx\" --copy-files --no-copy-ignored",
"build": "tsx ./build.mts && yarn build:types",
"build:pack": "yarn pack -o redwoodjs-auth-clerk-api.tgz",
"build:types": "tsc --build --verbose",
"build:types": "tsc --build --verbose ./tsconfig.json",
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
"check:attw": "yarn attw -P",
"check:package": "concurrently npm:check:attw yarn:publint",
"prepublishOnly": "NODE_ENV=production yarn build",
"test": "vitest run",
"test:watch": "vitest watch"
},
"dependencies": {
"@babel/runtime-corejs3": "7.25.0",
"@clerk/clerk-sdk-node": "4.13.21",
"core-js": "3.38.0"
"@clerk/clerk-sdk-node": "4.13.21"
},
"devDependencies": {
"@babel/cli": "7.24.8",
"@babel/core": "^7.22.20",
"@arethetypeswrong/cli": "0.15.4",
"@redwoodjs/api": "workspace:*",
"@redwoodjs/framework-tools": "workspace:*",
"@types/aws-lambda": "8.10.143",
"concurrently": "8.2.2",
"publint": "0.2.10",
"tsx": "4.17.0",
"typescript": "5.5.4",
"vitest": "2.0.5"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/auth-providers/clerk/api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"compilerOptions": {
"strict": true,
"rootDir": "src",
"outDir": "dist"
"outDir": "dist",
"module": "Node16",
"moduleResolution": "Node16",
"tsBuildInfoFile": "./tsconfig.tsbuildinfo"
},
"include": ["src"],
"references": [{ "path": "../../../api" }]
Expand Down
1 change: 0 additions & 1 deletion packages/auth-providers/dbAuth/api/.babelrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/auth-providers/dbAuth/api/build.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { build } from '@redwoodjs/framework-tools'

await build()
49 changes: 42 additions & 7 deletions packages/auth-providers/dbAuth/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,71 @@
"directory": "packages/auth-providers/dbAuth/api"
},
"license": "MIT",
"type": "commonjs",
"exports": {
".": {
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./dist/decoder": {
"default": {
"types": "./dist/decoder.d.ts",
"default": "./dist/decoder.js"
}
},
"./dist/errors": {
"default": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
}
},
"./dist/shared": {
"default": {
"types": "./dist/shared.d.ts",
"default": "./dist/shared.js"
}
},
"./dist/DbAuthHandler": {
"default": {
"types": "./dist/DbAuthHandler.d.ts",
"default": "./dist/DbAuthHandler.js"
}
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "yarn build:js && yarn build:types",
"build:js": "babel src -d dist --extensions \".js,.jsx,.ts,.tsx\" --copy-files --no-copy-ignored",
"build": "tsx ./build.mts && yarn build:types",
"build:pack": "yarn pack -o redwoodjs-auth-dbauth-api.tgz",
"build:types": "tsc --build --verbose",
"build:types": "tsc --build --verbose ./tsconfig.json",
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
"check:attw": "yarn attw -P",
"check:package": "concurrently npm:check:attw yarn:publint",
"prepublishOnly": "NODE_ENV=production yarn build",
"test": "vitest run",
"test:watch": "vitest watch"
},
"dependencies": {
"@babel/runtime-corejs3": "7.25.0",
"@redwoodjs/project-config": "workspace:*",
"base64url": "3.0.1",
"core-js": "3.38.0",
"md5": "2.3.0",
"uuid": "10.0.0"
},
"devDependencies": {
"@babel/cli": "7.24.8",
"@babel/core": "^7.22.20",
"@arethetypeswrong/cli": "0.15.4",
"@redwoodjs/api": "workspace:*",
"@redwoodjs/framework-tools": "workspace:*",
"@simplewebauthn/server": "7.4.0",
"@types/md5": "2.3.5",
"@types/uuid": "10.0.0",
"concurrently": "8.2.2",
"publint": "0.2.10",
"tsx": "4.17.0",
"typescript": "5.5.4",
"vitest": "2.0.5"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/auth-providers/dbAuth/api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"compilerOptions": {
"strict": true,
"rootDir": "src",
"outDir": "dist"
"outDir": "dist",
"module": "Node16",
"moduleResolution": "Node16",
"tsBuildInfoFile": "./tsconfig.tsbuildinfo"
},
"include": ["src"],
"references": [
Expand Down
1 change: 0 additions & 1 deletion packages/auth-providers/firebase/api/.babelrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/auth-providers/firebase/api/build.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { build } from '@redwoodjs/framework-tools'

await build()
31 changes: 24 additions & 7 deletions packages/auth-providers/firebase/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,48 @@
"directory": "packages/auth-providers/firebase/api"
},
"license": "MIT",
"type": "commonjs",
"exports": {
".": {
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./dist/decoder": {
"default": {
"types": "./dist/decoder.d.ts",
"default": "./dist/decoder.js"
}
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "yarn build:js && yarn build:types",
"build:js": "babel src -d dist --extensions \".js,.jsx,.ts,.tsx\" --copy-files --no-copy-ignored",
"build": "tsx ./build.mts && yarn build:types",
"build:pack": "yarn pack -o redwoodjs-auth-firebase-api.tgz",
"build:types": "tsc --build --verbose",
"build:types": "tsc --build --verbose ./tsconfig.json",
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
"check:attw": "yarn attw -P",
"check:package": "concurrently npm:check:attw yarn:publint",
"prepublishOnly": "NODE_ENV=production yarn build",
"test": "vitest run",
"test:watch": "vitest watch"
},
"dependencies": {
"@babel/runtime-corejs3": "7.25.0",
"core-js": "3.38.0",
"firebase-admin": "12.3.1"
},
"devDependencies": {
"@babel/cli": "7.24.8",
"@babel/core": "^7.22.20",
"@arethetypeswrong/cli": "0.15.4",
"@redwoodjs/api": "workspace:*",
"@redwoodjs/framework-tools": "workspace:*",
"@types/aws-lambda": "8.10.143",
"concurrently": "8.2.2",
"publint": "0.2.10",
"tsx": "4.17.0",
"typescript": "5.5.4",
"vitest": "2.0.5"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/auth-providers/firebase/api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"compilerOptions": {
"strict": true,
"rootDir": "src",
"outDir": "dist"
"outDir": "dist",
"module": "Node16",
"moduleResolution": "Node16",
"tsBuildInfoFile": "./tsconfig.tsbuildinfo"
},
"include": ["src"],
"references": [{ "path": "../../../api" }]
Expand Down
1 change: 0 additions & 1 deletion packages/auth-providers/netlify/api/.babelrc.js

This file was deleted.

Loading

0 comments on commit ddfb080

Please sign in to comment.