diff --git a/contracts/package.json b/contracts/package.json index b6b00d0ca..d2eb5fc23 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@kleros/kleros-v2-contracts", - "version": "0.4.0", + "version": "0.4.1", "description": "Smart contracts for Kleros version 2", "main": "typechain-types/index.ts", "repository": "git@github.com:kleros/kleros-v2.git", @@ -53,7 +53,11 @@ "release:patch": "scripts/publish.sh patch", "release:minor": "scripts/publish.sh minor", "release:major": "scripts/publish.sh major", - "tenderly-verify": "hardhat tenderly:verify" + "tenderly-verify": "hardhat tenderly:verify", + "build:all": "yarn rimraf ./dist && yarn build:cjs && yarn build:esm && yarn build:types", + "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json", + "build:esm": "tsc --project tsconfig.json --module es2020 --outDir ./dist/esm && echo '{\"type\": \"module\"}' > ./dist/esm/package.json", + "build:types": "tsc --project tsconfig.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap" }, "devDependencies": { "@defi-wonderland/natspec-smells": "^1.0.3", diff --git a/contracts/scripts/publish.sh b/contracts/scripts/publish.sh index 40ddff266..ceba8a374 100755 --- a/contracts/scripts/publish.sh +++ b/contracts/scripts/publish.sh @@ -30,8 +30,13 @@ yarn export:testnet yarn export:mainnet mkdir dist -cp -pr README.md deployments src/ dist/ +yarn tsc --project tsconfig.json --module commonjs --outDir ./dist +cp -pr README.md src/ dist/ +rm -rf dist/config +rm -rf dist/deploy +rm -rf dist/scripts rm -rf dist/test +rm -rf dist/hardhat.config* rm -rf dist/deployments/**/solcInputs rm -rf dist/deployments/localhost rm -rf dist/deployments/hardhat diff --git a/contracts/tsconfig.json b/contracts/tsconfig.json index b6d222642..c6e40bb30 100644 --- a/contracts/tsconfig.json +++ b/contracts/tsconfig.json @@ -5,7 +5,11 @@ "./scripts", "./test", "./typechain-types", - "./deploy" + "./deploy", + "./deployments" + ], + "exclude": [ + "./scripts/**/console*.ts" ], "files": [ "./hardhat.config.ts"