mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-10 13:55:45 +00:00
5418f16082
Make changes by running these commands in the root of the monorepo: **bugs** ```shell npx lerna exec --concurrency 1 --stream -- \ 'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \ npx json -I -f package.json -e "this.bugs=\ \"https://github.com/embark-framework/embark/issues\""' ``` **homepage** ```shell npx lerna exec --concurrency 1 --stream -- \ 'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \ npx json -I -f package.json -e "this.homepage=\ \"https://github.com/embark-framework/embark/tree/master/${DIRPATH}#readme\""' ``` Don't commit changes to private packages, with the exceptions of embark-typings and embark-reset because those may switch from private to public, and also because the latter will be included in `node_modules` of embark even if it is private since embark-reset is presently a bundled dependency of embark. Don't include the homepage and bugs fields in dapps generated from the template packages, except for the demo. Set those dapps' description field to an empty string. Ensure every package (inc. private packages) has a description. Ensure every package (inc. private packages) has a README that begins with: ```markdown `[pkgJson.name]` ================ > [pkgJson.description] Visit [embark.status.im](https://embark.status.im/) to get started with [Embark](https://github.com/embark-framework/embark). ``` Don't include the README in dapps generated from the template packages, except for the demo.
67 lines
1.7 KiB
Markdown
67 lines
1.7 KiB
Markdown
# `embark-compiler`
|
|
|
|
> Embark compiler module
|
|
|
|
Visit [embark.status.im](https://embark.status.im/) to get started with
|
|
[Embark](https://github.com/embark-framework/embark).
|
|
|
|
This module abstracts the compiler interface. It exposes a plugin api to
|
|
register contract extensions and how to handle them. It accepts command
|
|
requests to compile and returns the aggregated compilation result.
|
|
|
|
## API
|
|
|
|
**command: `compiler:contracts`**
|
|
|
|
arguments:
|
|
|
|
* `contractFiles` - <array of embark File Objects>
|
|
* `options` - <object> config object `{isCoverage: boolean (default: false)}`
|
|
|
|
response:
|
|
|
|
* `error`
|
|
* `compiledObject` - compilation result
|
|
```
|
|
{
|
|
runtimeBytecode: <deployed bytecode>
|
|
realRuntimeByteCode: <deployed bytecode without swarm hash>
|
|
code: <bytecode>
|
|
abiDefinition: <abi object>
|
|
|
|
swarmHash: (optional)
|
|
gasEstimates: (optional)
|
|
functionHashes: (optional)
|
|
filename: (optional) <contract relative filename>
|
|
originalFilename: (optional) <contract real filename>
|
|
}
|
|
```
|
|
|
|
example:
|
|
|
|
```
|
|
import { File } from 'src/lib/core/file.js';
|
|
const contractFiles = [(new File({path: "simplestorage.sol", type: "custom", resolver: (cb) => { return cb(".. contract code...") }}))];
|
|
|
|
embark.events.request("compiler:contracts", contractFiles, {}, (err, compiledObject) => {
|
|
})
|
|
|
|
```
|
|
|
|
## Plugins
|
|
|
|
This module enables the `registerCompiler` plugin API. see [documentation](https://embark.status.im/docs/plugin_reference.html#embark-registerCompiler-extension-callback-contractFiles-doneCallback)
|
|
|
|
***embark.registerCompiler***
|
|
|
|
arguments:
|
|
|
|
* `extension` - extension of the contract language (e.g `.sol`)
|
|
* response callback
|
|
* `contractFiles`: filenames matching the extension
|
|
* `callback(error, compiledObject)`
|
|
|
|
## Dependencies
|
|
|
|
* async.eachObject
|