0.8.0 โ€ข Published 2 years ago

@buidlerlabs/rollup-plugin-hedera-strato v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Hedera Strato Rollup

Discord support channel contributions license node version

... rollup's best friend for bundling Strato

Quick. No questions asked, TL;LDR;

Do a

npm install --save-dev @buidlerlabs/rollup-plugin-hedera-strato

then, in your rollup.config.json or any other Rollup config option of preference, do

import strato from "@buidlerlabs/rollup-plugin-hedera-strato";

//...
export default {
  //...
  plugins: [
    strato(),
    //...
  ]
  //...
}

That's it! ๐Ÿพ Now you can bundle your dApp and have Strato embedded in it, ready to be used. ๐Ÿฅ‚

Config-ing

You can configure the plugin by passing in an object with the following properties and meaning:

PropDescription
contracts.pathWhere to load the solidity contracts from
contracts.recursetrue to deep load all the inner directory's contracts from contracts.path, false to only load the provided top directory
environmentThe environment object passed to Strato to be used when creating ApiSession.default instances
includeCompilertrue to embed a web-worker that will allow in-browser compilation (note: the solidity compiler is lazy loaded the first time a Contract.newFrom/Contract.allFrom is called) and false if you don't intend to use this feature (conserves bandwidth)
sourceMaptrue to include the source-map (helpful for debugging), false otherwise

Embedding the plugin with no such object is equivalent to virtually calling:

strato({
  contracts: {
    path: './contracts',
    recurse: false
  },
  environment: process.env,
  includeCompiler: false,
  sourceMap: false
})

For an immediate working example, have a look at our bundler recipe used by our test-base.

Further docs

Need more context and configurability? Check our official docs page for more info.

Testing it

Have the .env file ready (see above) and run

$ npm test

Contributions

... are more then welcome! Head over to our issues page and let us know your thoughts or, better yet, open that PR and lets discuss it there!

Oh! And if you ever feel like talking to us, you can reach us on discord. We're very friendly! ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ

License

This work has been published under the MIT License.