Skip to content

Commit

Permalink
feat(package.json): remove cjs support, update jest config
Browse files Browse the repository at this point in the history
BREAKING CHANGE: esm support only
  • Loading branch information
waldronmatt committed Oct 1, 2023
1 parent 6bc7d78 commit 32ad266
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 7 additions & 0 deletions packages/basic-math/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
const mappedModule = process.env.TEST_ENV === 'prod' ? '<rootDir>/dist/$1' : '<rootDir>/src/$1';

module.exports = {
preset: 'jest-config',
testMatch: ['<rootDir>/src/**?(*.)+(spec|test).+(ts|tsx)'],
moduleNameMapper: {
'^@/(.*)\\.js$': mappedModule,
},
testEnvironment: 'jsdom',
};
5 changes: 2 additions & 3 deletions packages/basic-math/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@waldronmatt/basic-math",
"version": "1.0.5",
"main": "./dist/index.cjs",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.js"
},
"./*": "./dist/*"
Expand All @@ -25,7 +24,7 @@
"test:watch": "jest --watch",
"test:prod": "cross-env TEST_ENV=prod NODE_OPTIONS=--experimental-vm-modules jest",
"build:dtsmaps": "tsc --project tsconfig.build.json",
"build:src": "tsup src/*[!.spec].ts --format cjs,esm --sourcemap --onSuccess \"pnpm build:dtsmaps\"",
"build:src": "tsup src/*[!.spec].ts --format esm --sourcemap --onSuccess \"pnpm build:dtsmaps\"",
"clean": "rimraf dist coverage tsconfig.build.tsbuildinfo",
"build": "pnpm build:src",
"stub": "npx unbuild --stub"
Expand Down

0 comments on commit 32ad266

Please sign in to comment.