Skip to content

Commit

Permalink
Follow 1155 contracts way to publish with source code
Browse files Browse the repository at this point in the history
  • Loading branch information
oveddan committed Jun 27, 2023
1 parent d1f8797 commit d9870c8
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ cache
.pkey
.env.*
dist/
out/
.idea
broadcast/
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ solc_version = '0.8.17'
optimizer = true
optimizer_runs = 3000
via_ir = true
out = 'dist/artifacts'
out = 'out'
test = 'test'
src = 'src'
libs = ['lib']
Expand Down
7 changes: 1 addition & 6 deletions js-scripts/bundle-chainConfigs.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { readdirSync, readFileSync, writeFileSync } from 'fs';

// Reads all the chain configs in ./chainConfigs folder, and bundles them into a typescript
// definition that looks like:
// export const chainConfigs = {
// [chainId]: {
// ...chainConfig
// }
//}
// definition
function makeConfig() {
// read all files in the chainConfigs folder
const files = readdirSync('chainConfigs');
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@
"private": false,
"type": "module",
"files": [
"dist/chainConfigs/*",
"dist/addresses/*",
"dist/index*"
"dist/",
"src/",
"addresses/",
"chainConfigs/",
"package/"
],
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"scripts": {
"test": "forge test",
"generate-merkle-test-file": "node scripts/merkle-test.mjs",
"clean": "rm -rf ./dist/",
"prepack": "node js-scripts/copy-latest-deployment-addresses.mjs && yarn run wagmi && yarn build-ts && yarn copy-addresses-and-configs",
"prepack": "yarn clean && node js-scripts/copy-latest-deployment-addresses.mjs && yarn wagmi && yarn bundle-configs && yarn build-ts",
"deploy": "node scripts/deploy.mjs",
"coverage": "forge coverage --report lcov",
"build": "forge build",
"build-ts": "tsup package/index.ts --format cjs --dts --sourcemap",
"bundle-configs": "node js-scripts/bundle-chainConfigs.mjs && yarn format",
"prettier": "npx prettier \"js-scripts/**/*.mjs\" \"package/**/*.ts\" \"wagmi.config.ts\" --check",
"prettier:fix": "npm run prettier -- --write",
"copy-addresses-and-configs": "cp -r addresses/ dist/addresses && cp -r chainConfigs/ dist/chainConfigs",
"wagmi": "wagmi generate",
"storage-inspect:check": "./script/storage-check.sh check ERC721Drop ERC721DropProxy FactoryUpgradeGate ZoraNFTCreatorProxy ZoraNFTCreatorV1",
"storage-inspect:generate": "./script/storage-check.sh generate ERC721Drop ERC721DropProxy FactoryUpgradeGate ZoraNFTCreatorProxy ZoraNFTCreatorV1"
Expand Down
9 changes: 4 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"lib": ["es2021"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noImplicitAny": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
Expand All @@ -18,11 +17,11 @@
"strict": true,
"strictNullChecks": true,
"target": "es2021",
"types": ["node"]
"types": ["node"],
"outDir": "dist"
},
"exclude": ["node_modules/**", "dist/**"],
"include": [
"package/**/*.ts",
"js-scripts/**/*.mjs"
]
"package/**/*.ts"
],
}
10 changes: 10 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'tsup'

export default defineConfig({
entry: ['package/index.ts'],
sourcemap: true,
clean: true,
dts: false,
format: ['cjs'],
onSuccess: 'tsc --emitDeclarationOnly --declaration --declarationMap'
})
18 changes: 18 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,17 @@ glob@7.1.6:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^10.2.5:
version "10.3.0"
resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.0.tgz#763d02a894f3cdfc521b10bbbbc8e0309e750cce"
integrity sha512-AQ1/SB9HH0yCx1jXAT4vmCbTOPe5RQ+kCurjbel5xSCGhebumUv+GJZfa1rEqor3XIViqwSEmlkZCQD43RWrBg==
dependencies:
foreground-child "^3.1.0"
jackspeak "^2.0.3"
minimatch "^9.0.1"
minipass "^5.0.0 || ^6.0.2"
path-scurry "^1.7.0"

glob@^10.2.7:
version "10.2.7"
resolved "https://registry.yarnpkg.com/glob/-/glob-10.2.7.tgz#9dd2828cd5bc7bd861e7738d91e7113dda41d7d8"
Expand Down Expand Up @@ -2156,6 +2167,13 @@ reusify@^1.0.4:
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==

rimraf@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.1.tgz#0881323ab94ad45fec7c0221f27ea1a142f3f0d0"
integrity sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==
dependencies:
glob "^10.2.5"

rollup@^3.2.5:
version "3.21.6"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.21.6.tgz#f5649ccdf8fcc7729254faa457cbea9547eb86db"
Expand Down

0 comments on commit d9870c8

Please sign in to comment.