Skip to content

Commit

Permalink
chore: provide CommonJS exports
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-fricke committed May 23, 2024
1 parent b7cd97b commit 7324a64
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
coverage
cjs
dist
node_modules
test/fixtures/*.ts
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import tsEslint from "typescript-eslint";

export default tsEslint.config(
{
ignores: ["coverage", "dist", "test/fixtures/*.ts"],
ignores: ["coverage", "cjs", "dist", "test/fixtures/*.ts"],
},
eslint.configs.recommended,
...tsEslint.configs.recommended,
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@
"description": "Tiny, type-safe wrapper around MSW for type inference from OpenAPI schemas.",
"repository": "github:christoph-fricke/openapi-msw",
"files": [
"cjs",
"dist",
"CHANGELOG.md",
"README.md",
"LICENSE"
],
"sideEffects": false,
"types": "./dist/exports/main.d.ts",
"module": "./dist/exports/main.js",
"main": "./dist/exports/main.js",
"exports": {
".": {
"types": "./dist/exports/main.d.ts",
"import": "./dist/exports/main.js"
"import": "./dist/exports/main.js",
"require": "./cjs/exports/main.js"
}
},
"scripts": {
"prepare": "husky",
"build": "rimraf ./dist && tsc -p tsconfig.build.json",
"build": "rimraf ./dist ./cjs && tsc -p tsconfig.build.json && tsc -p tsconfig.cjs.json",
"format": "prettier --write .",
"lint": "eslint . && prettier -c .",
"generate": "openapi-typescript -c ./test/fixtures/.redocly.yml",
Expand Down
10 changes: 10 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "./tsconfig.build.json",
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "Node",
"verbatimModuleSyntax": false,
"outDir": "./cjs"
}
}

0 comments on commit 7324a64

Please sign in to comment.