Skip to content

Commit

Permalink
ZETA-6125: Benchmarl progress towards building esm module.
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieGreenman committed Jul 15, 2023
1 parent 8279b98 commit 7345769
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 25 deletions.
6 changes: 0 additions & 6 deletions \

This file was deleted.

33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 21 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
],
"version": "1.2.2",
"description": "Code Morph is an extensible, easy to understand, easy contribute, easy to use Codemod library.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"types": "./lib/cjs/types/index.d.ts",
"main": "./lib/cjs/index.js",
"scripts": {
"build": "tsc",
"clean": "rm -rf ./lib",
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"build:esm": "tsc -p ./tsconfig.esm.json && mv lib/esm/index.js lib/esm/index.mjs",
"build:cjs": "tsc -p ./tsconfig.cjs.json",
"prepack": "npm run build",
"format": "prettier --write \"src/**/*.(js|ts)\"",
"lint": "eslint src --ext .js,.ts",
"lint:fix": "eslint src --fix --ext .js,.ts",
Expand Down Expand Up @@ -56,6 +60,7 @@
"@angular/router": "^13.0.0",
"@angular/service-worker": "^13.0.0",
"@angular/upgrade": "^13.0.0",
"@types/glob": "^8.1.0",
"@types/jest": "^27.5.2",
"@types/lodash": "^4.14.192",
"@types/resolve": "^1.20.2",
Expand Down Expand Up @@ -98,7 +103,19 @@
"unist-util-visit": "2.0.3",
"unist-util-visit-parents": "3.1.1"
},
"exports": {
".": {
"import": {
"types": "./lib/esm/types/index.d.ts",
"default": "./lib/esm/index.mjs"
},
"require": {
"types": "./lib/cjs/types/index.d.ts",
"default": "./lib/cjs/index.js"
}
}
},
"files": [
"dist/**/*"
"lib/**/*"
]
}
26 changes: 11 additions & 15 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
{
"compilerOptions": {
"target": "es2015",
"sourceMap": true,
"importHelpers": true,
"module": "esnext",
"moduleResolution": "node",
"outDir": "build",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": false,
"skipLibCheck": true,
"types": ["node", "jest"],
"lib": ["es2021"],
"checkJs": true,
"allowJs": true,
"declaration": true,
"resolveJsonModule": true,
"baseUrl": ".",
"rootDir": "."
}
}
"declarationMap": true,
"types": ["node", "jest"],
"allowSyntheticDefaultImports": true
},
"files": ["./src/index.ts"]
}
11 changes: 11 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"lib": ["ES6", "DOM"],
"target": "ES6",
"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "./lib/cjs",
"declarationDir": "./lib/cjs/types"
}
}
11 changes: 11 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"lib": ["ES2021", "DOM"],
"target": "ES2021",
"module": "ESNext",
"moduleResolution": "node",
"outDir": "./lib/esm",
"declarationDir": "./lib/esm/types"
}
}

0 comments on commit 7345769

Please sign in to comment.