npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kodex-data/flat-zeppelin

v0.0.1-rc.4

Published

A hardhat plugin to minify your complex solidity projects, reducing bundle size and optimizing module structure.

Downloads

7

Readme

@kodex-data/flat-zeppelin

@kodex-data/flat-zeppelin is a hardhat plugin that allows you to minify your complex solidity projects, reducing bundle size and optimizing module structure. It is especially useful for projects that rely on large libraries like OpenZeppelin.

Installation

You can install the plugin using Yarn or npm:

yarn add @kodex-data/flat-zeppelin 
# or
npm install @kodex-data/flat-zeppelin 

Configuration

To use the plugin, add the following line at the top of your hardhat.config.ts file:

import '@kodex-data/flat-zeppelin'

Then, add the following configuration object to your hardhat.config.ts file:

export default <HardhatUserConfig>{
  flatZeppelin: {
    /** License added to the cleaned content */
    license: 'MIT',
    /** if provided, flatted solidity file will be saved to given path */
    outputFile: 'flatted.sol',
    /** Temporary directory for storing intermediate files */
    tempDir: './.flat-zeppelin',
    /** Directory to saved flatted typechain types */
    targetDir: './typechain-types',
    /** Whether to keep the temporary directory after running */
    keepTemp: false,
    /** Version to add to the flattened solidity content */
    version: '0.8.4',
    /** Whether to enable debug mode */
    debug: false
  },
  // ...
}

Usage

To flat compile your contracts, run the following command:

npx hardhat flat-build

optimized output:

typechain-types
├── ERC165.ts
├── ERC20.ts
├── ERC20Permit.ts
├── ERC20PermitToken.ts
├── ERC721.ts
├── IERC20.ts
├── IERC20Metadata.ts
├── IERC20Permit.ts
├── IERC721.ts
├── IERC721Enumerable.ts
├── IERC721Metadata.ts
├── IERC721Receiver.ts
├── IGovernor.ts
├── IVotes.ts
├── Multicall2.ts
├── Ownable.ts
├── PhxCollectible.ts
├── Treasury.ts
├── Votes.ts
├── common.ts
├── factories
│   ├── ERC165__factory.ts
│   ├── ERC20PermitToken__factory.ts
│   ├── ERC20Permit__factory.ts
│   ├── ERC20__factory.ts
│   ├── ERC721__factory.ts
│   ├── IERC20Permit__factory.ts
│   ├── IERC20__factory.ts
│   └── index.ts
├── hardhat.d.ts
└── index.ts

normal typechain output:

typechain-types
├── @openzeppelin
│   └── contracts
│       └── token
│           ├── ERC20
│           │   ├── ERC20.ts
│           │   ├── IERC20.ts
│           │   └── extensions
│           │       └── draft-ERC20Permit.sol
│           │           └── ERC20Permit.ts
│           └── ERC721
│               ├── ERC721.ts
│               └── IERC721.ts
├── ERC20.ts
├── ERC20Permit.ts
├── ERC20PermitToken.ts
├── ERC721.ts
├── IERC20.ts
├── IERC721.ts
├── common.ts
├── contracts
│   ├── ERC20PermitToken.ts
├── factories
│   ├── @openzeppelin
│   │   └── contracts
│   │       └── token
│   │           ├── ERC20
│   │           │   ├── ERC20__factory.ts
│   │           │   ├── IERC20__factory.ts
│   │           │   └── extensions
│   │           │       └── draft-ERC20Permit.sol
│   │           │           └── ERC20Permit__factory.ts
│   │           └── ERC721
│   │               ├── ERC721__factory.ts
│   │               └── IERC721__factory.ts
│   ├── ERC20PermitToken__factory.ts
│   ├── ERC20Permit__factory.ts
│   ├── ERC20__factory.ts
│   ├── ERC721__factory.ts
│   ├── IERC20__factory.ts
│   ├── IERC721__factory.ts
│   └── contracts
│       └── ERC20PermitToken__factory.ts
└── index.ts