Add a makefile to build both ESM and CJS

This commit is contained in:
Oliver Akins 2022-03-06 23:06:18 -06:00
parent dc3f1a8b1d
commit 4e61f0283d
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99
2 changed files with 19 additions and 4 deletions

16
common/makefile Normal file
View file

@ -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

View file

@ -2,12 +2,11 @@
"name": "common", "name": "common",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "dist/index.js", "module": "index.js",
"types": "dist/index.d.ts", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "Oliver Akins", "author": "Oliver Akins",
"license": "UNLICENSED", "license": "UNLICENSED"
"files": ["/dist"]
} }