Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build dual ESM/CJS packages; move some exports to deep imports #6580

Merged
merged 5 commits into from Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .circleci/config.yml
Expand Up @@ -44,6 +44,13 @@ jobs:
- store_test_results:
path: junit.xml

Smoke test built package:
docker:
- image: cimg/base:stable
steps:
- setup-node
- run: npm run test:smoke

Prettier:
docker:
- image: cimg/base:stable
Expand Down Expand Up @@ -90,3 +97,4 @@ workflows:
- "Check for FIXM\x45"
- Prettier
- Spell check
- Smoke test built package
1 change: 1 addition & 0 deletions .codesandbox/ci.json
Expand Up @@ -2,6 +2,7 @@
"buildCommand": "compile",
"installCommand": "install-with-npm-8.5",
"packages": [
"packages/usage-reporting-protobuf",
"packages/server"
],
"sandboxes": ["apollo-server-typescript-3opde","apollo-server"],
Expand Down
4 changes: 4 additions & 0 deletions cspell-dict.txt
Expand Up @@ -102,6 +102,7 @@ microrouter
middlewares
Middlewares
millis
mktemp
monodocs
mygraph
myvariant
Expand All @@ -119,6 +120,8 @@ pbts
pook
Pook
pooks
postcompile
precompile
preflighted
preflighting
prepended
Expand All @@ -135,6 +138,7 @@ retryable
revalidates
roadmap
ROADMAP
rollup
runtimes
safelist
safelisted
Expand Down
10 changes: 8 additions & 2 deletions jest.config.base.js
@@ -1,6 +1,6 @@
const { defaults } = require('jest-config');
import { defaults } from 'jest-config';

module.exports = {
export default {
testEnvironment: 'node',
setupFilesAfterEnv: ['<rootDir>/../../jest.setup.js'],
preset: 'ts-jest',
Expand All @@ -9,10 +9,16 @@ module.exports = {
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
clearMocks: true,
extensionsToTreatAsEsm: ['.ts'],
globals: {
'ts-jest': {
useESM: true,
tsconfig: '<rootDir>/src/__tests__/tsconfig.json',
diagnostics: false,
},
},
moduleNameMapper: {
// Ignore '.js' at the end of imports; part of ESM support.
'^(\\.{1,2}/.*)\\.js$': '$1',
},
};