-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1053 sdk sdk and contract should build for cjs and esm (#1064)
* v0.1.0 * feat(publish): cjs and esm in contracts 0.1.0 * v0.4.0 * feat(package): SDK cjs and esm release 0.4.0 * v0.2.0 * v0.5.0 * feat(npm): rollup, publish sdk 0.5 contr 0.2 * v0.3.0 * v0.4.0 * feat(release): contracts 0.4.0 CJS and ESM * v0.6.0 * chore(update): update hc packages in fe * fix(graph): graph ci-cd for dev and pr * fix(foundry): remove hardcoded version from gha * chore(update): matchstick lib * fix(gha): move changes to correct files * fix(test): contract tests after foundry update * fix(lint): bypass lint warns
- Loading branch information
1 parent
ae3e65e
commit 39284c0
Showing
36 changed files
with
12,527 additions
and
2,528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
* | ||
!dist/** | ||
!package.json | ||
!README.md | ||
lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
**/deployments | ||
**/.openzeppelin | ||
**/docs | ||
**/src/abi/ | ||
|
||
# files | ||
*.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
{ | ||
"name": "@hypercerts-org/contracts", | ||
"description": "EVM compatible protocol for managing impact claims", | ||
"version": "0.0.13", | ||
"version": "0.4.0", | ||
"author": { | ||
"name": "Hypercerts Foundation", | ||
"url": "https://github.com/hypercerts-org/hypercerts" | ||
}, | ||
"homepage": "https://hypercerts.org", | ||
"bugs": "https://github.com/hypercerts-org/hypercerts/issues/new", | ||
"repository": { | ||
"directory": "contracts", | ||
"url": "https://github.com/hypercerts-org/hypercerts", | ||
"type": "git" | ||
}, | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
"require": "./dist/cjs/index.js", | ||
"import": "./dist/esm/index.js", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"packageManager": "[email protected]", | ||
"workspaces": { | ||
"nohoist": [ | ||
|
@@ -36,6 +43,9 @@ | |
"@openzeppelin/hardhat-defender": "^1.8.2", | ||
"@openzeppelin/hardhat-upgrades": "^1.22.1", | ||
"@primitivefi/hardhat-dodoc": "^0.2.3", | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-json": "^6.0.0", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@trivago/prettier-plugin-sort-imports": "^3.3.0", | ||
"@typechain/ethers-v5": "^10.2.0", | ||
"@typechain/hardhat": "^6.1.5", | ||
|
@@ -61,6 +71,10 @@ | |
"prettier": "^2.7.1", | ||
"prettier-plugin-solidity": "^1.1.3", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^3.17.2", | ||
"rollup-plugin-auto-external": "^2.0.0", | ||
"rollup-plugin-dts": "^5.2.0", | ||
"rollup-plugin-esbuild": "^5.0.0", | ||
"shx": "^0.3.4", | ||
"solhint": "^3.3.7", | ||
"solidity-coverage": "^0.8.2", | ||
|
@@ -79,15 +93,16 @@ | |
"template" | ||
], | ||
"scripts": { | ||
"build": "yarn clean && yarn build:hardhat", | ||
"build": "yarn clean && hardhat compile && rollup -c", | ||
"build:forge": "forge build", | ||
"build:hardhat": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile && yarn build:ts && yarn build:declarations", | ||
"build:ts": "npx tsc --build tsconfig.build.json", | ||
"build:declarations": "shx cp ./typechain/*.d.ts ./dist/src/types", | ||
"build:hardhat": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile && yarn build:ts:esm && yarn build:ts:cjs && yarn build:declarations", | ||
"build:ts:esm": "npx tsc --build tsconfig.esm.json", | ||
"build:ts:cjs": "npx tsc --build tsconfig.cjs.json", | ||
"build:declarations": "shx cp ./src/types/*.d.ts ./dist/index.d.ts", | ||
"clean": "rimraf cache out dist typechain abi", | ||
"docs": "hardhat dodoc", | ||
"lint": "yarn lint:sol && yarn prettier:check", | ||
"lint:sol": "solhint \"./{src,test}/**/*.sol\"", | ||
"lint:sol": "solhint -w 5 \"./{src,test}/**/*.sol\"", | ||
"prettier": "prettier --config \"./.prettierrc.yml\" --write \"**/*.{json,md,sol,yml}\"", | ||
"prettier:check": "prettier --config \"./.prettierrc.yml\" --check \"**/*.{json,md,sol,yml}\"", | ||
"slither": "slither ./src", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import json from "@rollup/plugin-json"; | ||
import { nodeResolve } from "@rollup/plugin-node-resolve"; | ||
import autoExternal from "rollup-plugin-auto-external"; | ||
import dts from "rollup-plugin-dts"; | ||
import esbuild from "rollup-plugin-esbuild"; | ||
import nodePolyfills from "rollup-plugin-node-polyfills"; | ||
|
||
export default [ | ||
{ | ||
input: `src/index.ts`, | ||
plugins: [autoExternal(), nodePolyfills(), json(), commonjs(), nodeResolve(), esbuild()], | ||
output: [ | ||
{ | ||
format: "esm", | ||
dir: "dist/esm", | ||
}, | ||
{ | ||
format: "cjs", | ||
dir: "dist/cjs", | ||
}, | ||
], | ||
}, | ||
{ | ||
input: `src/index.ts`, | ||
plugins: [json(), dts()], | ||
output: { | ||
file: `dist/index.d.ts`, | ||
format: "es", | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import HypercertMinterAbi from "./abi/HypercertMinter.json"; | ||
import { HypercertMinter__factory } from "./types/factories/src/HypercertMinter__factory"; | ||
import type { AllowlistMinter } from "./types/src/AllowlistMinter"; | ||
import type { HypercertMinter } from "./types/src/HypercertMinter"; | ||
import type { IAllowlist } from "./types/src/interfaces/IAllowlist"; | ||
import type { IHypercertToken } from "./types/src/interfaces/IHypercertToken"; | ||
import type { Errors } from "./types/src/libs/Errors"; | ||
|
||
/* | ||
in order to adjust the build folder: | ||
1) import any files here you want in the final build package. | ||
2) copy the file path of the import. | ||
3) add the path to the ts.config.build.json under the { include: [...] } configuration. | ||
4) bump package.json version to publish a new package to npm. | ||
*/ | ||
// ABIs | ||
import ERC1155UpgradeableABI from "../abi/ERC1155Upgradeable.json" assert { type: "json" }; | ||
import HypercertMinterABI from "../abi/HypercertMinter.json" assert { type: "json" }; | ||
import IHypercertTokenABI from "../abi/IHypercertToken.json" assert { type: "json" }; | ||
import SemiFungible1155ABI from "../abi/SemiFungible1155.json" assert { type: "json" }; | ||
|
||
// ABIs | ||
export { HypercertMinterABI, IHypercertTokenABI, SemiFungible1155ABI, ERC1155UpgradeableABI }; | ||
|
||
// Interfaces | ||
export type { IHypercertToken } from "../typechain/src/interfaces/IHypercertToken"; | ||
export { IAllowlist, IHypercertToken }; | ||
export { HypercertMinterAbi }; | ||
|
||
// Contracts | ||
export { HypercertMinter } from "../typechain/src/HypercertMinter"; | ||
export { AllowlistMinter } from "../typechain/src/AllowlistMinter"; | ||
export { HypercertMinter, AllowlistMinter }; | ||
|
||
// Factories | ||
export { HypercertMinter__factory as HyperCertMinterFactory } from "../typechain/factories/src/HypercertMinter__factory"; | ||
export { HypercertMinter__factory as HypercertMinterFactory }; | ||
|
||
// Libs | ||
export { Errors }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"assumeChangesOnlyAffectDirectDependencies": true, | ||
"allowJs": true, | ||
"allowSyntheticDefaultImports": true, | ||
"alwaysStrict": true, | ||
"assumeChangesOnlyAffectDirectDependencies": true, | ||
"declaration": true, | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"incremental": true, | ||
"composite": true, | ||
"lib": ["esnext"], | ||
"module": "ESNext", | ||
"moduleResolution": "nodenext", | ||
"noImplicitThis": true, | ||
"outDir": "dist", | ||
"resolveJsonModule": true, | ||
"rootDir": "src", | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"target": "es6" | ||
"strictNullChecks": true | ||
}, | ||
"files": ["src/index.ts"], | ||
"include": [ | ||
"typechain/common.ts", | ||
"abi/HypercertMinter.json", | ||
"abi/IHypercertToken.json", | ||
"abi/SemiFungible1155.json", | ||
"abi/ERC1155Upgradeable.json", | ||
"typechain/src/interfaces/IHypercertToken.ts", | ||
"typechain/src/HypercertMinter.ts", | ||
"typechain/src/AllowlistMinter.ts", | ||
"typechain/factories/src/HypercertMinter__factory.ts" | ||
], | ||
"include": ["src/**/*.ts", "src/abi/*.json"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"compilerOptions": { | ||
"outDir": "dist/cjs", | ||
"module": "commonjs", | ||
"target": "es2015" | ||
} | ||
} |
Oops, something went wrong.