Previously, storage providers in embarkjs were not waiting for their respective storage process (ipfs and swarm) to start before running `registerProvider` and `setProvider` in the console.
This PR forces the `registerProvider` and `setProviders` from running in the console until the storage processes have loaded. As a side effect, the code generation of `EmbarkJS` must wait for the storage module ot be fully initiated (ie once the processes have launched and the `registerProvider` and `setProviders` have been run) before generating the code.
This fixes errors pertaining to `Could not connect to a storage provider using any of the dappConnections in the storage config` as these errors were typically caused by `setProviders` being called before the storage processes had fully launched.
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.
Prevent embark from crashing when app assets are not specified in `embark.json`.
Previously, if the `app` property of `embark.json` was missing, embark would crash with the error `TypeError: Cannot convert undefined or null to object`.
With this PR, the missing property is null-checked.
Add an `enabled` property to the pipeline config. This lets developers disable the pipeline using the config file.
Updates to the enabled property will be reflected while embark is running. For example if embark is running with the pipeline, setting `enabled: false` in the pipeline config will build/deploy the contracts but not run the pipeline. Conversely, if embark is running with the pipeline disabled, enabling the pipeline in the config will build/deploy the contracts then build the dapp.
`package.json` allows for a [`"files"` whitelist][files] to be specified as an
alternative to a top-level `.npmignore` within a package root. Maintaining
whitelists is generally easier and less error-prone than maintaining
blacklists, so implement a `"files"` list for all non-private packages in the
monorepo and remove unneeded `.npmignore` files.
Switch `embark-reset` from being a private package to one that will be
published, adjust the workspace's `"nohoist"` setting accordingly, and no
longer specify `embark-reset` as a bundled dependency of `packages/embark`. I
originally thought there might be a good reason not to publish it, but I no
longer think so.
Remove unnecessary LICENSE files in `packages/{embark,embark-ui}` since Lerna
will automatically copy the root LICENSE into any packages lacking that file,
i.e. before tarballs are packed and published to the NPM registry.
Change the `"author"` field of `packages/embarkjs-connector-web3` to match the
other packages, i.e. such that it matches the copyright assignment in the root
LICENSE. If that's not a desirable thing to do, then instead that package can
have a separate LICENSE file that has a copyright assignment for `"Jonathan
Rainville"`.
Supply some missing `.npmrc` files in `packages/*`.
[files]: https://docs.npmjs.com/files/package.json#files
https://github.com/embark-framework/embark/pull/1367 introduced a change that prevented the `blockchain_listener` from listening to logs until the IPC server connected. However, the restriction went too far, and included restricting registration of console commands and API endpoints for the regular transactions feature.
This fix reverts the changes that affect registration of regular txs endpoints and console commands.
It's possible to pass a `--require` option to mocha to load a script that sets
up `process.env.DAPP_PATH` as needed for embark's tests; that approach is
preferable to running mocha in a child process because when running in a child
process there seemed to be problems with sources maps and with VS Code's
debugger.
After the changes in this PR, the following works as expected, i.e. when there
are runtime errors line/col numbers are reported per the files in `src/`:
```
$ yarn build:no-ui
$ cd packages/embark
$ npx mocha "dist/test/**/*.js" \
--exit \
--no-timeouts \
--require ./scripts/test.js \
--require source-map-support/register
```
And the following VS Code launch config works well for me:
```json
{
"type": "node",
"request": "launch",
"name": "test - packages/embark",
"cwd": "${workspaceFolder}/packages/embark",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"'dist/test/**/*.js'",
"--exit",
"--no-timeouts",
"--require",
"./scripts/test.js",
"--require",
"source-map-support/register"
],
"autoAttachChildProcesses": true,
"sourceMaps": true
}
```
NOTE for VS Code users: I found it's important to specify
`"'dist/test/**/*.js'"` in the launch config instead of
`"\"dist/test/**/*.js\""`, and that it's important to specify `"program":
"${workspaceFolder}/node_modules/mocha/bin/_mocha"` vs. `"program":
"${workspaceFolder}/packages/embark/node_modules/.bin/mocha"`.
KNOWN ISSUES: when there are runtime errors during `yarn test` in
`packages/embark`, line/col numbers reflect the sources in
`package/embark/dist` because `nyc` isn't setup correctly to use the
source-maps generated by babel. A solution has not yet been found.
See: https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md
Make changes by running this command in the root of the monorepo:
```shell
npx lerna exec --concurrency 1 --stream -- \
'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \
npx json -I -f package.json -e \
"this.repository=\
{\"directory\": \"$DIRPATH\", \
\"type\": \"git\", \
\"url\": \"https://github.com/embark-framework/embark.git\"}"'
```
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 repository field in dapps generated from the template
packages, except for the demo.
Switching between the two tabs shown on the Dashboard for the cockpit was removing some of the logs that were previously displayed. This was due to an overlap in `id`’s being assigned to the logs from different processes.
To alleviate this, the reducers has been updated to not only check `id` but also `process.name`.
Additionally, the reducer was updated so that the number of logs for **each process** is set to `ELEMENTS_LIMIT`. For example, our `ELEMENT_LIMIT` is currently set to `200` and it would have meant that the total number of process logs across all processes would have been capped at 200. The current changes in this PR allow for 400 total logs, given that we have two processes being monitored for logs.
The services websocket was initiated in the AppContainer and causing all child components to continuously re-render every time there was a service check (which is effectively every second). In addition, the socket was never stopped when not needed (ie when the services component was unmounted).
Create a ServicesContainer that initiates the websocket as part of the container, and stops the socket when the container is unmounted.
Move the ContractsList to be part of the ContractsContainer with a `mode` switch.
Add Deployment page title and description.
Previous to this PR, `web3` was only made available to each test case, as it was put in to the global namespace after each test deploy. This was causing issues for tests that use `web3` in the test description (ie in `describe()` or `contract()` functions), as the deploy had not happened yet, and thus `web3` was not yet available. The error encountered in these cases was `web3 is not defined`.
This PR puts `web3` in the global namespace before setting up the tests, making it available to test descriptions.
Allow `embark upload` to upload to IPFS/Swarm even if the storage module is disabled in the storage config.
An easy way to test this is to set `config/storage.js` > `enabled` to `false` in the demo. Then run `embark upload`.
A console warning is meant to appear in the browser console when the dapp is connecting to web3 using metamask and the blockchain client is geth. The warning displays information telling the user they should enable regular transactions to prevent known issues regarding transactions getting stuck.
The issue fixed here pertained to `warnAboutMetamask` vs `warnIfMetamask` - maybe there was a change that introduced this issue upstream.
Additionally, enabling and disabling of regular transactions via an API endpoint did not
Add ability to stop regular txs via query string, and validate request parameters.