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

solpm

v0.1.6

Published

a small tool to clone and compile smart contracts

Downloads

2

Readme

solpm

solpm is a small tool to import solidiy contracts from github repositories and use them for your project. It also automatically configures the solc-js compiler to use with your project.

usage

installing solidity packages (= git repositories)

The command solpm --install or solpm -iwill install all the dependencies listed in the "solidiy-package.json"-file. CLI-Options:

  • -p or --package using a different solidity-package.json file
  • -m or --soliditymodule using a different folder to extract the downloaded files to
  • -y or --autoApprove automatically approves the deletion confirmation

Without any options provided spm will use the "solidity-package.json"-file in the root-directory of the project and will install all packages to a "solidity_modules" folder.

Caution At the beginning of the package-installation all files inside the solidity_modules folder will be deleted. If the directory already exists, you will have to confirm the deletion (unless you are using auto-approval).

Currently, spm only clones the git-repositories through https, so you will need an access-token set.

By default, spm will try to clone the branch set as default in git. With the addition of #BRANCHNAME you can also specify a specific branch and spm will try to use the branch. If an error occurs it will fallback to the default branch.

example

solpm -i -p newSolidity-package.json -m importedContracts will read the newSolidity-package.json-file and install the dependencies through git-clone to the importedContracts-folder (which will be created if not existing).

usage within smart contracts

After the installation of the solidity packages you can use them in your own smart contracts!.

example

You have a solidity-package.json file that looks like this:

{
    "name": "ExampleUsage",
    "dependencies": {
        "example-usage-contracts": "https://github.com/..."
    }
}

You can import all the contracts from this repositories in your own smart contracts with the command

import "example-usage-contracts/PATH_TO_SOLC_FILE";

The spm compiler will do the remapping by himself!

compiling

The command solpm --compile or solpm -cwill try to compile the solidity contracts. CLI-options

  • -s or --source changes the root-directory for the contracts to be compiles
  • -t or --target changes the output directory for the compiled contracts
  • -p or --package changes the solidity-package.json file
  • -m or --soliditymodule changes the root-directy of the installed contract-packages
  • -d or --disableOptimizer disables the solc-optimizer
  • -r or --optimizerRuns changes the number of optimizer runs
  • -y or --autoApprove automatically approves the deletion confirmation
  • --save writes the created solc-configuration file as "compilerConfig.json" to the root-directory
  • --nowarnings disables solc-compiler warnings (errors will still be shown)

spm will try to read the "solidity-package.json"-file (or the provided package name) and adjust the remappings automatically. For each contract it will create an own file with the

  • abi
  • bytecode
  • deployedBytecode
  • contractName

in the "contract-build" (or your target)-folder.

Caution At the beginning of the package-installation all files inside the output directory will be deleted. If the directory already exists, you will have to confirm the deletion (unless you are using auto-approval).

example

The command solpm -c -s myContractSource -t myCompileTarget -p mySolidity-package.json -m mySolidityModules -r 500 --save --nowarnings will compile the all solidity files in myContractSource and its subdirectories and put the compiles JSON-files in the myCompileTarget folder. It will try to read the "mySolidity-package.json" file and create the remappings (found in the dependencies). It will also setup the compiler to do 500 runs, write the created solc-compiler config to the root-directory of the project and it will not show solc-compile-warnings (but errors).