Commit Graph

5702 Commits

Author SHA1 Message Date
Michael Bradley, Jr 60ff097406 refactor(@embark/core): create embark-core package, move constants into embark-core 2019-04-30 12:11:25 -05:00
Jonathan Rainville d386bffda9 refactor(@embark/authenticator): move authenticator to a package 2019-04-30 12:06:54 -04:00
Jonathan Rainville bcd006a1cf refactor(@embark/utils): move copyToCliboard to embark-utils 2019-04-30 12:06:54 -04:00
Michael Bradley, Jr ad01d1402c test: collect code coverage in the root of the monorepo
Implement scripts to collect coverage reports (JSON format) from all packages
in the monorepo that generate such reports. Reports are copied to
`<root>/.nyc_output/coverage-[pkg-dir-name].json`.

Implement scripts to generate a combined html report in `<root>/coverage`.

Adjust root `reset` and `clean` scripts to delete `<root>/.nyc_output` and
`<root>/coverage`.

Implement a script in `<root>/package.json` to generate a `text-lcov` report
and upload it to coveralls from CI builds. Remove coveralls from
`packages/embark`.

Supply `packages/embark` with an nyc configuration in its `package.json` and
have its `"test":` script generate both `json` and `html` reports.

Use nyc with `embarkjs`'s test suite: supply an nyc configuration in its
`package.json` and have its `"test":` script generate both `json` and `html`
reports.

Adjust `embarkjs`'s tests for more accurate coverage reporting.
2019-04-30 12:04:01 -04:00
emizzle 0c394fea29 feat(@embark/webserver): Add support for `service webserver on/off`
Add support for `service webserver on/off` commands.

Deprecate commands `webserver start/stop` in favor of `service webserver on/off`.

Handles passing through of arguments to the function executed after process launch.

`service webserver on` - Enables the webserver serving the DApp. Shows an error if the webserver is already starting or started.

`service webserver off` - Disables the webserver serving the DApp. Shows an error if the webserver is already stopping or stopped.

`webserver start` - This command has been deprecated in favor of `service webserver on` and will be removed in future versions.

`webserver stop` - This command has been deprecated in favor of `service webserver off` and will be removed in future versions.
2019-04-30 12:02:02 -04:00
Jonathan Rainville 7495095d49 refactor(@embark/ens): move ens module to embark-ens package 2019-04-30 16:31:07 +02:00
Jonathan Rainville 8506778384 refactor(@embark/utils): move addressUtils to embark-utils 2019-04-30 16:31:07 +02:00
Jonathan Rainville 7eb85f0fbe fix(@embark/specialconfig): fix undefined contract name in onDeploy 2019-04-30 08:37:46 -04:00
Jonathan Rainville c7c923dec2 fix(embark-site): error in tracking section 2019-04-30 10:50:49 +02:00
Jonathan Rainville b9c12ddc30 fix(embark-site): remove double web3 typo 2019-04-29 15:16:24 -04:00
Michael Bradley, Jr 925ed06823 fix(@embark/demo): render whisper error messages not error objects 2019-04-29 09:17:43 -05:00
Michael Bradley, Jr 33ee6d8d35 test: disable test script for packages without any tests
Several `embarkjs-*` packages specify a `"test":` script in their respective
`package.json` files but lack any tests, causing `yarn test` in the root of the
monorepo to fail. For now, disable those scripts.
2019-04-29 09:04:13 -05:00
Pascal Precht 64731cf985 chore: move embark site into mono repo 2019-04-29 13:00:58 +02:00
Pascal Precht a874c38d72 refactor(@embark/embark-logger): move logger into own package 2019-04-29 13:00:10 +02:00
Pascal Precht 69ced6d894 refactor(@embark/embark-scaffolding): introduce new embark-scaffolding package 2019-04-29 12:06:59 +02:00
Pascal Precht c9e335ea21 refactor(@embark/embark-utils): move runCmd utility to utils package 2019-04-29 12:06:59 +02:00
Jonathan Rainville 70a528c296 refactor: move process-logs-api to its own packages 2019-04-26 12:37:19 -04:00
Pascal Precht e1f80eb1be refactor: move watcher into embark-watcher package 2019-04-26 16:45:52 +02:00
Jonathan Rainville 83b0a68eef refactor(@embark-utils): move logHandler and normalizeInput in utils 2019-04-26 16:38:19 +02:00
Jonathan Rainville 483f692e0b refactor(@embark-utils): move escapHtml to embark-utils 2019-04-26 16:38:19 +02:00
Pascal Precht 2464fb69af
Revert "refactor: move env module into own embark-env package"
This reverts commit 4f8734f19b.
2019-04-25 17:35:40 +02:00
Jonathan Rainville d5c3a9cf1d fix(@embark/console): fix cockpit console if using console command 2019-04-25 10:58:00 -04:00
Pascal Precht 4f8734f19b refactor: move env module into own embark-env package 2019-04-25 16:29:04 +02:00
Pascal Precht 0260154804 refactor(@embark/utils): move sha512 util into embark-utils package 2019-04-25 15:26:56 +02:00
Jonathan Rainville fa0220c950 refactor(@embark/embark-trasaction-tracker): move tx tracker to pck 2019-04-24 18:39:26 -04:00
Andre Medeiros c51ec5029b fix: dashboard auto complete 2019-04-24 18:38:51 -04:00
Andre Medeiros ea7ae22501 fix: improve wording on contract constructor failing 2019-04-24 18:38:15 -04:00
emizzle 7a76516534 feat(@embark/blockchain): Restart Ethereum via command
Add support for `service blockchain on/off` in the console.

