2019-04-18 10:33:52 +00:00
|
|
|
docs:
|
|
|
|
getting_started:
|
|
|
|
overview: overview.html
|
|
|
|
installation: installation.html
|
|
|
|
faq: faq.html
|
|
|
|
|
|
|
|
general_usage:
|
|
|
|
creating_project: create_project.html
|
|
|
|
structure: structure.html
|
|
|
|
running_apps: running_apps.html
|
|
|
|
dashboard: dashboard.html
|
|
|
|
using_the_console: using_the_console.html
|
|
|
|
environments: environments.html
|
|
|
|
configuration: configuration.html
|
|
|
|
pipeline_and_webpack: pipeline_and_webpack.html
|
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-04 10:47:12 +00:00
|
|
|
executing_migration_scripts: executing_scripts.html
|
2019-04-18 10:33:52 +00:00
|
|
|
# setting_up_storages: foo.html
|
|
|
|
# uploading_data: foo.html
|
|
|
|
# configuring_whisper: foo.html
|
|
|
|
# working_with_ens: foo.html
|
|
|
|
javascript_usage: javascript_usage.html
|
|
|
|
|
|
|
|
smart_contracts:
|
|
|
|
contracts_configuration: contracts_configuration.html
|
|
|
|
contracts_deployment: contracts_deployment.html
|
|
|
|
contracts_imports: contracts_imports.html
|
|
|
|
contracts_testing: contracts_testing.html
|
|
|
|
contracts_javascript: contracts_javascript.html
|
|
|
|
|
|
|
|
blockchain_node:
|
|
|
|
blockchain_configuration: blockchain_configuration.html
|
|
|
|
blockchain_accounts_configuration: blockchain_accounts_configuration.html
|
|
|
|
|
|
|
|
storage:
|
|
|
|
storage_configuration: storage_configuration.html
|
|
|
|
storage_deployment: storage_deployment.html
|
|
|
|
storage_javascript: storage_javascript.html
|
|
|
|
|
|
|
|
messages:
|
|
|
|
messages_configuration: messages_configuration.html
|
|
|
|
messages_javascript: messages_javascript.html
|
|
|
|
|
|
|
|
naming:
|
|
|
|
naming_configuration: naming_configuration.html
|
|
|
|
naming_javascript: naming_javascript.html
|
|
|
|
|
|
|
|
# embarkjs:
|
|
|
|
# installing_embarkjs: installing_embarkjs.html
|
|
|
|
# smart_contract_objects: smart_contract_objects.html
|
|
|
|
# using_storages: using_storages.html
|
|
|
|
# sending_and_receiving_messages: sending_and_receiving_messages.html
|
|
|
|
# working_with_name_systems: working_with_name_systems.html
|
|
|
|
plugins:
|
|
|
|
installing_a_plugin: installing_plugins.html
|
|
|
|
creating_a_plugin: creating_plugins.html
|
|
|
|
plugin_reference: plugin_reference.html
|
|
|
|
#advanced_topis:
|
|
|
|
#adwebpack: webpack.html
|
|
|
|
cockpit:
|
|
|
|
cockpit_introduction: cockpit_introduction.html
|
|
|
|
cockpit_dashboard: cockpit_dashboard.html
|
|
|
|
cockpit_deployment: cockpit_deployment.html
|
|
|
|
cockpit_explorer: cockpit_explorer.html
|
|
|
|
cockpit_editor: cockpit_editor.html
|
|
|
|
cockpit_debugger: cockpit_debugger.html
|
|
|
|
#cockpit_utils: cockpit_utils.html
|
|
|
|
reference:
|
|
|
|
# console_commands: console_commands.html
|
|
|
|
embark_commands: embark_commands.html
|
|
|
|
miscellaneous:
|
|
|
|
migrating_from_3: migrating_from_3.x.html
|
|
|
|
troubleshooting: troubleshooting.html
|
|
|
|
contributing: contributing.html
|