Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms https://framework.embarklabs.io/
Go to file
Pascal Precht 40c3d98217 feat(plugins/scripts-runner): introduce exec command to run scripts
This commit introduces a new feature that enables users to run (migration) scripts.
Similar to deployment hooks, scripts are functions that may perform operations on newly
deployed Smart Contracts.

Therefore a script needs to export a function that has access to some dependencies:

```
// scripts/001-some-script.js

module.exports = async ({contracts, web3, logger}) => {
  ...
};
```

Where `contracts` is a map of newly deployed Smart Contract instances, `web3` a blockchain connector
instance and `logger` Embark's logger instance. Script functions can but don't have to be `async`.

To execute such a script users use the newly introduced `exec` command:

```
$ embark exec development scripts/001-some-script.js
```

In the example above, `development` defines the environment in which Smart Contracts are being
deployed to as well as where tracking data is stored.
Alternativey, users can also provide a directory in which case Embark will try to execute every
script living inside of it:

```
$ embark exec development scripts
```

Scripts can fail and therefore emit an error accordingly. When this happens, Embark will
abort the script execution (in case multiple are scheduled to run) and informs the user
about the original error:

```
.. 001_foo.js running....
Script '001_foo.js' failed to execute. Original error: Error: Some error
```

It's recommended for scripts to emit proper instances of `Error`.

(Migration) scripts can be tracked as well but there are a couple of rules to be aware of:

- Generally, tracking all scripts that have been executed by default is not a good thing because
  some scripts might be one-off operations.
- OTOH, there might be scripts that should always be tracked by default
- Therefore, we introduce a dedicated `migrations` directory in which scripts live that should be
  tracked by default
- Any other scripts that does not live in the specified `migrations` directory will not be tracked **unless**
- The new `--track` option was provided

For more information see: https://notes.status.im/h8XwB7xkR7GKnfNh6OnPMQ
2020-02-12 16:47:04 -06:00
.github ci: adjust Nightlies/release job so NPM credentials are always removed 2020-01-20 11:44:26 -06:00
dapps feat(@embark/test-runner): introduce artifacts.require API 2020-02-12 14:17:30 -05:00
packages feat(plugins/scripts-runner): introduce exec command to run scripts 2020-02-12 16:47:04 -06:00
scripts build: do not use the `--all` option with `lerna changed` in the stable release script 2020-02-03 14:56:05 -06:00
site feat(plugins/scripts-runner): introduce exec command to run scripts 2020-02-12 16:47:04 -06:00
.editorconfig Add editor config 2018-10-22 19:25:16 +02:00
.eslintrc.json refactor(@embark/library-manager): restrict versionable packages to only solc 2019-11-08 11:27:20 -06:00
.gitattributes build: `* text=auto` -> `* text=auto eol=lf` 2019-09-15 15:17:45 -05:00
.gitignore build: implement collective typecheck 2019-12-13 13:59:47 -05:00
.npmrc build: introduce a `prepare` script in embark's package.json 2018-12-03 16:24:10 -06:00
.yarnrc build: specify a high network timeout in root .yarnc 2019-02-14 01:26:22 -06:00
CHANGELOG.md chore(prerelease): 5.2.0-nightly.1 2020-02-08 00:12:06 +00:00
CODE_OF_CONDUCT.md chore(@embark) remove extra line 2018-12-24 16:14:01 -05:00
CONTRIBUTING.md chore: rename org references from embark-framework to embarklabs 2020-01-16 15:36:29 -05:00
LICENSE add license 2015-07-10 20:41:45 -04:00
README.md docs: move root readme into packages/embark and symlink into root 2019-05-21 12:12:15 +02:00
azure-pipelines.yml feat: support Node.js v12.x and newer 2020-01-20 08:28:24 -06:00
babel.config.js build(deps-dev): update other @storybook packages to 5.3.9 2020-01-30 17:21:47 -06:00
header.jpg docs: update header image for root README 2019-04-04 12:59:24 -04:00
lerna.json chore(prerelease): 5.2.0-nightly.1 2020-02-08 00:12:06 +00:00
package.json build: update "qa:full" script in same manner as revised "ci:full" 2020-02-03 12:39:26 -06:00
tsconfig.base.json feat(plugins/scripts-runner): introduce exec command to run scripts 2020-02-12 16:47:04 -06:00
tsconfig.json feat(plugins/scripts-runner): introduce exec command to run scripts 2020-02-12 16:47:04 -06:00
tslint.json feat(plugins/scripts-runner): introduce exec command to run scripts 2020-02-12 16:47:04 -06:00
yarn.lock feat(plugins/scripts-runner): introduce exec command to run scripts 2020-02-12 16:47:04 -06:00

README.md

Embark

npm Gitter Build Status Open PRs Closed PRs GitHub commit activity the past week, 4 weeks, year Coverage Status Dependabot Status

What is Embark

Embark is a framework that allows you to easily develop and deploy Decentralized Applications (DApps).

A Decentralized Application is a serverless html5 application that uses one or more decentralized technologies.

Embark currently integrates with EVM blockchains (Ethereum), Decentralized Storages (IPFS), and Decentralized communication platforms (Whisper and Orbit). Swarm is supported for deployment.

With Embark you can:

Blockchain (Ethereum)

  • Automatically deploy contracts and make them available in your JS code. Embark watches for changes, and if you update a contract, Embark will automatically redeploy the contracts (if needed) and the dapp.
  • Contracts are available in JS with Promises.
  • Do Test Driven Development with Contracts using Javascript.
  • Keep track of deployed contracts; deploy only when truly needed.
  • Manage different chains (e.g testnet, private net, livenet)
  • Easily manage complex systems of interdependent contracts.

Decentralized Storage (IPFS, Swarm)

  • Easily Store & Retrieve Data on the DApp through EmbarkJS. Including uploading and retrieving files.
  • Deploy the full application to IPFS or Swarm.
  • Import and deploy contracts hosted on Swarm.

Decentralized Communication (Whisper, Orbit)

  • Easily send/receive messages through channels in P2P through Whisper or Orbit.

Web Technologies

  • Integrate with any web technology including React, Foundation, etc..
  • Use any build pipeline or tool you wish, including grunt, gulp and webpack.
$ npm -g install embark

See Complete Documentation.