Skip to content

Commit

Permalink
compile for both ESM and UMD
Browse files Browse the repository at this point in the history
  • Loading branch information
Freezystem committed Dec 3, 2023
1 parent 4dea360 commit 65fb9b1
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 17 deletions.
35 changes: 27 additions & 8 deletions package-lock.json

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

16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@freezystem/mjml-bar-chart",
"repository": {
"type": "git",
"url": "https://github.com/Freezystem/mjml-bar-chart.git"
},
"version": "1.1.1",
"description": "A simple MJML component to make static bar charts",
"source": "src/index.ts",
"main": "./build/umd/index.js",
"module": "./build/esm/index.js",
"types": "./build/types/index.d.ts",
"exports": {
".": {
"types": "./build/types/index.d.ts",
"require": "./build/umd/index.js",
"import": "./build/esm/index.js",
"default": "./build/umd/index.js"
}
},
"scripts": {
"watch": "tsc --watch",
"prebuild": "rm -rf build",
"build": "tsc",
"build": "tsc -b tsconfig.umd.json tsconfig.esm.json tsconfig.types.json",
"postinstall": "npm run build",
"test": "jest",
"deps": "npm-check -u",
Expand All @@ -30,6 +41,7 @@
"@types/mjml": "^4.7.4",
"@types/mjml-core": "^4.7.4",
"@types/mjml-validator": "^4.13.4",
"@types/node": "^20.10.2",
"jest": "^29.7.0",
"npm-check": "^6.0.1",
"prettier": "^3.1.0",
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "build/esm",
"module": "ESNext"
}
}
15 changes: 8 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 20",
"compilerOptions": {
"types": ["node", "jest", "mjml"],
"outDir": "build",
"target": "ES2022",
"rootDir": "src",
"types": ["node", "jest", "mjml", "mjml-core", "mjml-validator"],
"target": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"inlineSourceMap": true,
"alwaysStrict": true,
"esModuleInterop": true,
"skipLibCheck": true
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
},
"include": ["src/index.ts"]
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "build", "coverage", "src/**/*.spec.ts"]
}
8 changes: 8 additions & 0 deletions tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "build/types",
"declaration": true,
"emitDeclarationOnly": true
}
}
7 changes: 7 additions & 0 deletions tsconfig.umd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "build/umd",
"module": "commonjs"
}
}

0 comments on commit 65fb9b1

Please sign in to comment.