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

solidity-boilerplate-creator

v0.1.1

Published

This tool provides a straightforward way to generate Solidity boilerplates for contracts, scripts, and tests.

Downloads

6

Readme

solidity-boilerplate-creator

This tool provides a straightforward way to generate Solidity boilerplates for contracts, scripts, and tests.

Note: I'm a newcomer to Solidity development and have chosen Foundry for my toolchain, inspired by Patrick Collins' Blockchain Developer, Solidity, Foundry Full Course 2023.
This tool is tailored towards that setup and the folder structure recommended in the course.
The boilerplate templates can be modified to your needs, but other than that if you're not using Foundry, this tool might not fit your workflow.

Install

Since this is a CLI tool, I'd suggest that you install the package globally:

npm i -g solidity-boilerplate-creator

Usage

From the root folder containing the src, script, and test directories, run:

sol-create [options] <fileName>

| Option | Description | | ------------- | -------------------------------------------------- | | no option | Create a contract boilerplate in the "src" folder | | -s, --script | Create a script boilerplate in the "script" folder | | -t, --test | Create a test boilerplate in the "test" folder | | -V, --version | Show package version | | -h, --help | Display help for command |

Modifying Templates

If you wish to modify the default boilerplate templates, you can do so by editing the template files located in the templates directory. There are separate templates for contracts, scripts, and tests:

  • header_template.sol: Contains the common header used across all boilerplate types.
  • contract_template.sol: Specific content for contract boilerplates.
  • script_template.sol: Specific content for script boilerplates.
  • test_template.sol: Specific content for test boilerplates.

By modifying these files, you can customize the content of the boilerplates generated by the tool.

Using Placeholders

Placeholders allow for dynamic content insertion into the templates. They are defined in the config.json file and can be used in any template file. For example:

{
  "placeholders": {
    "LICENSE": "MIT",
    "COMPILER_VERSION": "0.8.18",
    "dummy_testing": "Replaced text"
  }
}

Then, in the template files, you can refer to these placeholders by wrapping the keys from the config.json file in double curly braces.

Here's a boilerplate template example:

// SPDX-License-Identifier: {{LICENSE}}

pragma solidity ^{{COMPILER_VERSION}};

//{{dummy_testing}}

And here's the final output:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

//Replaced text

You can define and use as many custom placeholders as you need in the config.json file.

Changelog

v0.1.1

  • Clarified the error messages.

v0.1.0

  • Initial release.
  • Basic functionality is in place for creating contracts, scripts, and tests boilerplates.