From bebe3614ca0475d668283c42f5f2684b5fb50668 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Fri, 3 Jan 2025 08:51:53 -0800 Subject: [PATCH] feat(esm): moving apollo utils to esm --- packages/apollo-utils/jest.config.js | 8 -------- packages/apollo-utils/jest.config.ts | 16 ++++++++++++++++ .../{jest.setup.js => jest.setup.ts} | 0 packages/apollo-utils/package.json | 2 +- packages/eslint-config/base.js | 2 ++ packages/tsconfig/library.json | 2 +- 6 files changed, 20 insertions(+), 10 deletions(-) delete mode 100644 packages/apollo-utils/jest.config.js create mode 100644 packages/apollo-utils/jest.config.ts rename packages/apollo-utils/{jest.setup.js => jest.setup.ts} (100%) diff --git a/packages/apollo-utils/jest.config.js b/packages/apollo-utils/jest.config.js deleted file mode 100644 index 72cfc4d34..000000000 --- a/packages/apollo-utils/jest.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - testMatch: ['**/?(*.)+(jest|spec).[jt]s?(x)'], - testPathIgnorePatterns: ['/dist/'], - setupFiles: ['./jest.setup.js'], - setupFilesAfterEnv: ['jest-extended/all'], -}; diff --git a/packages/apollo-utils/jest.config.ts b/packages/apollo-utils/jest.config.ts new file mode 100644 index 000000000..0b9f24fb6 --- /dev/null +++ b/packages/apollo-utils/jest.config.ts @@ -0,0 +1,16 @@ +import type { Config } from 'jest'; + +const config: Config = { + preset: 'ts-jest', + testEnvironment: 'node', + testMatch: ['**/?(*.)+(jest|spec).[jt]s?(x)'], + testPathIgnorePatterns: ['/dist/'], + setupFiles: ['./jest.setup.ts'], + setupFilesAfterEnv: ['jest-extended/all'], + moduleNameMapper: { + "^(\\.\\/.+)\\.js$": "$1", + "^(\\..\\/.+)\\.js$": "$1" + }, +}; + +export default config; \ No newline at end of file diff --git a/packages/apollo-utils/jest.setup.js b/packages/apollo-utils/jest.setup.ts similarity index 100% rename from packages/apollo-utils/jest.setup.js rename to packages/apollo-utils/jest.setup.ts diff --git a/packages/apollo-utils/package.json b/packages/apollo-utils/package.json index d20e1f26e..5174b3a46 100644 --- a/packages/apollo-utils/package.json +++ b/packages/apollo-utils/package.json @@ -13,10 +13,10 @@ }, "license": "Apache-2.0", "author": "", + "type": "module", "main": "dist/index.js", "module": "dist/index.mjs", "types": "dist/index.d.ts", - "type": "module", "files": [ "dist", "package.json" diff --git a/packages/eslint-config/base.js b/packages/eslint-config/base.js index 5a2d1b8b3..489d912fa 100644 --- a/packages/eslint-config/base.js +++ b/packages/eslint-config/base.js @@ -42,6 +42,8 @@ export default tseslint.config( '**/*.js', 'codegen.ts', 'prisma/**/*', + 'jest.config.ts', + 'jest.setup.ts', ], }, { diff --git a/packages/tsconfig/library.json b/packages/tsconfig/library.json index b0b1dc641..f5dcae82a 100644 --- a/packages/tsconfig/library.json +++ b/packages/tsconfig/library.json @@ -5,7 +5,7 @@ "emitDecoratorMetadata": true, "rewriteRelativeImportExtensions": true, "allowImportingTsExtensions": true, - "target": "ES2024", + "target": "ESNext", "module": "NodeNext", "moduleResolution": "nodenext", "lib": [