From 5a68ed4bbf947d740cdf8b11c2700674de16a23f Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Tue, 20 Aug 2024 10:41:32 +0200 Subject: [PATCH 1/3] chore(build): Move more repetitive code into framework-tools --- .../dbAuth/middleware/build.mts | 21 ++-------- .../dbAuth/middleware/tsconfig.build.json | 16 +++++++ .../dbAuth/middleware/tsconfig.json | 7 ++-- .../supabase/middleware/build.mts | 21 ++-------- .../supabase/middleware/tsconfig.build.json | 16 +++++++ .../supabase/middleware/tsconfig.json | 7 ++-- packages/context/build.mts | 19 ++------- packages/context/tsconfig.build.json | 11 +++++ packages/context/tsconfig.json | 8 ++-- packages/framework-tools/src/buildDefaults.ts | 42 +++++++++++++++++++ packages/framework-tools/src/generateTypes.ts | 21 ++++++---- packages/graphql-server/tsconfig.json | 5 ++- packages/router/build.ts | 23 ++-------- 13 files changed, 128 insertions(+), 89 deletions(-) create mode 100644 packages/auth-providers/dbAuth/middleware/tsconfig.build.json create mode 100644 packages/auth-providers/supabase/middleware/tsconfig.build.json create mode 100644 packages/context/tsconfig.build.json diff --git a/packages/auth-providers/dbAuth/middleware/build.mts b/packages/auth-providers/dbAuth/middleware/build.mts index f21a64f67a07..bcf958474246 100644 --- a/packages/auth-providers/dbAuth/middleware/build.mts +++ b/packages/auth-providers/dbAuth/middleware/build.mts @@ -1,29 +1,16 @@ -import { build, defaultBuildOptions } from '@redwoodjs/framework-tools' +import { buildExternalCjs, buildExternalEsm } from '@redwoodjs/framework-tools' import { generateTypesCjs, generateTypesEsm, insertCommonJsPackageJson, } from '@redwoodjs/framework-tools/generateTypes' -// ESM build -await build({ - buildOptions: { - ...defaultBuildOptions, - format: 'esm', - packages: 'external', - }, -}) +await buildExternalEsm() await generateTypesEsm() -// CJS build -await build({ - buildOptions: { - ...defaultBuildOptions, - outdir: 'dist/cjs', - packages: 'external', - }, -}) +await buildExternalCjs() await generateTypesCjs() + await insertCommonJsPackageJson({ buildFileUrl: import.meta.url, cjsDir: 'dist/cjs', diff --git a/packages/auth-providers/dbAuth/middleware/tsconfig.build.json b/packages/auth-providers/dbAuth/middleware/tsconfig.build.json new file mode 100644 index 000000000000..2d457ccfb155 --- /dev/null +++ b/packages/auth-providers/dbAuth/middleware/tsconfig.build.json @@ -0,0 +1,16 @@ +{ + "extends": "../../../../tsconfig.compilerOption.json", + "compilerOptions": { + "strict": true, + "rootDir": "src", + "outDir": "dist", + "module": "Node16", + "moduleResolution": "Node16", + "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + }, + "include": ["src/**/*"], + "references": [ + { "path": "../../../auth/tsconfig.build.json" }, + { "path": "../../../vite/tsconfig.build.json" } + ] +} diff --git a/packages/auth-providers/dbAuth/middleware/tsconfig.json b/packages/auth-providers/dbAuth/middleware/tsconfig.json index 2d457ccfb155..a9e9ebdd342f 100644 --- a/packages/auth-providers/dbAuth/middleware/tsconfig.json +++ b/packages/auth-providers/dbAuth/middleware/tsconfig.json @@ -2,13 +2,12 @@ "extends": "../../../../tsconfig.compilerOption.json", "compilerOptions": { "strict": true, - "rootDir": "src", "outDir": "dist", "module": "Node16", - "moduleResolution": "Node16", - "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + "moduleResolution": "Node16" }, - "include": ["src/**/*"], + "include": ["."], + "exclude": ["dist", "node_modules", "**/__mocks__", "**/__fixtures__"], "references": [ { "path": "../../../auth/tsconfig.build.json" }, { "path": "../../../vite/tsconfig.build.json" } diff --git a/packages/auth-providers/supabase/middleware/build.mts b/packages/auth-providers/supabase/middleware/build.mts index f21a64f67a07..bcf958474246 100644 --- a/packages/auth-providers/supabase/middleware/build.mts +++ b/packages/auth-providers/supabase/middleware/build.mts @@ -1,29 +1,16 @@ -import { build, defaultBuildOptions } from '@redwoodjs/framework-tools' +import { buildExternalCjs, buildExternalEsm } from '@redwoodjs/framework-tools' import { generateTypesCjs, generateTypesEsm, insertCommonJsPackageJson, } from '@redwoodjs/framework-tools/generateTypes' -// ESM build -await build({ - buildOptions: { - ...defaultBuildOptions, - format: 'esm', - packages: 'external', - }, -}) +await buildExternalEsm() await generateTypesEsm() -// CJS build -await build({ - buildOptions: { - ...defaultBuildOptions, - outdir: 'dist/cjs', - packages: 'external', - }, -}) +await buildExternalCjs() await generateTypesCjs() + await insertCommonJsPackageJson({ buildFileUrl: import.meta.url, cjsDir: 'dist/cjs', diff --git a/packages/auth-providers/supabase/middleware/tsconfig.build.json b/packages/auth-providers/supabase/middleware/tsconfig.build.json new file mode 100644 index 000000000000..2d457ccfb155 --- /dev/null +++ b/packages/auth-providers/supabase/middleware/tsconfig.build.json @@ -0,0 +1,16 @@ +{ + "extends": "../../../../tsconfig.compilerOption.json", + "compilerOptions": { + "strict": true, + "rootDir": "src", + "outDir": "dist", + "module": "Node16", + "moduleResolution": "Node16", + "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + }, + "include": ["src/**/*"], + "references": [ + { "path": "../../../auth/tsconfig.build.json" }, + { "path": "../../../vite/tsconfig.build.json" } + ] +} diff --git a/packages/auth-providers/supabase/middleware/tsconfig.json b/packages/auth-providers/supabase/middleware/tsconfig.json index 2d457ccfb155..a9e9ebdd342f 100644 --- a/packages/auth-providers/supabase/middleware/tsconfig.json +++ b/packages/auth-providers/supabase/middleware/tsconfig.json @@ -2,13 +2,12 @@ "extends": "../../../../tsconfig.compilerOption.json", "compilerOptions": { "strict": true, - "rootDir": "src", "outDir": "dist", "module": "Node16", - "moduleResolution": "Node16", - "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + "moduleResolution": "Node16" }, - "include": ["src/**/*"], + "include": ["."], + "exclude": ["dist", "node_modules", "**/__mocks__", "**/__fixtures__"], "references": [ { "path": "../../../auth/tsconfig.build.json" }, { "path": "../../../vite/tsconfig.build.json" } diff --git a/packages/context/build.mts b/packages/context/build.mts index 1b29b6313cd0..c42d3ea4d0e5 100644 --- a/packages/context/build.mts +++ b/packages/context/build.mts @@ -1,27 +1,16 @@ -import { build, defaultBuildOptions } from '@redwoodjs/framework-tools' +import { buildCjs, buildEsm } from '@redwoodjs/framework-tools' import { generateTypesCjs, generateTypesEsm, insertCommonJsPackageJson, } from '@redwoodjs/framework-tools/generateTypes' -// ESM build and type generation -await build({ - buildOptions: { - ...defaultBuildOptions, - format: 'esm', - }, -}) +await buildEsm() await generateTypesEsm() -// CJS build, type generation, and package.json insert -await build({ - buildOptions: { - ...defaultBuildOptions, - outdir: 'dist/cjs', - }, -}) +await buildCjs() await generateTypesCjs() + await insertCommonJsPackageJson({ buildFileUrl: import.meta.url, cjsDir: 'dist/cjs', diff --git a/packages/context/tsconfig.build.json b/packages/context/tsconfig.build.json new file mode 100644 index 000000000000..db264235028b --- /dev/null +++ b/packages/context/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.compilerOption.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "module": "Node16", + "moduleResolution": "Node16", + "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + }, + "include": ["src"] +} diff --git a/packages/context/tsconfig.json b/packages/context/tsconfig.json index db264235028b..ad7684d49aba 100644 --- a/packages/context/tsconfig.json +++ b/packages/context/tsconfig.json @@ -1,11 +1,11 @@ { "extends": "../../tsconfig.compilerOption.json", "compilerOptions": { - "rootDir": "src", "outDir": "dist", "module": "Node16", - "moduleResolution": "Node16", - "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + "moduleResolution": "Node16" }, - "include": ["src"] + "include": ["."], + "exclude": ["dist", "node_modules", "**/__mocks__", "**/__fixtures__"], + "references": [{ "path": "../framework-tools" }] } diff --git a/packages/framework-tools/src/buildDefaults.ts b/packages/framework-tools/src/buildDefaults.ts index a908448e8307..2954f4fcfffc 100644 --- a/packages/framework-tools/src/buildDefaults.ts +++ b/packages/framework-tools/src/buildDefaults.ts @@ -85,6 +85,48 @@ export async function build({ } } +export function buildCjs() { + return build({ + buildOptions: { + ...defaultBuildOptions, + tsconfig: 'tsconfig.cjs.json', + outdir: 'dist/cjs', + }, + }) +} + +export function buildEsm() { + return build({ + buildOptions: { + ...defaultBuildOptions, + tsconfig: 'tsconfig.build.json', + format: 'esm', + }, + }) +} + +export function buildExternalCjs() { + return build({ + buildOptions: { + ...defaultBuildOptions, + tsconfig: 'tsconfig.cjs.json', + outdir: 'dist/cjs', + packages: 'external', + }, + }) +} + +export function buildExternalEsm() { + return build({ + buildOptions: { + ...defaultBuildOptions, + tsconfig: 'tsconfig.build.json', + format: 'esm', + packages: 'external', + }, + }) +} + interface CopyAssetsOptions { buildFileUrl: string patterns: string[] diff --git a/packages/framework-tools/src/generateTypes.ts b/packages/framework-tools/src/generateTypes.ts index f2029ab75262..fb584dfd05c6 100644 --- a/packages/framework-tools/src/generateTypes.ts +++ b/packages/framework-tools/src/generateTypes.ts @@ -6,11 +6,15 @@ import type { PackageJson } from 'type-fest' import { $ } from 'zx' /** - * This function will run `yarn build:types-cjs` to generate the CJS type definitions. + * This function will run `yarn build:types-cjs` to generate the CJS type + * definitions. * - * It will also temporarily change the package.json file to have "type": "commonjs". This - * is the most reliable way to generate CJS type definitions. It will revert the package.json - * file back to its original state after the types have been generated - even if an error occurs. + * It will also temporarily change the package.json file to have + *`"type": "commonjs"`. This is the most reliable way to generate CJS type + * definitions[1]. It will revert the package.json file back to its original + * state after the types have been generated - even if an error occurs. + * + * [1]: https://github.com/arethetypeswrong/arethetypeswrong.github.io/issues/21#issuecomment-1494618930 */ export async function generateTypesCjs() { await $`cp package.json package.json.bak` @@ -33,7 +37,8 @@ export async function generateTypesCjs() { } /** - * This function will run `yarn build:types` to generate the ESM type definitions. + * This function will run `yarn build:types` to generate the ESM type + * definitions. */ export async function generateTypesEsm() { try { @@ -46,9 +51,9 @@ export async function generateTypesEsm() { } /** - * This function will insert a package.json file with "type": "commonjs" in the CJS build directory. - * This is necessary for the CJS build to be recognized as CommonJS modules when the root package.json - * file has "type": "module". + * This function will insert a package.json file with "type": "commonjs" in the + * CJS build directory. This is necessary for the CJS build to be recognized as + * CommonJS modules when the root package.json file has `"type": "module"`. */ export async function insertCommonJsPackageJson({ buildFileUrl, diff --git a/packages/graphql-server/tsconfig.json b/packages/graphql-server/tsconfig.json index 7b52929279dd..128bbc0f8f59 100644 --- a/packages/graphql-server/tsconfig.json +++ b/packages/graphql-server/tsconfig.json @@ -7,5 +7,8 @@ "moduleResolution": "Node16" }, "include": ["ambient.d.ts", "src/**/*"], - "references": [{ "path": "../api" }, { "path": "../context" }] + "references": [ + { "path": "../api" }, + { "path": "../context/tsconfig.build.json" } + ] } diff --git a/packages/router/build.ts b/packages/router/build.ts index f07a4b051713..bcf958474246 100644 --- a/packages/router/build.ts +++ b/packages/router/build.ts @@ -1,31 +1,16 @@ -import { build, defaultBuildOptions } from '@redwoodjs/framework-tools' +import { buildExternalCjs, buildExternalEsm } from '@redwoodjs/framework-tools' import { generateTypesCjs, generateTypesEsm, insertCommonJsPackageJson, } from '@redwoodjs/framework-tools/generateTypes' -// ESM build -await build({ - buildOptions: { - ...defaultBuildOptions, - tsconfig: 'tsconfig.build.json', - format: 'esm', - packages: 'external', - }, -}) +await buildExternalEsm() await generateTypesEsm() -// CJS build -await build({ - buildOptions: { - ...defaultBuildOptions, - tsconfig: 'tsconfig.cjs.json', - outdir: 'dist/cjs', - packages: 'external', - }, -}) +await buildExternalCjs() await generateTypesCjs() + await insertCommonJsPackageJson({ buildFileUrl: import.meta.url, cjsDir: 'dist/cjs', From 2c5f1d772d0acaba1b80bd1879eef2febd9c50dd Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Tue, 20 Aug 2024 12:11:24 +0200 Subject: [PATCH 2/3] fix TS issues in tests --- packages/auth-providers/dbAuth/middleware/package.json | 2 +- .../middleware/src/__tests__/defaultGetRoles.test.ts | 2 +- .../src/__tests__/initDbAuthMiddleware.test.ts | 9 ++++++--- .../dbAuth/middleware/src/defaultGetRoles.ts | 4 +++- .../auth-providers/dbAuth/middleware/tsconfig.cjs.json | 2 +- packages/auth-providers/supabase/middleware/package.json | 2 +- .../middleware/src/__tests__/defaultGetRoles.test.ts | 2 +- .../src/__tests__/initSupabaseAuthMiddleware.test.ts | 5 +++-- .../supabase/middleware/src/defaultGetRoles.ts | 3 ++- .../auth-providers/supabase/middleware/tsconfig.cjs.json | 2 +- packages/context/package.json | 2 +- packages/context/tsconfig.cjs.json | 2 +- 12 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/auth-providers/dbAuth/middleware/package.json b/packages/auth-providers/dbAuth/middleware/package.json index d5e81b6a6828..79a00f41f849 100644 --- a/packages/auth-providers/dbAuth/middleware/package.json +++ b/packages/auth-providers/dbAuth/middleware/package.json @@ -28,7 +28,7 @@ "scripts": { "build": "tsx ./build.mts", "build:pack": "yarn pack -o redwoodjs-auth-dbauth-middleware.tgz", - "build:types": "tsc --build --verbose ./tsconfig.json", + "build:types": "tsc --build --verbose ./tsconfig.build.json", "build:types-cjs": "tsc --build --verbose tsconfig.cjs.json", "check:attw": "yarn attw -P", "check:package": "concurrently npm:check:attw yarn:publint", diff --git a/packages/auth-providers/dbAuth/middleware/src/__tests__/defaultGetRoles.test.ts b/packages/auth-providers/dbAuth/middleware/src/__tests__/defaultGetRoles.test.ts index 04e0d2ca2d3c..99ade190aaa1 100644 --- a/packages/auth-providers/dbAuth/middleware/src/__tests__/defaultGetRoles.test.ts +++ b/packages/auth-providers/dbAuth/middleware/src/__tests__/defaultGetRoles.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { defaultGetRoles } from '../defaultGetRoles' +import { defaultGetRoles } from '../defaultGetRoles.js' describe('dbAuth: defaultGetRoles', () => { it('returns an empty array if no roles are present', () => { diff --git a/packages/auth-providers/dbAuth/middleware/src/__tests__/initDbAuthMiddleware.test.ts b/packages/auth-providers/dbAuth/middleware/src/__tests__/initDbAuthMiddleware.test.ts index 7f1a20d1fce7..f973fc1ee9f6 100644 --- a/packages/auth-providers/dbAuth/middleware/src/__tests__/initDbAuthMiddleware.test.ts +++ b/packages/auth-providers/dbAuth/middleware/src/__tests__/initDbAuthMiddleware.test.ts @@ -8,9 +8,10 @@ import { MiddlewareResponse, } from '@redwoodjs/web/middleware' -import { middlewareDefaultAuthProviderState } from '../../../../../auth/dist/AuthProvider/AuthProviderState' -import type { DbAuthMiddlewareOptions } from '../index' -import { initDbAuthMiddleware } from '../index' +import { middlewareDefaultAuthProviderState } from '../../../../../auth/dist/AuthProvider/AuthProviderState.js' +import type { DbAuthMiddlewareOptions } from '../index.js' +import { initDbAuthMiddleware } from '../index.js' + const FIXTURE_PATH = path.resolve( __dirname, '../../../../../../__fixtures__/example-todo-main', @@ -39,6 +40,8 @@ beforeAll(() => { mockedSession: 'this_is_the_only_correct_session', } } + + return undefined }), }, } diff --git a/packages/auth-providers/dbAuth/middleware/src/defaultGetRoles.ts b/packages/auth-providers/dbAuth/middleware/src/defaultGetRoles.ts index 799035680c7c..c589eaadf4fe 100644 --- a/packages/auth-providers/dbAuth/middleware/src/defaultGetRoles.ts +++ b/packages/auth-providers/dbAuth/middleware/src/defaultGetRoles.ts @@ -1,4 +1,6 @@ -export const defaultGetRoles = (decoded: Record): string[] => { +export const defaultGetRoles = ( + decoded: Record | undefined | null, +): string[] => { try { const roles = decoded?.currentUser?.roles diff --git a/packages/auth-providers/dbAuth/middleware/tsconfig.cjs.json b/packages/auth-providers/dbAuth/middleware/tsconfig.cjs.json index eaa211040f2f..a660cecf11ff 100644 --- a/packages/auth-providers/dbAuth/middleware/tsconfig.cjs.json +++ b/packages/auth-providers/dbAuth/middleware/tsconfig.cjs.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.json", + "extends": "./tsconfig.build.json", "compilerOptions": { "outDir": "dist/cjs", "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" diff --git a/packages/auth-providers/supabase/middleware/package.json b/packages/auth-providers/supabase/middleware/package.json index 82d29f7ee049..fb799ea6c586 100644 --- a/packages/auth-providers/supabase/middleware/package.json +++ b/packages/auth-providers/supabase/middleware/package.json @@ -29,7 +29,7 @@ "scripts": { "build": "tsx ./build.mts", "build:pack": "yarn pack -o redwoodjs-auth-supabase-middleware.tgz", - "build:types": "tsc --build --verbose ./tsconfig.json", + "build:types": "tsc --build --verbose ./tsconfig.build.json", "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json", "check:attw": "yarn attw -P", "check:package": "concurrently npm:check:attw yarn:publint", diff --git a/packages/auth-providers/supabase/middleware/src/__tests__/defaultGetRoles.test.ts b/packages/auth-providers/supabase/middleware/src/__tests__/defaultGetRoles.test.ts index 5621e5d6ee61..c7b25c4c1901 100644 --- a/packages/auth-providers/supabase/middleware/src/__tests__/defaultGetRoles.test.ts +++ b/packages/auth-providers/supabase/middleware/src/__tests__/defaultGetRoles.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { defaultGetRoles } from '../defaultGetRoles' +import { defaultGetRoles } from '../defaultGetRoles.js' describe('dbAuth: defaultGetRoles', () => { it('returns an empty array if no roles are present', () => { diff --git a/packages/auth-providers/supabase/middleware/src/__tests__/initSupabaseAuthMiddleware.test.ts b/packages/auth-providers/supabase/middleware/src/__tests__/initSupabaseAuthMiddleware.test.ts index b4d5027ce586..3a16e8625db8 100644 --- a/packages/auth-providers/supabase/middleware/src/__tests__/initSupabaseAuthMiddleware.test.ts +++ b/packages/auth-providers/supabase/middleware/src/__tests__/initSupabaseAuthMiddleware.test.ts @@ -10,8 +10,9 @@ import { MiddlewareResponse, } from '@redwoodjs/web/middleware' -import initSupabaseAuthMiddleware from '../index' -import type { SupabaseAuthMiddlewareOptions } from '../index' +import initSupabaseAuthMiddleware from '../index.js' +import type { SupabaseAuthMiddlewareOptions } from '../index.js' + const FIXTURE_PATH = path.resolve( __dirname, '../../../../../../__fixtures__/example-todo-main', diff --git a/packages/auth-providers/supabase/middleware/src/defaultGetRoles.ts b/packages/auth-providers/supabase/middleware/src/defaultGetRoles.ts index 23873da4bf6b..3cbf5a4628ef 100644 --- a/packages/auth-providers/supabase/middleware/src/defaultGetRoles.ts +++ b/packages/auth-providers/supabase/middleware/src/defaultGetRoles.ts @@ -33,7 +33,8 @@ interface PartialSupabaseDecoded { app_metadata: { - roles?: string + [key: string]: unknown + roles?: string | undefined } } diff --git a/packages/auth-providers/supabase/middleware/tsconfig.cjs.json b/packages/auth-providers/supabase/middleware/tsconfig.cjs.json index eaa211040f2f..a660cecf11ff 100644 --- a/packages/auth-providers/supabase/middleware/tsconfig.cjs.json +++ b/packages/auth-providers/supabase/middleware/tsconfig.cjs.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.json", + "extends": "./tsconfig.build.json", "compilerOptions": { "outDir": "dist/cjs", "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" diff --git a/packages/context/package.json b/packages/context/package.json index 065caac15192..2a6fb90e6e0f 100644 --- a/packages/context/package.json +++ b/packages/context/package.json @@ -39,7 +39,7 @@ "scripts": { "build": "tsx ./build.mts", "build:pack": "yarn pack -o redwoodjs-context.tgz", - "build:types": "tsc --build --verbose ./tsconfig.json", + "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\" --ignore dist --exec \"yarn build\"", "check:attw": "yarn attw -P", diff --git a/packages/context/tsconfig.cjs.json b/packages/context/tsconfig.cjs.json index eaa211040f2f..a660cecf11ff 100644 --- a/packages/context/tsconfig.cjs.json +++ b/packages/context/tsconfig.cjs.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.json", + "extends": "./tsconfig.build.json", "compilerOptions": { "outDir": "dist/cjs", "tsBuildInfoFile": "./tsconfig.cjs.tsbuildinfo" From 02224cda6870239652c9dabd8b79cd402bfb42e4 Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Tue, 20 Aug 2024 12:23:16 +0200 Subject: [PATCH 3/3] default cjsDir --- packages/auth-providers/dbAuth/middleware/build.mts | 5 +---- .../auth-providers/dbAuth/middleware/tsconfig.build.json | 2 +- packages/auth-providers/supabase/middleware/build.mts | 5 +---- .../auth-providers/supabase/middleware/tsconfig.build.json | 2 +- packages/context/build.mts | 5 +---- packages/context/tsconfig.build.json | 2 +- packages/framework-tools/src/generateTypes.ts | 4 ++-- packages/router/build.ts | 5 +---- 8 files changed, 9 insertions(+), 21 deletions(-) diff --git a/packages/auth-providers/dbAuth/middleware/build.mts b/packages/auth-providers/dbAuth/middleware/build.mts index bcf958474246..4f9ebbf82169 100644 --- a/packages/auth-providers/dbAuth/middleware/build.mts +++ b/packages/auth-providers/dbAuth/middleware/build.mts @@ -11,7 +11,4 @@ await generateTypesEsm() await buildExternalCjs() await generateTypesCjs() -await insertCommonJsPackageJson({ - buildFileUrl: import.meta.url, - cjsDir: 'dist/cjs', -}) +await insertCommonJsPackageJson({ buildFileUrl: import.meta.url }) diff --git a/packages/auth-providers/dbAuth/middleware/tsconfig.build.json b/packages/auth-providers/dbAuth/middleware/tsconfig.build.json index 2d457ccfb155..3e4cfa0b360f 100644 --- a/packages/auth-providers/dbAuth/middleware/tsconfig.build.json +++ b/packages/auth-providers/dbAuth/middleware/tsconfig.build.json @@ -6,7 +6,7 @@ "outDir": "dist", "module": "Node16", "moduleResolution": "Node16", - "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" }, "include": ["src/**/*"], "references": [ diff --git a/packages/auth-providers/supabase/middleware/build.mts b/packages/auth-providers/supabase/middleware/build.mts index bcf958474246..4f9ebbf82169 100644 --- a/packages/auth-providers/supabase/middleware/build.mts +++ b/packages/auth-providers/supabase/middleware/build.mts @@ -11,7 +11,4 @@ await generateTypesEsm() await buildExternalCjs() await generateTypesCjs() -await insertCommonJsPackageJson({ - buildFileUrl: import.meta.url, - cjsDir: 'dist/cjs', -}) +await insertCommonJsPackageJson({ buildFileUrl: import.meta.url }) diff --git a/packages/auth-providers/supabase/middleware/tsconfig.build.json b/packages/auth-providers/supabase/middleware/tsconfig.build.json index 2d457ccfb155..3e4cfa0b360f 100644 --- a/packages/auth-providers/supabase/middleware/tsconfig.build.json +++ b/packages/auth-providers/supabase/middleware/tsconfig.build.json @@ -6,7 +6,7 @@ "outDir": "dist", "module": "Node16", "moduleResolution": "Node16", - "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" }, "include": ["src/**/*"], "references": [ diff --git a/packages/context/build.mts b/packages/context/build.mts index c42d3ea4d0e5..1bc9652ae67f 100644 --- a/packages/context/build.mts +++ b/packages/context/build.mts @@ -11,7 +11,4 @@ await generateTypesEsm() await buildCjs() await generateTypesCjs() -await insertCommonJsPackageJson({ - buildFileUrl: import.meta.url, - cjsDir: 'dist/cjs', -}) +await insertCommonJsPackageJson({ buildFileUrl: import.meta.url }) diff --git a/packages/context/tsconfig.build.json b/packages/context/tsconfig.build.json index db264235028b..52f021978079 100644 --- a/packages/context/tsconfig.build.json +++ b/packages/context/tsconfig.build.json @@ -5,7 +5,7 @@ "outDir": "dist", "module": "Node16", "moduleResolution": "Node16", - "tsBuildInfoFile": "./tsconfig.tsbuildinfo" + "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" }, "include": ["src"] } diff --git a/packages/framework-tools/src/generateTypes.ts b/packages/framework-tools/src/generateTypes.ts index fb584dfd05c6..6a6b0922892b 100644 --- a/packages/framework-tools/src/generateTypes.ts +++ b/packages/framework-tools/src/generateTypes.ts @@ -57,10 +57,10 @@ export async function generateTypesEsm() { */ export async function insertCommonJsPackageJson({ buildFileUrl, - cjsDir, + cjsDir = 'dist/cjs', }: { buildFileUrl: string - cjsDir: string + cjsDir?: string }) { const packageDir = path.dirname(fileURLToPath(buildFileUrl)) const packageJsonPath = path.join(packageDir, cjsDir, 'package.json') diff --git a/packages/router/build.ts b/packages/router/build.ts index bcf958474246..4f9ebbf82169 100644 --- a/packages/router/build.ts +++ b/packages/router/build.ts @@ -11,7 +11,4 @@ await generateTypesEsm() await buildExternalCjs() await generateTypesCjs() -await insertCommonJsPackageJson({ - buildFileUrl: import.meta.url, - cjsDir: 'dist/cjs', -}) +await insertCommonJsPackageJson({ buildFileUrl: import.meta.url })