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 🙏

© 2025 – Pkg Stats / Ryan Hefner

truffle-migrate-off-chain

v0.1.5

Published

Off-chain migrations for Truffle

Readme

Truffle Migrate: Off-chain

This library acts as a drop-in replacement for Truffle's migrate command. This command still runs the same migration files, but it stores the migration version and deployed contract addresses for each network off-chain in the local filesystem. This means that development networks can added to .gitignore, and production deployments can be committed: allowing easier integration with continuous deployment processes.

Setup

Install the library in an existing Truffle project:

npm install --save-dev truffle-migrate-off-chain

Usage

To run your migrations call the command:

truffle-migrate-off-chain

If you have existing migrations then this command will behave like migrate --reset.

Options

The command currently supports all Truffle options, including --dry-run and --network selection.

Migrating Existing Projects

If you're migrating from truffle migrate then you can preserve your deployed contracts by manually creating a network config.

For example, to declare an existing set of contracts on the Ropsten network you could create the file networks/3.json:

// networks/3.json

{
  migrationVersion: 123512351235, // latest migration version
  contracts: [
    {
      contractName: 'CryptoDoggies',
      address: '0x...' // address of contract on network
    }
  ]
}

Behaviour

This library stores the migration version and deployed contract addresses in 'network config' JSON files. A file is created for every deployed network under the networks directory.

For example:


// networks/3.json

{
  migrationVersion: 152323422,
  contracts: [
    {
      contractName: 'CryptoDoggies',
      address: '0x...'
    }
  ]
}

Whenever truffle-migrate-off-chain is called, it will:

  1. Run any migrations that are new.
  2. Update the network config to the newest migration version and add any new contracts
  3. Update the Truffle contract build artifacts to point to the latest deployed contracts on the networks.

The key here is that the Truffle build artifact network addresses are derived from the network configs; this allows you to persist the production config so that your continuous build server will build the front-end with the latest addresses.

Limitations

  • Different networks may have different versions of a contract's bytecode deployed. However, they will all still be added to the same Truffle artifact. This means that the address is not strictly tied to an ABI. It's unlikely to be a problem but it's something to keep in mind. This is really an existing issue, however.

  • Deploying a contract to the same network twice is not currently supported. Networks are distinguished by their network_id rather than an alias, so you have to scope the 'latest' set of contracts by network.

  • It's currently built against Truffle 4.1.5, but it's likely that it will work with older versions of Truffle as well. If you want to test it and submit a PR that would be fantastic!

  • You still need to keep the Migrations.sol contract and migration around so that the truffle test command works.

License

Note that this project borrows code heavily from truffle-migrate and truffle-core. This code is similarly licensed under the MIT license.