diff --git a/.gitignore b/.gitignore index 1cca58d..f3e70ce 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,6 @@ cache .pkey .env.* dist/ +out/ .idea broadcast/ \ No newline at end of file diff --git a/foundry.toml b/foundry.toml index b1e7bec..8f14bb6 100644 --- a/foundry.toml +++ b/foundry.toml @@ -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'] diff --git a/js-scripts/bundle-chainConfigs.mjs b/js-scripts/bundle-chainConfigs.mjs index ec6567c..0f0b4f3 100644 --- a/js-scripts/bundle-chainConfigs.mjs +++ b/js-scripts/bundle-chainConfigs.mjs @@ -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'); diff --git a/package.json b/package.json index 345b461..62c4bd9 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,11 @@ "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", @@ -17,7 +19,7 @@ "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", @@ -25,7 +27,6 @@ "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" diff --git a/tsconfig.json b/tsconfig.json index 804ca73..ed93685 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "lib": ["es2021"], "module": "esnext", "moduleResolution": "node", - "noEmit": true, "noImplicitAny": true, "noUncheckedIndexedAccess": true, "noUnusedLocals": true, @@ -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" + ], } \ No newline at end of file diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..3be140a --- /dev/null +++ b/tsup.config.ts @@ -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' +}) \ No newline at end of file