From 4e61f0283d731262c57da56c3511e3a392f6a860 Mon Sep 17 00:00:00 2001 From: Oliver Akins Date: Sun, 6 Mar 2022 23:06:18 -0600 Subject: [PATCH] Add a makefile to build both ESM and CJS --- common/makefile | 16 ++++++++++++++++ common/{package.json => package.template.json} | 7 +++---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 common/makefile rename common/{package.json => package.template.json} (62%) diff --git a/common/makefile b/common/makefile new file mode 100644 index 0000000..175834c --- /dev/null +++ b/common/makefile @@ -0,0 +1,16 @@ +.PHONY: all esm cjs + +ESM_LOCATION=./esm +CJS_LOCATION=./cjs + +all: esm cjs + +esm: + mkdir $(ESM_LOCATION) --parents + tsc --module es6 --outDir $(ESM_LOCATION) + cp ./package.template.json $(ESM_LOCATION)/package.json + +cjs: + mkdir $(CJS_LOCATION) --parents + tsc --module commonjs --outDir $(CJS_LOCATION) + cp ./package.template.json $(CJS_LOCATION)/package.json \ No newline at end of file diff --git a/common/package.json b/common/package.template.json similarity index 62% rename from common/package.json rename to common/package.template.json index ea95da4..197cb08 100644 --- a/common/package.json +++ b/common/package.template.json @@ -2,12 +2,11 @@ "name": "common", "version": "1.0.0", "description": "", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "module": "index.js", + "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Oliver Akins", - "license": "UNLICENSED", - "files": ["/dist"] + "license": "UNLICENSED" }