Add service on/off command for each process started by, ie `service blockchain on/off` and `service whisper on/off`.

`service blockchain off` - Kills the blockchain process, stops the web3 provider, and shuts down the proxy (if used). In the case of `embark blockchain`, the entire process is exited.

`service blockchain on` - Starts the blockchain process *as a child process of the main embark process* then starts the web3 provider. This happens regardless of whether or not it was initially started with `embark blockchain` (see known issues).

## Known issues
1. If the blockchain process was started with `embark blockchain`, and then the blockchain process is killed with the `service blockchain off` command, when the blockchain process is restarted with `service blockchain on`, it will be restarted as a child process of the main embark process. It may be possible to allow for the blockchain process to be restarted in the same process it was originally started in, however this will take more development effort and can be handled in a different PR.
2. Parity has not been tested as it is currently not working in the master branch.
3. This PR adds a generic registration of commands for each process, ie `service whisper on/off`, however the only supported command is the `service blockchain on/off` command. Further support for other commands can be handled in separate PRs.
2019-04-24 18:37:15 -04:00
Pascal Precht bf0f4392a4 fix(@embark/deployment): only log error when error exists
This was a regression introduced in 72fc80df53
2019-04-23 12:18:34 +02:00
Andre Medeiros 740196684c fix: update solidity-parser-antlr to allow the use of the payable keyword in contracts 2019-04-22 11:44:32 -04:00
Andre Medeiros 0f4e554b22 fix: make coverage more forgiving 2019-04-22 11:44:32 -04:00
Jonathan Rainville 6b16f668e0 fix(embark/generator): add empty line to embarkjs 2019-04-19 12:34:26 -04:00
Jonathan Rainville 1ae0ab6b1f fix(embark/generator): add back environment to EmbarkJS 2019-04-17 17:59:27 -04:00
Michael Bradley, Jr 579328a9f4 chore(release): 4.1.0-beta.0 2019-04-17 11:11:28 -05:00
Iuri Matias 626aa5daf1 [CHERRY PICKED] chore(release): 4.0.2 2019-04-17 10:30:30 -05:00
Jonathan Rainville ae88cc612d feat(@embark/generator): transpile embarkjs.js to be used by node 2019-04-17 10:30:18 -05:00
Iuri Matias 79d96c3b4c refactor (@embark/embark-utils): move recursiveMerge to embark-utils 2019-04-17 10:30:04 -05:00
Pascal Precht 42aebb92fd fix(@embark/deployment): ensure logger is available in all hooks 2019-04-17 11:37:09 +02:00
Pascal Precht 72fc80df53 fix(@embark/deployment): ensure error messages emitted are logged
Errors emitted as part of the `deployAll()` routine got swallowed by
Embark, leaving users in the unknown when the deployment process
"froze".

This commit ensures errors emitted are now logged, making it obvious
when something went wrong.
2019-04-17 11:37:09 +02:00
Pascal Precht b8357b77bf feat(@embark/embark-reset): allow users to specify files to be removed in reset
This commit introduces a feature where users can specify which files should be removed
as part of Embark's `reset` command.

This is done by specifying the `options.reset` section in a project's `embark.json`.
The possible options are `defaults: bool` and `files: Array<String>`:

```
// embark.json
{
  ...
  "options": {
    "reset": {
      "defaults": true,
      "files": ["some.file", "some/other.file"]
    }
  }
}
```

`defaults` tells Embark whether or not it should remove the default files that are
defined by the `reset` command. Setting it to `false` will prevent Embark from
removing any of these (mostly files located inside `.embark`).

This gives users fine control as they now can re-add subsets or those file paths
in the `files` property.

If `options.reset` doesn't exist Embark will do the default behaviour, which is
is simply resetting/removing the files it has always removed.

