Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include contract source and typescript source in export #124

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this allows the source code files to have "go to definition" on package impor

})