{"id":15650677,"url":"https://github.com/paulrberg/hardhat-packager","last_synced_at":"2025-08-15T17:31:54.072Z","repository":{"id":40553057,"uuid":"382001290","full_name":"PaulRBerg/hardhat-packager","owner":"PaulRBerg","description":"Hardhat plugin for preparing the contract artifacts and the TypeChain bindings for registry deployment","archived":false,"fork":false,"pushed_at":"2024-06-13T16:36:49.000Z","size":4707,"stargazers_count":36,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-09T07:39:59.327Z","etag":null,"topics":["hardhat","hardhat-plugin","npm-package","typechain"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PaulRBerg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://3cities.xyz/#/pay?c=CAESFAKY9DMuOFdjE4Wzl2YyUFipPiSfIgICATICCAJaFURvbmF0aW9uIHRvIFBhdWwgQmVyZw","github":"PaulRBerg"}},"created_at":"2021-07-01T10:52:51.000Z","updated_at":"2024-11-06T16:34:11.000Z","dependencies_parsed_at":"2024-06-18T16:46:55.872Z","dependency_job_id":"d42816d0-c3dd-4a87-b745-4295ee4469a1","html_url":"https://github.com/PaulRBerg/hardhat-packager","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/PaulRBerg/hardhat-packager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fhardhat-packager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fhardhat-packager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fhardhat-packager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fhardhat-packager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaulRBerg","download_url":"https://codeload.github.com/PaulRBerg/hardhat-packager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fhardhat-packager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270603952,"owners_count":24614606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hardhat","hardhat-plugin","npm-package","typechain"],"created_at":"2024-10-03T12:35:28.976Z","updated_at":"2025-08-15T17:31:53.605Z","avatar_url":"https://github.com/PaulRBerg.png","language":"TypeScript","funding_links":["https://3cities.xyz/#/pay?c=CAESFAKY9DMuOFdjE4Wzl2YyUFipPiSfIgICATICCAJaFURvbmF0aW9uIHRvIFBhdWwgQmVyZw","https://github.com/sponsors/PaulRBerg"],"categories":[],"sub_categories":[],"readme":"# Hardhat Packager [![GitHub Actions][gha-badge]][gha] [![Coverage Status][coveralls-badge]][coveralls] [![Styled with Prettier][prettier-badge]][prettier] [![License: MIT][license-badge]][license]\n\n[gha]: https://github.com/paulrberg/hardhat-packager/actions\n[gha-badge]: https://github.com/paulrberg/hardhat-packager/actions/workflows/ci.yml/badge.svg\n[coveralls]: https://coveralls.io/github/paulrberg/hardhat-packager\n[coveralls-badge]: https://coveralls.io/repos/github/paulrberg/hardhat-packager/badge.svg?branch=main\n[prettier]: https://prettier.io\n[prettier-badge]: https://img.shields.io/badge/Code_Style-Prettier-ff69b4.svg\n[license]: https://opensource.org/licenses/MIT\n[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg\n\nHardhat plugin for preparing the contract artifacts and the TypeChain bindings for registry deployment.\n\n## Description\n\nThis plugin builds on top the [TypeChain plugin](https://github.com/ethereum-ts/TypeChain/tree/master/packages/hardhat)\nto prepare the contract artifacts and TypeChain bindings for being deployed to a package registry (e.g.\n[npmjs.org](https://npmjs.org)). More specifically, it deletes all artifacts and bindings that are not in an allowlist of\ncontracts, minifying the directory structure in the process.\n\n## Installation\n\nFirst, install the plugin and its peer dependencies. If you are using Ethers or Waffle, run:\n\n```sh\nyarn add --dev hardhat-packager typechain @typechain/hardhat @typechain/ethers-v5\n```\n\nOr if you are using Truffle, run:\n\n```sh\nyarn add --dev hardhat-packager typechain @typechain/hardhat @typechain/truffle-v5\n```\n\nSecond, import the plugin in your `hardhat.config.js`:\n\n```javascript\nrequire(\"@typechain/hardhat\");\nrequire(\"hardhat-packager\");\n```\n\nOr, if you are using TypeScript, in your `hardhat.config.ts`:\n\n```typescript\nimport \"@typechain/hardhat\";\nimport \"hardhat-packager\";\n```\n\n## Required plugins\n\n- [@typechain/hardhat](https://github.com/ethereum-ts/TypeChain/tree/master/packages/hardhat)\n\n## Tasks\n\nThis plugin adds the _prepare-package_ task to Hardhat:\n\n```text\nPrepares the contract artifacts and the TypeChain bindings for registry deployment\n```\n\n## Environment Extensions\n\nThis plugin does not extend the Hardhat Runtime Environment.\n\n## Configuration\n\nThis plugin extends the `HardhatUserConfig` object with an optional `packager` object. This object contains one field,\n`contracts`. This is an array of strings that represent the names of the smart contracts in your project. The plugin\nuses this array as an allowlist for the artifacts and the bindings that should be kept for registry deployment.\n\nAn example for how to set it:\n\n```javascript\nmodule.exports = {\n  packager: {\n    // What contracts to keep the artifacts and the bindings for.\n    contracts: [\"MyToken\", \"ERC20\"],\n    // Whether to include the TypeChain factories or not.\n    // If this is enabled, you need to compile the TypeChain files with the TypeScript compiler before shipping to the registry.\n    includeFactories: true,\n  },\n};\n```\n\n## Usage\n\nTo use this plugin you need to decide which contracts you would like to be part of the package deployed to the registry.\nRefer to the [configuration](./README.md#configuration) section above.\n\nThen run this:\n\n```sh\nyarn hardhat prepare-package\n```\n\nAnd go look what you got in the `artifacts` and the `typechain` directory.\n\n### Tips\n\n- You may want to add the `/artifacts`, `/contracts` and `/typechain` globs to the\n  [files](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files) field in your `package.json` file.\n- You may want to blocklist some files, such as test contracts. You can do this via an\n  [.npmignore](https://docs.npmjs.com/cli/v7/using-npm/developers#keeping-files-out-of-your-package) file.\n- See how the plugin is integrated in [@hifi/protocol](https://github.com/hifi-finance/hifi/tree/main/packages/protocol), and how the artifacts and\n  the bindings are used in [@hifi/deployers](https://github.com/hifi-finance/hifi/tree/main/packages/deployers).\n\n## License\n\n[MIT](./LICENSE.md) © Paul Razvan Berg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulrberg%2Fhardhat-packager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulrberg%2Fhardhat-packager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulrberg%2Fhardhat-packager/lists"}