The embark-utils package, since 4.1.0-beta.1, is a transitive DApp dependency;
but it's loaded in the main process (not a child process), so embark-utils' own
deps can't be indirectly supplied from embark itself via NODE_PATH.
When introducing the `embark-api-client` in https://github.com/embark-framework/embark/commit/c1bbdbf34
we didn't properly update Cockpits apiService, resulting in calls to API endpoints
that don't exist.
This commit fixes a bug where calls to Embark's API to subscribe to whisper
channels are in a broken state.
It also updates Cockpit's apiService to no longer pass ignored parameters to embark-api-client.
With the move of Embark's modules into their own packages, the names under
which they are registered in the API service have changed as well.
This caused Cockpit to no longer being able to properly detect whether
ENS is enabled in the current Embark project
This package comes with a `setUpEnv()` function that can be called to
prepare Embark's environment variables for different process contexts.
This allows us to set up Embark's environment within a test runner context
without the requirement of importing `packages/embark/src/lib/core/env.js`,
which happens to set up those necessary environment variables as a side effect.
It's important that a path to `packages/embark`'s root is passed down to `setUpEnv()`
to ensure `EMBARK_PATH` gets the correct value.
E.g. within a package `embark-console`, `setUpEnv()` can be called within its tests
like the following:
```
// packages/embark-console/src/test/console.js
import { joinPath, setUpEnv } from 'embark-utils';
setUpEnv(joinPath(__dirname, '../../../embark'));
```
Here, `__dirname + '../../../embark'` ensures `EMBARK_PATH` points to the root
of `packages/embark`. This might look different in other contexts.
For example calling this function from a test file within `packages/embark`, this would
look like this:
```
// packages/embark/src/test/some_file.js
import { joinPath, setUpEnv } from 'embark-utils';
setUpEnv(joinPath(__dirname, '../../'));
```
As part of 880a3a6946, we've introduced a
regression where the `colors` package isn't imported in the scope anymore where it's
needed. In this case the pipeline package. This resulted in log output messages
such as:
```
undefinedwriting fileundefined
```
Adding the `colors` package as dependency and importing it accordingly
fixes the issue.
Make the adjustment even if the test script is currently disabled. Consistently
use nyc to generate coverage with mocha even if the test script is currently
disabled.
If the `embark` cli is detected to be inside the monorepo, the template
generator yarn-links any template deps that are part of the monorepo into the
dapp. However, `embarkjs-connector-web3` now has a dependency on `embark-core`,
which in turn has a dependency on `embark-i18n`. That causes `npm install` to
fail inside the dapp because npm checks for deps of `embarkjs-connector-web3`
relative to the dapp instead of checking relative to the symlink. `yarn
install` does not suffer from that behavior so use it instead.
The demo's `embark.json` relies on the bootstrap package being within the
demo's own `node_modules`, but in the monorepo yarn was hoisting it up to the
root `node_modules`.
Move the debugger module to the `embark-debugger` package.
Handle case where `debug` is entered as a console command, and there is no transaction to be debugged.
add embark-i18n and mocha deps
Add support for `service api on/off` commands.
Deprecate commands `api start/stop` in favor of `service api on/off`.
`service api on` - Enables the API server serving Cockpit. Shows an error if the API server is already starting or started.
`service api off` - Disables the API server serving Cockpit. Shows an error if the API server is already stopping or stopped.
`api start` - This command has been deprecated in favor of `service api on` and will be removed in future versions.
`api stop` - This command has been deprecated in favor of `service api off` and will be removed in future versions.
`api:start` - This event has been deprecated and will be removed in future versions.
`api:stop` - This event has been deprecated and will be removed in future versions.
Remove support for `service whisper on/off` because Whisper cannot be started without first disabling it in the communications config, then restarting Embark.
Add documentation for the `service [process] on/off` command
This command was only added a few commits back so it is not considered a breaking change.
Refactor the `service [process] on/off` commands so that there is only one command. Previously we had a command registered for each process, ie:
```
service blockchain on/off
service ipfs on/off
…
```
Now, we only have one command with many options:
```
service [process] on/off - Starts/stops the process. Options: blockchain, embark, ipfs, api
```
Whisper is deliberately not included in the available options for the aforementioned reasons.
This enables removing unnecessary `core/fs` dependencies which can be
replaced with `fs-extra`.
This commit also fixes a bug introduced in f868d1216d
where methods from `embark.fs` weren't available.
The reason for that is because we have several *Process instances
that are created through child process communication, specifically
process.send() APIs. Using those APIs, we can only send data structures
however, methods attached on any of those will get lost.
This is the case when sending embark.fs through process.send().
We still need fs in those places though, mostly because they are relying
on embarkPath and dappPath().
These places are now importing those functions from `embark-core`. Other
API such as writeFile or mkdirp() can be accessed through fs-extra
or fs modules.
This pull-request upgrades `ethereumjs-wallet`, which has upgraded the underlying dependency on scrypt.js to 0.3.0, making scrypt an optional dependency and offering a pure JS version as a fallback.
The reasoning behind this is that scrypt is problematic to install in some systems, particularly those that don't have node-gyp setup and we have seen some weird issues when installing with elevated privileges (i.e. `sudo npm install -g scrypt`)
This avoids mistakenly placing process event handlers on the parent process
whenever the `embark-core` package is loaded. Also, don't listen for an
`'exit'` event on `process` and then call `process.exit(0)` since the event "is
emitted after the child process ends" ([docs][docs]), i.e. it's unnecessary to
do so and in any case it's not correct to always exit with code `0`.
[docs]: https://nodejs.org/docs/latest-v10.x/api/child_process.html#child_process_event_exit
Add support for ability to start and stop Swarm via command `service swarm on/off`.
Fix issue with swarm not starting due to missing web3 object.
`service swarm on` - starts a swarm node if not already started. Shows an error if the node is already starting or started.
`service swarm off` - kills the running swarm node as long as Embark has started the swarm process. If the swarm process was started externally, an error is shown.
We lost this when we moved the site into the monorepo because
all `dist` folders were ignored.
Co-Authored-By: PascalPrecht <pascal.precht@googlemail.com>
In addition to introducing improvements per #1492 and #1494, adjust the
transactions request action to allow for a `blockLimit` argument, since that
API parameter is supported by embark.
Revise `changePage` to invoke `fetchTransactions` correctly, i.e. with
arguments pertaining to a starting block number and a block limit.
These changes together fix most of the pagination problems related to exploring
transactions, i.e. badly mis-ordered results are no longer displayed.
However, a *wart* still remains related to estimation of the total number of
transactions and pages. Sometimes the calculated number of pages for the
transactions explorer doesn't match up to the actual number of transactions on
the blockchain (owing to estimation). The pagination controls and display of
transactions will temporarily behave a little strangely if one jumps ahead in
the pages, e.g. a jump from cockpit explorer overview's transactions page 1 to
page 5 for embark's demo, if an additional transaction has been added and the
explorer overview is freshly loaded. This behavior is related to the fact that
actions such as `fetchBlocksFull` and `fetchTransactions` are async without any
means to determine when all actions have completed and React re-/rendering has
settled down.
There are probably some architectural changes that could improve the situation,
but they're outside the scope of this PR and in no way easy to solve by means
of React lifecycle methods. In fact, attempts to make an improvement with
`componentDidUpdate` (and watching what happens in the debugger) revealed the
nature of the problem, as described above.