diff --git a/packages/auth-providers/auth0/web/.babelrc.js b/packages/auth-providers/auth0/web/.babelrc.js deleted file mode 100644 index 4312886a07e5..000000000000 --- a/packages/auth-providers/auth0/web/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: '../../../../babel.config.js' } diff --git a/packages/auth-providers/auth0/web/build.ts b/packages/auth-providers/auth0/web/build.ts new file mode 100644 index 000000000000..afc14135d939 --- /dev/null +++ b/packages/auth-providers/auth0/web/build.ts @@ -0,0 +1,17 @@ +import { buildCjs, buildEsm } from '@redwoodjs/framework-tools' +import { + generateTypesCjs, + generateTypesEsm, + insertCommonJsPackageJson, +} from '@redwoodjs/framework-tools/generateTypes' + +// ESM build and type generation +await buildEsm() +await generateTypesEsm() + +// CJS build, type generation, and package.json insert +await buildCjs() +await generateTypesCjs() +await insertCommonJsPackageJson({ + buildFileUrl: import.meta.url, +}) diff --git a/packages/auth-providers/auth0/web/package.json b/packages/auth-providers/auth0/web/package.json index 32120c49f3cc..78575dab93ba 100644 --- a/packages/auth-providers/auth0/web/package.json +++ b/packages/auth-providers/auth0/web/package.json @@ -7,32 +7,58 @@ "directory": "packages/auth-providers/auth0/web" }, "license": "MIT", - "main": "./dist/index.js", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "default": { + "types": "./dist/cjs/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "./dist/auth0": { + "import": { + "types": "./dist/auth0.d.ts", + "default": "./dist/auth0.js" + }, + "default": { + "types": "./dist/cjs/auth0.d.ts", + "default": "./dist/cjs/auth0.js" + } + } + }, + "main": "./dist/cjs/index.js", + "module": "./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.ts", "build:pack": "yarn pack -o redwoodjs-auth-auth0-web.tgz", - "build:types": "tsc --build --verbose", + "build:types": "tsc --build --verbose ./tsconfig.build.json", + "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json", "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"", + "check:attw": "yarn rw-fwtools-attw", + "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/auth": "workspace:*", - "core-js": "3.38.0" + "@redwoodjs/auth": "workspace:*" }, "devDependencies": { "@auth0/auth0-spa-js": "2.1.3", - "@babel/cli": "7.24.8", - "@babel/core": "^7.22.20", + "@redwoodjs/framework-tools": "workspace:*", "@types/react": "^18.2.55", + "concurrently": "8.2.2", + "publint": "0.2.10", "react": "19.0.0-rc-8269d55d-20240802", + "tsx": "4.17.0", "typescript": "5.5.4", "vitest": "2.0.5" }, diff --git a/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx b/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx index aab7df2c6836..59fde602082a 100644 --- a/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx +++ b/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx @@ -9,7 +9,7 @@ import { vi, beforeAll, beforeEach, describe, expect, it } from 'vitest' import type { CurrentUser } from '@redwoodjs/auth' -import { createAuth } from '../auth0' +import { createAuth } from '../auth0.js' const user: User = { sub: 'unique_user_id', diff --git a/packages/auth-providers/auth0/web/src/index.ts b/packages/auth-providers/auth0/web/src/index.ts index de1dfbd2d3f9..aace852c623c 100644 --- a/packages/auth-providers/auth0/web/src/index.ts +++ b/packages/auth-providers/auth0/web/src/index.ts @@ -1 +1 @@ -export { createAuth } from './auth0' +export { createAuth } from './auth0.js' diff --git a/packages/auth-providers/auth0/web/tsconfig.build.json b/packages/auth-providers/auth0/web/tsconfig.build.json new file mode 100644 index 000000000000..e7e0fedfaba0 --- /dev/null +++ b/packages/auth-providers/auth0/web/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../../tsconfig.compilerOption.json", + "compilerOptions": { + "strict": true, + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" + }, + "include": ["src"], + "references": [ + { + "path": "./../../../auth/tsconfig.build.json" + } + ] +} diff --git a/packages/auth-providers/auth0/web/tsconfig.cjs.json b/packages/auth-providers/auth0/web/tsconfig.cjs.json new file mode 100644 index 000000000000..a660cecf11ff --- /dev/null +++ b/packages/auth-providers/auth0/web/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "dist/cjs", + "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" + } +} diff --git a/packages/auth-providers/auth0/web/tsconfig.json b/packages/auth-providers/auth0/web/tsconfig.json index 6f1a0dfbbe25..a31dd6f9faaa 100644 --- a/packages/auth-providers/auth0/web/tsconfig.json +++ b/packages/auth-providers/auth0/web/tsconfig.json @@ -2,9 +2,13 @@ "extends": "../../../../tsconfig.compilerOption.json", "compilerOptions": { "strict": true, - "rootDir": "src", - "outDir": "dist" + "module": "Node16", + "moduleResolution": "Node16" }, - "include": ["src"], - "references": [{ "path": "../../../auth/tsconfig.build.json" }] + "include": ["."], + "references": [ + { "path": "../../../auth/tsconfig.build.json" }, + { "path": "../../../framework-tools" } + ], + "exclude": ["dist", "node_modules", "**/__mocks__", "**/__tests__/fixtures"] } diff --git a/packages/auth-providers/azureActiveDirectory/web/.babelrc.js b/packages/auth-providers/azureActiveDirectory/web/.babelrc.js deleted file mode 100644 index 4312886a07e5..000000000000 --- a/packages/auth-providers/azureActiveDirectory/web/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: '../../../../babel.config.js' } diff --git a/packages/auth-providers/azureActiveDirectory/web/build.ts b/packages/auth-providers/azureActiveDirectory/web/build.ts new file mode 100644 index 000000000000..afc14135d939 --- /dev/null +++ b/packages/auth-providers/azureActiveDirectory/web/build.ts @@ -0,0 +1,17 @@ +import { buildCjs, buildEsm } from '@redwoodjs/framework-tools' +import { + generateTypesCjs, + generateTypesEsm, + insertCommonJsPackageJson, +} from '@redwoodjs/framework-tools/generateTypes' + +// ESM build and type generation +await buildEsm() +await generateTypesEsm() + +// CJS build, type generation, and package.json insert +await buildCjs() +await generateTypesCjs() +await insertCommonJsPackageJson({ + buildFileUrl: import.meta.url, +}) diff --git a/packages/auth-providers/azureActiveDirectory/web/package.json b/packages/auth-providers/azureActiveDirectory/web/package.json index 907854a967c7..45e19ab48e61 100644 --- a/packages/auth-providers/azureActiveDirectory/web/package.json +++ b/packages/auth-providers/azureActiveDirectory/web/package.json @@ -7,33 +7,59 @@ "directory": "packages/auth-providers/azureActiveDirectory/web" }, "license": "MIT", - "main": "./dist/index.js", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "default": { + "types": "./dist/cjs/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "./dist/azureActiveDirectory": { + "import": { + "types": "./dist/azureActiveDirectory.d.ts", + "default": "./dist/azureActiveDirectory.js" + }, + "default": { + "types": "./dist/cjs/azureActiveDirectory.d.ts", + "default": "./dist/cjs/azureActiveDirectory.js" + } + } + }, + "main": "./dist/cjs/index.js", + "module": "./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.ts", "build:pack": "yarn pack -o redwoodjs-auth-azure-active-directory-web.tgz", - "build:types": "tsc --build --verbose", + "build:types": "tsc --build --verbose ./tsconfig.build.json", + "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json", "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"", + "check:attw": "yarn rw-fwtools-attw", + "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/auth": "workspace:*", - "core-js": "3.38.0" + "@redwoodjs/auth": "workspace:*" }, "devDependencies": { "@azure/msal-browser": "2.39.0", - "@babel/cli": "7.24.8", - "@babel/core": "^7.22.20", + "@redwoodjs/framework-tools": "workspace:*", "@types/netlify-identity-widget": "1.9.6", "@types/react": "^18.2.55", + "concurrently": "8.2.2", + "publint": "0.2.10", "react": "19.0.0-rc-8269d55d-20240802", + "tsx": "4.17.0", "typescript": "5.5.4", "vitest": "2.0.5" }, diff --git a/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx b/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx index adc839800bb4..6f41501c0993 100644 --- a/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx +++ b/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx @@ -8,7 +8,7 @@ import { vi, it, expect, describe, beforeAll, beforeEach } from 'vitest' import type { CurrentUser } from '@redwoodjs/auth' -import { createAuth } from '../azureActiveDirectory' +import { createAuth } from '../azureActiveDirectory.js' const user: AccountInfo = { name: 'John', diff --git a/packages/auth-providers/azureActiveDirectory/web/src/index.ts b/packages/auth-providers/azureActiveDirectory/web/src/index.ts index 3c947e8dd6ba..fb6a6d420727 100644 --- a/packages/auth-providers/azureActiveDirectory/web/src/index.ts +++ b/packages/auth-providers/azureActiveDirectory/web/src/index.ts @@ -1 +1 @@ -export { createAuth } from './azureActiveDirectory' +export { createAuth } from './azureActiveDirectory.js' diff --git a/packages/auth-providers/azureActiveDirectory/web/tsconfig.build.json b/packages/auth-providers/azureActiveDirectory/web/tsconfig.build.json new file mode 100644 index 000000000000..e7e0fedfaba0 --- /dev/null +++ b/packages/auth-providers/azureActiveDirectory/web/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../../tsconfig.compilerOption.json", + "compilerOptions": { + "strict": true, + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" + }, + "include": ["src"], + "references": [ + { + "path": "./../../../auth/tsconfig.build.json" + } + ] +} diff --git a/packages/auth-providers/azureActiveDirectory/web/tsconfig.cjs.json b/packages/auth-providers/azureActiveDirectory/web/tsconfig.cjs.json new file mode 100644 index 000000000000..a660cecf11ff --- /dev/null +++ b/packages/auth-providers/azureActiveDirectory/web/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "dist/cjs", + "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" + } +} diff --git a/packages/auth-providers/azureActiveDirectory/web/tsconfig.json b/packages/auth-providers/azureActiveDirectory/web/tsconfig.json index 6f1a0dfbbe25..189511d06433 100644 --- a/packages/auth-providers/azureActiveDirectory/web/tsconfig.json +++ b/packages/auth-providers/azureActiveDirectory/web/tsconfig.json @@ -2,9 +2,12 @@ "extends": "../../../../tsconfig.compilerOption.json", "compilerOptions": { "strict": true, - "rootDir": "src", - "outDir": "dist" + "module": "Node16", + "moduleResolution": "Node16" }, - "include": ["src"], - "references": [{ "path": "../../../auth/tsconfig.build.json" }] + "include": ["."], + "references": [ + { "path": "../../../auth/tsconfig.build.json" }, + { "path": "../../../framework-tools" } + ] } diff --git a/packages/auth-providers/clerk/web/.babelrc.js b/packages/auth-providers/clerk/web/.babelrc.js deleted file mode 100644 index 4312886a07e5..000000000000 --- a/packages/auth-providers/clerk/web/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: '../../../../babel.config.js' } diff --git a/packages/auth-providers/clerk/web/build.ts b/packages/auth-providers/clerk/web/build.ts new file mode 100644 index 000000000000..afc14135d939 --- /dev/null +++ b/packages/auth-providers/clerk/web/build.ts @@ -0,0 +1,17 @@ +import { buildCjs, buildEsm } from '@redwoodjs/framework-tools' +import { + generateTypesCjs, + generateTypesEsm, + insertCommonJsPackageJson, +} from '@redwoodjs/framework-tools/generateTypes' + +// ESM build and type generation +await buildEsm() +await generateTypesEsm() + +// CJS build, type generation, and package.json insert +await buildCjs() +await generateTypesCjs() +await insertCommonJsPackageJson({ + buildFileUrl: import.meta.url, +}) diff --git a/packages/auth-providers/clerk/web/package.json b/packages/auth-providers/clerk/web/package.json index 9d3350f1a98c..bd9dd4546fc4 100644 --- a/packages/auth-providers/clerk/web/package.json +++ b/packages/auth-providers/clerk/web/package.json @@ -7,33 +7,59 @@ "directory": "packages/auth-providers/clerk/web" }, "license": "MIT", - "main": "./dist/index.js", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "default": { + "types": "./dist/cjs/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "./dist/clerk": { + "import": { + "types": "./dist/clerk.d.ts", + "default": "./dist/clerk.js" + }, + "default": { + "types": "./dist/cjs/clerk.d.ts", + "default": "./dist/cjs/clerk.js" + } + } + }, + "main": "./dist/cjs/index.js", + "module": "./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.ts", "build:pack": "yarn pack -o redwoodjs-auth-clerk-web.tgz", - "build:types": "tsc --build --verbose", + "build:types": "tsc --build --verbose ./tsconfig.build.json", + "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json", "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"", + "check:attw": "yarn rw-fwtools-attw", + "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/auth": "workspace:*", - "core-js": "3.38.0" + "@redwoodjs/auth": "workspace:*" }, "devDependencies": { - "@babel/cli": "7.24.8", - "@babel/core": "^7.22.20", "@clerk/clerk-react": "4.32.3", "@clerk/types": "3.65.3", + "@redwoodjs/framework-tools": "workspace:*", "@types/react": "^18.2.55", + "concurrently": "8.2.2", + "publint": "0.2.10", "react": "19.0.0-rc-8269d55d-20240802", + "tsx": "4.17.0", "typescript": "5.5.4", "vitest": "2.0.5" }, diff --git a/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx b/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx index 7a5334f5d82a..15018407810d 100644 --- a/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx +++ b/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx @@ -9,7 +9,7 @@ import { vi, expect, describe, it, beforeAll, beforeEach } from 'vitest' import type { CurrentUser } from '@redwoodjs/auth' -import { createAuth } from '../clerk' +import { createAuth } from '../clerk.js' const user: Partial = { id: 'unique_user_id', diff --git a/packages/auth-providers/clerk/web/src/index.ts b/packages/auth-providers/clerk/web/src/index.ts index c3bddea6584a..b232033b05fd 100644 --- a/packages/auth-providers/clerk/web/src/index.ts +++ b/packages/auth-providers/clerk/web/src/index.ts @@ -1 +1 @@ -export { createAuth } from './clerk' +export { createAuth } from './clerk.js' diff --git a/packages/auth-providers/clerk/web/tsconfig.build.json b/packages/auth-providers/clerk/web/tsconfig.build.json new file mode 100644 index 000000000000..e7e0fedfaba0 --- /dev/null +++ b/packages/auth-providers/clerk/web/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../../tsconfig.compilerOption.json", + "compilerOptions": { + "strict": true, + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" + }, + "include": ["src"], + "references": [ + { + "path": "./../../../auth/tsconfig.build.json" + } + ] +} diff --git a/packages/auth-providers/clerk/web/tsconfig.cjs.json b/packages/auth-providers/clerk/web/tsconfig.cjs.json new file mode 100644 index 000000000000..a660cecf11ff --- /dev/null +++ b/packages/auth-providers/clerk/web/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "dist/cjs", + "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" + } +} diff --git a/packages/auth-providers/clerk/web/tsconfig.json b/packages/auth-providers/clerk/web/tsconfig.json index 6f1a0dfbbe25..a31dd6f9faaa 100644 --- a/packages/auth-providers/clerk/web/tsconfig.json +++ b/packages/auth-providers/clerk/web/tsconfig.json @@ -2,9 +2,13 @@ "extends": "../../../../tsconfig.compilerOption.json", "compilerOptions": { "strict": true, - "rootDir": "src", - "outDir": "dist" + "module": "Node16", + "moduleResolution": "Node16" }, - "include": ["src"], - "references": [{ "path": "../../../auth/tsconfig.build.json" }] + "include": ["."], + "references": [ + { "path": "../../../auth/tsconfig.build.json" }, + { "path": "../../../framework-tools" } + ], + "exclude": ["dist", "node_modules", "**/__mocks__", "**/__tests__/fixtures"] } diff --git a/packages/auth-providers/netlify/web/.babelrc.js b/packages/auth-providers/netlify/web/.babelrc.js deleted file mode 100644 index 4312886a07e5..000000000000 --- a/packages/auth-providers/netlify/web/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: '../../../../babel.config.js' } diff --git a/packages/auth-providers/netlify/web/build.ts b/packages/auth-providers/netlify/web/build.ts new file mode 100644 index 000000000000..afc14135d939 --- /dev/null +++ b/packages/auth-providers/netlify/web/build.ts @@ -0,0 +1,17 @@ +import { buildCjs, buildEsm } from '@redwoodjs/framework-tools' +import { + generateTypesCjs, + generateTypesEsm, + insertCommonJsPackageJson, +} from '@redwoodjs/framework-tools/generateTypes' + +// ESM build and type generation +await buildEsm() +await generateTypesEsm() + +// CJS build, type generation, and package.json insert +await buildCjs() +await generateTypesCjs() +await insertCommonJsPackageJson({ + buildFileUrl: import.meta.url, +}) diff --git a/packages/auth-providers/netlify/web/package.json b/packages/auth-providers/netlify/web/package.json index 224050bb1044..cf737416a6ee 100644 --- a/packages/auth-providers/netlify/web/package.json +++ b/packages/auth-providers/netlify/web/package.json @@ -7,32 +7,58 @@ "directory": "packages/auth-providers/netlify/web" }, "license": "MIT", - "main": "./dist/index.js", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "default": { + "types": "./dist/cjs/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "./dist/netlify": { + "import": { + "types": "./dist/netlify.d.ts", + "default": "./dist/netlify.js" + }, + "default": { + "types": "./dist/cjs/netlify.d.ts", + "default": "./dist/cjs/netlify.js" + } + } + }, + "main": "./dist/cjs/index.js", + "module": "./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.ts", "build:pack": "yarn pack -o redwoodjs-auth-netlify-web.tgz", - "build:types": "tsc --build --verbose", + "build:types": "tsc --build --verbose ./tsconfig.build.json", + "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json", "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"", + "check:attw": "yarn rw-fwtools-attw", + "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/auth": "workspace:*", - "core-js": "3.38.0" + "@redwoodjs/auth": "workspace:*" }, "devDependencies": { - "@babel/cli": "7.24.8", - "@babel/core": "^7.22.20", + "@redwoodjs/framework-tools": "workspace:*", "@types/netlify-identity-widget": "1.9.6", "@types/react": "^18.2.55", + "concurrently": "8.2.2", + "publint": "0.2.10", "react": "19.0.0-rc-8269d55d-20240802", + "tsx": "4.17.0", "typescript": "5.5.4", "vitest": "2.0.5" }, diff --git a/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx b/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx index 611e3a3543e2..c5b12ebc5a60 100644 --- a/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx +++ b/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx @@ -4,7 +4,7 @@ import { vi, expect, it, beforeAll, beforeEach, describe } from 'vitest' import type { CurrentUser } from '@redwoodjs/auth' -import { createAuth } from '../netlify' +import { createAuth } from '../netlify.js' type NetlifyIdentity = typeof NetlifyIdentityNS type User = NetlifyIdentityNS.User diff --git a/packages/auth-providers/netlify/web/src/index.ts b/packages/auth-providers/netlify/web/src/index.ts index ff6d45586e48..de207efcdd47 100644 --- a/packages/auth-providers/netlify/web/src/index.ts +++ b/packages/auth-providers/netlify/web/src/index.ts @@ -1 +1 @@ -export { createAuth } from './netlify' +export { createAuth } from './netlify.js' diff --git a/packages/auth-providers/netlify/web/tsconfig.build.json b/packages/auth-providers/netlify/web/tsconfig.build.json new file mode 100644 index 000000000000..e7e0fedfaba0 --- /dev/null +++ b/packages/auth-providers/netlify/web/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../../tsconfig.compilerOption.json", + "compilerOptions": { + "strict": true, + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" + }, + "include": ["src"], + "references": [ + { + "path": "./../../../auth/tsconfig.build.json" + } + ] +} diff --git a/packages/auth-providers/netlify/web/tsconfig.cjs.json b/packages/auth-providers/netlify/web/tsconfig.cjs.json new file mode 100644 index 000000000000..a660cecf11ff --- /dev/null +++ b/packages/auth-providers/netlify/web/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "dist/cjs", + "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" + } +} diff --git a/packages/auth-providers/netlify/web/tsconfig.json b/packages/auth-providers/netlify/web/tsconfig.json index 6f1a0dfbbe25..a31dd6f9faaa 100644 --- a/packages/auth-providers/netlify/web/tsconfig.json +++ b/packages/auth-providers/netlify/web/tsconfig.json @@ -2,9 +2,13 @@ "extends": "../../../../tsconfig.compilerOption.json", "compilerOptions": { "strict": true, - "rootDir": "src", - "outDir": "dist" + "module": "Node16", + "moduleResolution": "Node16" }, - "include": ["src"], - "references": [{ "path": "../../../auth/tsconfig.build.json" }] + "include": ["."], + "references": [ + { "path": "../../../auth/tsconfig.build.json" }, + { "path": "../../../framework-tools" } + ], + "exclude": ["dist", "node_modules", "**/__mocks__", "**/__tests__/fixtures"] } diff --git a/packages/auth-providers/supabase/web/.babelrc.js b/packages/auth-providers/supabase/web/.babelrc.js deleted file mode 100644 index 4312886a07e5..000000000000 --- a/packages/auth-providers/supabase/web/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: '../../../../babel.config.js' } diff --git a/packages/auth-providers/supabase/web/build.ts b/packages/auth-providers/supabase/web/build.ts new file mode 100644 index 000000000000..afc14135d939 --- /dev/null +++ b/packages/auth-providers/supabase/web/build.ts @@ -0,0 +1,17 @@ +import { buildCjs, buildEsm } from '@redwoodjs/framework-tools' +import { + generateTypesCjs, + generateTypesEsm, + insertCommonJsPackageJson, +} from '@redwoodjs/framework-tools/generateTypes' + +// ESM build and type generation +await buildEsm() +await generateTypesEsm() + +// CJS build, type generation, and package.json insert +await buildCjs() +await generateTypesCjs() +await insertCommonJsPackageJson({ + buildFileUrl: import.meta.url, +}) diff --git a/packages/auth-providers/supabase/web/package.json b/packages/auth-providers/supabase/web/package.json index 05891bb87721..652d89e05b53 100644 --- a/packages/auth-providers/supabase/web/package.json +++ b/packages/auth-providers/supabase/web/package.json @@ -7,33 +7,59 @@ "directory": "packages/auth-providers/supabase/web" }, "license": "MIT", - "main": "./dist/index.js", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "default": { + "types": "./dist/cjs/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "./dist/supabase": { + "import": { + "types": "./dist/supabase.d.ts", + "default": "./dist/supabase.js" + }, + "default": { + "types": "./dist/cjs/supabase.d.ts", + "default": "./dist/cjs/supabase.js" + } + } + }, + "main": "./dist/cjs/index.js", + "module": "./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.ts", "build:pack": "yarn pack -o redwoodjs-auth-supabase-web.tgz", - "build:types": "tsc --build --verbose", + "build:types": "tsc --build --verbose ./tsconfig.build.json", + "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json", "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"", + "check:attw": "yarn rw-fwtools-attw", + "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/auth": "workspace:*", - "core-js": "3.38.0" + "@redwoodjs/auth": "workspace:*" }, "devDependencies": { - "@babel/cli": "7.24.8", - "@babel/core": "^7.22.20", + "@redwoodjs/framework-tools": "workspace:*", "@supabase/ssr": "0.4.0", "@supabase/supabase-js": "2.45.1", "@types/react": "^18.2.55", + "concurrently": "8.2.2", + "publint": "0.2.10", "react": "19.0.0-rc-8269d55d-20240802", + "tsx": "4.17.0", "typescript": "5.5.4", "vitest": "2.0.5" }, diff --git a/packages/auth-providers/supabase/web/src/__tests__/supabase.middleware.test.tsx b/packages/auth-providers/supabase/web/src/__tests__/supabase.middleware.test.tsx index 4bb7cc617f35..e9cebc220e2c 100644 --- a/packages/auth-providers/supabase/web/src/__tests__/supabase.middleware.test.tsx +++ b/packages/auth-providers/supabase/web/src/__tests__/supabase.middleware.test.tsx @@ -5,13 +5,13 @@ import { vi, it, describe, beforeAll, beforeEach, expect } from 'vitest' import type { CurrentUser } from '@redwoodjs/auth' -import { createAuth } from '../supabase' +import { createAuth } from '../supabase.js' import { mockSupabaseAuthClient, loggedInUser, adminUser, -} from './mockSupabaseAuthClient' +} from './mockSupabaseAuthClient.js' const supabaseMockClient = { auth: mockSupabaseAuthClient, diff --git a/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx b/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx index bedae632e3b3..b2b1ebcacadc 100644 --- a/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx +++ b/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx @@ -4,13 +4,13 @@ import { vi, it, describe, beforeAll, beforeEach, expect } from 'vitest' import type { CurrentUser } from '@redwoodjs/auth' -import { createAuth } from '../supabase' +import { createAuth } from '../supabase.js' import { mockSupabaseAuthClient, loggedInUser, adminUser, -} from './mockSupabaseAuthClient' +} from './mockSupabaseAuthClient.js' const supabaseMockClient = { auth: mockSupabaseAuthClient, diff --git a/packages/auth-providers/supabase/web/src/index.ts b/packages/auth-providers/supabase/web/src/index.ts index 3c69819e3661..ce5f8bbbabc5 100644 --- a/packages/auth-providers/supabase/web/src/index.ts +++ b/packages/auth-providers/supabase/web/src/index.ts @@ -1 +1 @@ -export { createAuth } from './supabase' +export { createAuth } from './supabase.js' diff --git a/packages/auth-providers/supabase/web/tsconfig.build.json b/packages/auth-providers/supabase/web/tsconfig.build.json new file mode 100644 index 000000000000..f6d6e2f70d82 --- /dev/null +++ b/packages/auth-providers/supabase/web/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../../tsconfig.compilerOption.json", + "compilerOptions": { + "strict": true, + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" + }, + "include": ["src", "./ambient.d.ts"], + "references": [ + { + "path": "./../../../auth/tsconfig.build.json" + } + ] +} diff --git a/packages/auth-providers/supabase/web/tsconfig.cjs.json b/packages/auth-providers/supabase/web/tsconfig.cjs.json new file mode 100644 index 000000000000..a660cecf11ff --- /dev/null +++ b/packages/auth-providers/supabase/web/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "dist/cjs", + "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" + } +} diff --git a/packages/auth-providers/supabase/web/tsconfig.json b/packages/auth-providers/supabase/web/tsconfig.json index 44a4bf6185e8..a31dd6f9faaa 100644 --- a/packages/auth-providers/supabase/web/tsconfig.json +++ b/packages/auth-providers/supabase/web/tsconfig.json @@ -2,9 +2,13 @@ "extends": "../../../../tsconfig.compilerOption.json", "compilerOptions": { "strict": true, - "rootDir": "src", - "outDir": "dist" + "module": "Node16", + "moduleResolution": "Node16" }, - "include": ["src", "./ambient.d.ts"], - "references": [{ "path": "../../../auth/tsconfig.build.json" }] + "include": ["."], + "references": [ + { "path": "../../../auth/tsconfig.build.json" }, + { "path": "../../../framework-tools" } + ], + "exclude": ["dist", "node_modules", "**/__mocks__", "**/__tests__/fixtures"] } diff --git a/packages/auth-providers/supertokens/web/.babelrc.js b/packages/auth-providers/supertokens/web/.babelrc.js deleted file mode 100644 index 4312886a07e5..000000000000 --- a/packages/auth-providers/supertokens/web/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: '../../../../babel.config.js' } diff --git a/packages/auth-providers/supertokens/web/build.ts b/packages/auth-providers/supertokens/web/build.ts new file mode 100644 index 000000000000..afc14135d939 --- /dev/null +++ b/packages/auth-providers/supertokens/web/build.ts @@ -0,0 +1,17 @@ +import { buildCjs, buildEsm } from '@redwoodjs/framework-tools' +import { + generateTypesCjs, + generateTypesEsm, + insertCommonJsPackageJson, +} from '@redwoodjs/framework-tools/generateTypes' + +// ESM build and type generation +await buildEsm() +await generateTypesEsm() + +// CJS build, type generation, and package.json insert +await buildCjs() +await generateTypesCjs() +await insertCommonJsPackageJson({ + buildFileUrl: import.meta.url, +}) diff --git a/packages/auth-providers/supertokens/web/package.json b/packages/auth-providers/supertokens/web/package.json index 91d4a5d1781c..86626b8cb3e4 100644 --- a/packages/auth-providers/supertokens/web/package.json +++ b/packages/auth-providers/supertokens/web/package.json @@ -7,32 +7,58 @@ "directory": "packages/auth-providers/supertokens/web" }, "license": "MIT", - "main": "./dist/index.js", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "default": { + "types": "./dist/cjs/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "./dist/supertokens": { + "import": { + "types": "./dist/supertokens.d.ts", + "default": "./dist/supertokens.js" + }, + "default": { + "types": "./dist/cjs/supertokens.d.ts", + "default": "./dist/cjs/supertokens.js" + } + } + }, + "main": "./dist/cjs/index.js", + "module": "./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.ts", "build:pack": "yarn pack -o redwoodjs-auth-supertokens-web.tgz", - "build:types": "tsc --build --verbose", + "build:types": "tsc --build --verbose ./tsconfig.build.json", + "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json", "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"", + "check:attw": "yarn rw-fwtools-attw", + "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/auth": "workspace:*", - "core-js": "3.38.0" + "@redwoodjs/auth": "workspace:*" }, "devDependencies": { - "@babel/cli": "7.24.8", - "@babel/core": "^7.22.20", + "@redwoodjs/framework-tools": "workspace:*", "@types/react": "^18.2.55", + "concurrently": "8.2.2", + "publint": "0.2.10", "react": "19.0.0-rc-8269d55d-20240802", "supertokens-auth-react": "0.39.1", + "tsx": "4.17.0", "typescript": "5.5.4", "vitest": "2.0.5" }, diff --git a/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx b/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx index 556f0ed3ddf9..5e6e3cde43b0 100644 --- a/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx +++ b/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx @@ -7,8 +7,8 @@ import type { SuperTokensUser, SessionRecipe, SuperTokensAuth, -} from '../supertokens' -import { createAuth } from '../supertokens' +} from '../supertokens.js' +import { createAuth } from '../supertokens.js' const user: SuperTokensUser = { userId: 'unique_user_id', diff --git a/packages/auth-providers/supertokens/web/src/index.ts b/packages/auth-providers/supertokens/web/src/index.ts index f38ac2769dac..2fb39f5ed586 100644 --- a/packages/auth-providers/supertokens/web/src/index.ts +++ b/packages/auth-providers/supertokens/web/src/index.ts @@ -1 +1 @@ -export { createAuth } from './supertokens' +export { createAuth } from './supertokens.js' diff --git a/packages/auth-providers/supertokens/web/tsconfig.build.json b/packages/auth-providers/supertokens/web/tsconfig.build.json new file mode 100644 index 000000000000..e7e0fedfaba0 --- /dev/null +++ b/packages/auth-providers/supertokens/web/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../../tsconfig.compilerOption.json", + "compilerOptions": { + "strict": true, + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" + }, + "include": ["src"], + "references": [ + { + "path": "./../../../auth/tsconfig.build.json" + } + ] +} diff --git a/packages/auth-providers/supertokens/web/tsconfig.cjs.json b/packages/auth-providers/supertokens/web/tsconfig.cjs.json new file mode 100644 index 000000000000..a660cecf11ff --- /dev/null +++ b/packages/auth-providers/supertokens/web/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "dist/cjs", + "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" + } +} diff --git a/packages/auth-providers/supertokens/web/tsconfig.json b/packages/auth-providers/supertokens/web/tsconfig.json index 6f1a0dfbbe25..a31dd6f9faaa 100644 --- a/packages/auth-providers/supertokens/web/tsconfig.json +++ b/packages/auth-providers/supertokens/web/tsconfig.json @@ -2,9 +2,13 @@ "extends": "../../../../tsconfig.compilerOption.json", "compilerOptions": { "strict": true, - "rootDir": "src", - "outDir": "dist" + "module": "Node16", + "moduleResolution": "Node16" }, - "include": ["src"], - "references": [{ "path": "../../../auth/tsconfig.build.json" }] + "include": ["."], + "references": [ + { "path": "../../../auth/tsconfig.build.json" }, + { "path": "../../../framework-tools" } + ], + "exclude": ["dist", "node_modules", "**/__mocks__", "**/__tests__/fixtures"] } diff --git a/yarn.lock b/yarn.lock index c5869a544c8d..8eb78a224489 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7345,13 +7345,13 @@ __metadata: resolution: "@redwoodjs/auth-auth0-web@workspace:packages/auth-providers/auth0/web" dependencies: "@auth0/auth0-spa-js": "npm:2.1.3" - "@babel/cli": "npm:7.24.8" - "@babel/core": "npm:^7.22.20" - "@babel/runtime-corejs3": "npm:7.25.0" "@redwoodjs/auth": "workspace:*" + "@redwoodjs/framework-tools": "workspace:*" "@types/react": "npm:^18.2.55" - core-js: "npm:3.38.0" + concurrently: "npm:8.2.2" + publint: "npm:0.2.10" react: "npm:19.0.0-rc-8269d55d-20240802" + tsx: "npm:4.17.0" typescript: "npm:5.5.4" vitest: "npm:2.0.5" peerDependencies: @@ -7399,14 +7399,14 @@ __metadata: resolution: "@redwoodjs/auth-azure-active-directory-web@workspace:packages/auth-providers/azureActiveDirectory/web" dependencies: "@azure/msal-browser": "npm:2.39.0" - "@babel/cli": "npm:7.24.8" - "@babel/core": "npm:^7.22.20" - "@babel/runtime-corejs3": "npm:7.25.0" "@redwoodjs/auth": "workspace:*" + "@redwoodjs/framework-tools": "workspace:*" "@types/netlify-identity-widget": "npm:1.9.6" "@types/react": "npm:^18.2.55" - core-js: "npm:3.38.0" + concurrently: "npm:8.2.2" + publint: "npm:0.2.10" react: "npm:19.0.0-rc-8269d55d-20240802" + tsx: "npm:4.17.0" typescript: "npm:5.5.4" vitest: "npm:2.0.5" peerDependencies: @@ -7450,15 +7450,15 @@ __metadata: version: 0.0.0-use.local resolution: "@redwoodjs/auth-clerk-web@workspace:packages/auth-providers/clerk/web" dependencies: - "@babel/cli": "npm:7.24.8" - "@babel/core": "npm:^7.22.20" - "@babel/runtime-corejs3": "npm:7.25.0" "@clerk/clerk-react": "npm:4.32.3" "@clerk/types": "npm:3.65.3" "@redwoodjs/auth": "workspace:*" + "@redwoodjs/framework-tools": "workspace:*" "@types/react": "npm:^18.2.55" - core-js: "npm:3.38.0" + concurrently: "npm:8.2.2" + publint: "npm:0.2.10" react: "npm:19.0.0-rc-8269d55d-20240802" + tsx: "npm:4.17.0" typescript: "npm:5.5.4" vitest: "npm:2.0.5" peerDependencies: @@ -7655,14 +7655,14 @@ __metadata: version: 0.0.0-use.local resolution: "@redwoodjs/auth-netlify-web@workspace:packages/auth-providers/netlify/web" dependencies: - "@babel/cli": "npm:7.24.8" - "@babel/core": "npm:^7.22.20" - "@babel/runtime-corejs3": "npm:7.25.0" "@redwoodjs/auth": "workspace:*" + "@redwoodjs/framework-tools": "workspace:*" "@types/netlify-identity-widget": "npm:1.9.6" "@types/react": "npm:^18.2.55" - core-js: "npm:3.38.0" + concurrently: "npm:8.2.2" + publint: "npm:0.2.10" react: "npm:19.0.0-rc-8269d55d-20240802" + tsx: "npm:4.17.0" typescript: "npm:5.5.4" vitest: "npm:2.0.5" peerDependencies: @@ -7730,15 +7730,15 @@ __metadata: version: 0.0.0-use.local resolution: "@redwoodjs/auth-supabase-web@workspace:packages/auth-providers/supabase/web" dependencies: - "@babel/cli": "npm:7.24.8" - "@babel/core": "npm:^7.22.20" - "@babel/runtime-corejs3": "npm:7.25.0" "@redwoodjs/auth": "workspace:*" + "@redwoodjs/framework-tools": "workspace:*" "@supabase/ssr": "npm:0.4.0" "@supabase/supabase-js": "npm:2.45.1" "@types/react": "npm:^18.2.55" - core-js: "npm:3.38.0" + concurrently: "npm:8.2.2" + publint: "npm:0.2.10" react: "npm:19.0.0-rc-8269d55d-20240802" + tsx: "npm:4.17.0" typescript: "npm:5.5.4" vitest: "npm:2.0.5" peerDependencies: @@ -7787,14 +7787,14 @@ __metadata: version: 0.0.0-use.local resolution: "@redwoodjs/auth-supertokens-web@workspace:packages/auth-providers/supertokens/web" dependencies: - "@babel/cli": "npm:7.24.8" - "@babel/core": "npm:^7.22.20" - "@babel/runtime-corejs3": "npm:7.25.0" "@redwoodjs/auth": "workspace:*" + "@redwoodjs/framework-tools": "workspace:*" "@types/react": "npm:^18.2.55" - core-js: "npm:3.38.0" + concurrently: "npm:8.2.2" + publint: "npm:0.2.10" react: "npm:19.0.0-rc-8269d55d-20240802" supertokens-auth-react: "npm:0.39.1" + tsx: "npm:4.17.0" typescript: "npm:5.5.4" vitest: "npm:2.0.5" peerDependencies: