Skip to content

Commit

Permalink
fix: cjs + esm + umd module
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebulis committed Nov 20, 2020
1 parent 45f28fc commit 3f46a65
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 1 deletion.
105 changes: 105 additions & 0 deletions package-lock.json

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

11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
"name": "@govtechsg/oa-schemata",
"version": "0.0.0-development",
"description": "Repository for schemata created by open-attestation",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"browser": "dist/index.umd.js",
"types": "dist/types/index.d.ts",
"scripts": {
"build": "npm run clean && npm run build:type",
"build": "npm run clean && npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:type",
"build:cjs": "tsc --module commonjs --outDir dist/cjs --project ./tsconfig.prod.json",
"build:esm": "tsc --module es2015 --outDir dist/esm --project ./tsconfig.prod.json",
"build:type": "tsc -d --emitDeclarationOnly --outDir dist/types",
"build:umd": "rollup -c",
"clean": "rm -rf dist/",
"dev": "cd app && npm run dev",
"test": "jest",
Expand All @@ -21,6 +27,7 @@
"@commitlint/config-conventional": "8.3.3",
"@commitlint/prompt": "8.3.3",
"@ls-age/commitlint-circle": "1.0.0",
"@rollup/plugin-json": "^4.0.0",
"@types/jest": "^24.0.23",
"@types/lodash": "^4.14.162",
"@typescript-eslint/eslint-plugin": "^2.8.0",
Expand All @@ -41,6 +48,8 @@
"prettier": "^1.19.1",
"prettier-plugin-svelte": "^1.4.1",
"quicktype": "^15.0.258",
"rollup": "^1.27.3",
"rollup-plugin-commonjs": "^10.1.0",
"semantic-release": "^17.2.1",
"svelte": "^3.29.4",
"ts-jest": "^24.1.0",
Expand Down
12 changes: 12 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import commonjs from "rollup-plugin-commonjs";
import json from "@rollup/plugin-json";

export default {
input: "./dist/esm/index.js", // umd will run from esm build to produce a single bundled file, any better idea ?
output: {
file: "./dist/index.umd.js",
format: "umd",
name: "openAttestation"
},
plugins: [commonjs(), json()]
};
6 changes: 6 additions & 0 deletions tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig",
"exclude": [
"**/*.test.ts"
]
}

0 comments on commit 3f46a65

Please sign in to comment.