It now also honors `generationDir` and `buildDir` as part of the defaults.
2019-04-17 11:23:13 +02:00
Jonathan Rainville a4f68cb0ee fix(embark/simulator): fix account object empty when no mnemonic 2019-04-16 17:30:38 -04:00
Jonathan Rainville bfebb3ce41 fix(embark/compiler): fix errors and bugs with solc 0.4.18 2019-04-16 14:25:59 -04:00
Michael Bradley, Jr eb9de680d3 fix(@cockpit/services): send only process names to embark-api-client
`webSocketProcess` function in `embark-api-client` expects only a process name,
but cockpit was calling it with name-strings prepended with `/process-logs/`
resulting in bad URLs. Revise cockpit's `services/api` module to call
`webSocketProcess` with process names only.
2019-04-16 14:25:35 -04:00
Michael Bradley, Jr a39c2c82d7 refactor(@embark/api): in dev use cockpit redirect instead of proxy
Embark API server's development proxy from port 55555 to 3000 was attempting to
inappropriately forward an `/embark-api/` endpoint for the blockchain process
logs to Create React App's development server. Why it was only happening for
the one endpoint is not known but probably has to do with timing around
registration of the API server's express routes.

The problem can be fixed with a one-line `filter:` function in the options for
`express-http-proxy`. However, it was realized that to fix an unrelated
problem, whereby the proxy doesn't forward websockets to CRA such that hot
reload doesn't work when accessing `embark-ui` in development on port 55555, a
switch to `http-proxy-middleware` would be required. That was quickly
attempted (easy switch) but there are outstanding [difficulties][bug] with
`webpack-dev-server` and `node-http-proxy` that cause CRA to crash.

Switch strategies and refactor the API module to serve a page on port 55555 (in
development only) that alerts the developer `embark-ui` should be accessed on
port 3000. The page redirects (client-side) after 10 seconds, with URL query
params and/or hash preserved. A future version could instead do client-side
polling of port 3000 with `fetch` and then redirect only once it's
available. The reason for not redirecting immediately is that the intermediate
page makes it more obvious what needs to be done, e.g. CRA dev server may need
to be started with `yarn start`.

[bug]: https://github.com/webpack/webpack-dev-server/issues/1642
2019-04-16 14:25:35 -04:00
Pascal Precht 3988fb4c8a uiux(@embark/embark-reset): output files that reset command removes 2019-04-12 14:59:48 -04:00
Pascal Precht 1aeb6fd83b feat(@embark/embark-specialconfigs): introduce new beforeDeploy hooks
This commit enables new `beforeDeploy` deployment hooks. With this change
it's possible to add `beforeDeploy` to either `contracts: {}` within the contracts
configuration, or an individual contract.

For example:

```
contracts: {
  SimpleStorage: {
    beforeDeploy: async (context) => {

    }
  }
}
```

Runs the hook before `SimpleStorage` will be deployed. Whereas

```
contracts: {
  ...
  beforeDeploy: async () => {

  }
}

will be executed before *all* Smart Contracts will be deployed.
2019-04-12 14:54:16 -04:00
Pascal Precht f0aed55319 uiux: improve logging of deployment hooks by adding logger dependency
This will allow users to generated deploy hook specific output using the supplied `logger` within deployment hooks.

The logger will generate an output a la:

```
ContractName > deploymentHook > Output
```

and

```
afterDeploy > Output
```

respectively.

E.g. an `onDeploy` hook config like this:

```
contracts: {
  SimpleStorage: {
    fromIndex: 0,
    args: [100],
    onDeploy: (context) => {
      context.logger.log('Hello from on deploy');
    }
  }
}
```

Will output:

```
SimpleStorage > onDeploy > Hello from on deploy
```
2019-04-12 14:51:00 -04:00
Michael Bradley 85c3bb6319 Update packages/embark/package.json
Co-Authored-By: iurimatias <iuri.matias@gmail.com>
2019-04-12 14:48:33 -04:00
emizzle 447f6f8973 fix(@embark/pipeline): Support embarkjs-whisper with external pipeline
Support embarkjs-whisper with external pipeline.

`embarkjs-whisper` is required by code that is through the VM, and therefore the `embark` package needs to be able to resolve `embarkjs-whisper`.
2019-04-12 14:48:33 -04:00
emizzle 36be50e5dc feat(@embark/proxy): Add dev tx to proxy when request fails to get response
Create a dev tx (a 0-value tx that is sent from the —dev account to itself) when a request goes through the proxy, but does not get a response after 5 seconds.

Log requests to disk (when log level is trace - enabled with the embark option `—loglevel trace`) that have not received a response and for which a dev tx has been sent.

Add logging to a `proxyLogs.json` log file as well, so that this information can be gleaned later for debugging purposes.

This particular PR Is meant to workaround an issue with running geth with the `—dev` option, as some transactions appear to get stuck, which then builds up further txs in a queue. Only when another tx is sent is the queue then purged as expected.

The remaining issue is that even though a dev tx is sent to relieve the queued txs, the originally offending tx still never receives a response from the node. This was the motivation behind creating a proxy log, so that a dev can inspect the txs that are essentially dropped.

**NOTE:** the base branch of this branch is `refactor/devfunds`. Please merge that branch first.
2019-04-12 14:48:07 -04:00