Commit Graph

5012 Commits

Author SHA1 Message Date
Jonathan Rainville 20fccfb1c6 refactor(blockchain): add a web3 provider for embarkJS 2018-12-07 19:29:10 -05:00
emizzle 75111569a2 feat(@embark/core): Support directives in ENS config
Support directives in ENS configurations, such that subdomains can be registered to addresses of deployed tokens.

The following directives are supported:
```
"register": {
      "rootDomain": "embark.eth",
      "subdomains": {
        "status": "0x4a17f35f0a9927fb4141aa91cbbc72c1b31598de",
        "mytoken": "$MyToken",
        "MyToken2": "$MyToken2"
      }
    }
```

Add unit test for these directives.
2018-12-07 10:21:47 -05:00
emizzle c24536d8a6 fix(@embark/core): Disable swarm if URL can’t be determined
If the storage config is set up in such a way that a URL for swarm cannot be determined, the swarm module will exit early.

For example, if the storage config looks like:
```
available_providers: ["ipfs", "swarm"],
    upload: {
      provider: "ipfs",
      host: "localhost",
      port: 5001
    },
    dappConnection: [
      {
        provider:"ipfs",
        host: "localhost",
        port: 5001,
        getUrl: "http://localhost:8080/ipfs/"
      }
    ]
```
Then there is no way to determine the swarm URL as neither `upload` nor `dappConnection` specify a provider with `swarm`. If this is the case, the swarm module will exit in it’s constructor.

Add a warning message in the console for the users.
2018-12-07 10:21:28 -05:00
Anthony Laibe 9854368c24 feat(scaffold): use ipfs in scaffold and upload file 2018-12-07 10:20:14 -05:00
Andre Medeiros 168d774551 feature(@embark/tests): allow running tests via API 2018-12-07 10:19:52 -05:00
emizzle 1e2cb64141 feat(@embark/core): Allow search to find contract by name
In the cockpit, allow the search to find the contract by name. For example in the test_app, searching for “Token” (or “token”) in the cockpit, will take the user to the Token contract page.
2018-12-07 10:19:14 -05:00
Jonathan Rainville 13ed141e5d add txHash 2018-12-07 10:17:09 -05:00
Jonathan Rainville 37c28b9727 fix(debugger): fix and improve console commands 2018-12-07 10:17:09 -05:00
Jonathan Rainville 5b6b582459 chore(console): add new command descriptions to the help command 2018-12-07 10:17:09 -05:00
Jonathan Rainville 8b0d37ca9e chore(blockchain): rename `log geth` cmd to log blockchain 2018-12-07 10:17:09 -05:00
Jonathan Rainville e2257e8026 chore(authenticator): remove copyToken command and move logic token 2018-12-07 10:17:09 -05:00
Iuri Matias d0d3a35e9e feature(@embark/debugger): enable/disable debugger prev/next buttons in cockpit 2018-12-07 10:16:16 -05:00
emizzle b49839afdc feat(@embark/core): improve long running webpack UI
The webpack process took quite a while to run, and there were no updates in the console while running.

This PR adds a spinner (when there is no dashboard) and status updates every 5 seconds. When there is a dashboard, the updates are added to a new line.

After (with dashboard):
![with dashboard](https://i.imgur.com/zVJH5U4.png)

After (`—nodashboard`):
![no dashboard](http://g.recordit.co/2zRNLt51jU.gif)

Convert LongRunningProcessTimer to TypeScript

PR feedback and consistency changes

Changed the constructor signature to accept an options object instead of individual optional parameters, for readability.

Changed library_manager to use the spinner when not using the dashboard, for consistency’s sake. Additionally increased the update time for the library manager from 750ms to 1s.

Fix lint errors

Added `"variable-name": ["allow-leading-underscore”]` to `tslint.json` due to a lack of the ability to prefix backing variables with underscore. This is an [ongoing discussion](https://github.com/palantir/tslint/issues/1489), and something the community thinks should be implemented, as it the preferred way to use a property with backing variable in TypeScript.
2018-12-07 10:10:11 -05:00
Iuri Matias 6858de4ff5 refactor(@embark/console): refactor duplicated fuzzy search into a single private method 2018-12-07 10:07:34 -05:00
Iuri Matias 00be382be7 bugfix(@embark/console): catch exceptions from a badly regex caused by a suggestion contains ( or ) at the end of the string 2018-12-07 10:07:34 -05:00
emizzle 27babf0187 fix(@embark/core): Restart IPFS after CORS Update
When adding URLs to IPFS CORS that are not localhost, the IPFS daemon needed to be restarted after non-localhost CORS updates were added to the IPFS config. Without the restart, any non-localhost URLs added to the CORS were not being sent in the CORS header.

After this change, when the IPFS process is run, the following happens:
1. IPFS config is checked if the correct CORS settings are present in the config.
2. If not present, they are updated and IPFS is restarted.
3. If they are present, continue without restarting IPFS.
2018-12-07 10:05:21 -05:00
Jonathan Rainville 5928d134fc refactor(blockchain/accounts): refactor blockchain config accounts 2018-12-07 10:02:34 -05:00
Pascal Precht 0bb7d6352c feat(@embark/deployment): output transaction hash during deployment asap 2018-12-07 09:47:32 -05:00
Pascal Precht 3099894ed7 feat(@embark/deployment): output transaction hash of contract deployment 2018-12-07 09:47:32 -05:00
Anthony Laibe 5a375d9a5e feat: enable ethereum manually 2018-12-07 09:30:29 -05:00
Anthony Laibe 72f87012a9 fix: windows path separator being wrong 2018-12-06 13:33:00 +00:00
Michael Bradley, Jr cc79ebb922 chore(release): 4.0.0-alpha.2 2018-12-05 15:27:21 -06:00
Jordan Last 53780aaa96 feat(@embark/cli): repl support inside dashboard
Closes #768
2018-12-05 12:41:13 +01:00
Pascal Precht 90aac8343e feat(@embark/plugins): introduce API to register a contract factory
This commit introduces two new plugin APIs `registerTestContractFactory()` and
`registerCustomContractGenerator()`, which can be used to register a factory function
for the creation of web3 contract instances within tests, and custom code generation
  for `embark console` respectively.

Example:

```
// some.plugin.js

module.exports = function (embark) {
  embark.registerTestContractFactory(function (contractRecipe, web3) {
    // do something with web3 and contractRecipe and return contract instance here
  });
};
```

**Notice that**:

- This factory function is used for contract instance creation within tests.
  A `contractRecipe` and a `web3` instance is accessible within the factory.

Example:

```
// some.plugin.js

module.exports = function (embark) {
  embark.registerCustomContractGenerator(function (contractRecipe) {
    // returns code string that will be eval'ed
  });
};
```

**Notice that**:

- Once registered, this generator will be used for **all** contract instances
  that will be created for `embark console`, including built-in once like
  ENSRegistry.

- While this does affect contract creation in client-side code, it doesn't
  actually affect the instances created for deployment hooks **if** deployment
  hooks are written as functions.

Closes #1066

Always use custom generator and fallback to vanilla
2018-12-05 12:33:31 +01:00
Pascal Precht 639b8d8ebd chore(@embark/code-generator): remove unused code 2018-12-05 12:33:31 +01:00
Jonathan Rainville de58cab475 fix(accounts): remove warning for simulator configs 2018-12-04 13:14:44 -05:00
Jonathan Rainville 3a3c81e7d1 fix(tests): fix using node config inside a test 2018-12-04 13:14:44 -05:00
Michael Bradley, Jr bc6e0e3300 fix: adjust module resolution behavior
Include yarn's global path when modifying `NODE_PATH` since dependencies are
deduped when a package is installed globally with yarn, which is different from
npm's behavior.

Fix webpack resolution by listing relative `'node_modules'` in
`resolve/Loader:{modules:[...]}`. This ensures that dependecies' dependecies
are resolved correctly when webpack builds a DApp.

Remove the invocation of `.catch()` on a subscription object which lacks that
method.
2018-12-03 18:06:50 -06:00
Michael Bradley, Jr f10e0258cb build: introduce a `prepare` script in embark's package.json
**TL;DR**

These changes affect workflow with yarn. To prevent embark's `prepare` script
from running undesirably:

- If node_modules is in place and you're reinstalling after switching branches:

```
yarn run install_all
```

- If node_modules is missing (fresh clone or deleted):

```
EMBARK_NO_PREPARE=t yarn install && yarn run install_all
```

It's not recommended to set `EMBARK_NO_PREPARE` in your environment (e.g. in
`.bashrc`) since that would interfere with embark's `release` script if/when
you run it.

-----------------

**1.** Specify embark's build-related steps in the `prepare` script of
  package.json.

When embark is installed directly from GitHub the `prepare` script results in a
"pre install" phase (handled automatically by npm/yarn) that fetches
devDependencies, builds embark (including embark-ui), packs a tarball with the
same steps (minus testing and tree-checking) as would happen during an embark
release, and finally does a production install from that tarball.

Important point: installs from GitHub must be performed with yarn; they're no
longer possible with npm since during the "pre install" phase npm will honor
embark's `.npmrc` and `"engines"` settings.

The following will work correctly after this commit is merged:

```
yarn [global] add git+https://github.com/embark-framework/embark.git
```

Use of "hosted git" shortcuts (e.g. `embark-framework/embark#bracnh`) won't
work correctly because yarn doesn't fully support them. See:
https://github.com/yarnpkg/yarn/issues/5235.

It's important to use `git+https` urls. Following a succesful install with
`git+https` it is possible to use a "hosted git" shortcut or `https` url, but
that's owing to a subtle and unreliable interaction between yarn's cache and
yarn's logic for installing from a url/shortcut.

**2.** Adjust the npm configs (`.npmrc`) for embark/-ui so that `yarn run [cmd]
  [--opt]` can be used in place of `npm run [cmd] -- [--opt]`.

Either way is okay for running scripts, they're equivalent, but note the
requirement to use `--` before specifying command options with `npm run`.

**3.** Introduce yarn configs (`.yarnrc`) for embark/-ui and include the
  `check-files` directive.

H/t to @alaibe for the recommendation.

**4.** Ignore embark's `dist/typings` and `scripts` directories when packing a
  tarball.

**5.** Refactor embark/-ui's npm-scripts in relation to the `prepare` script,
  and make other small improvements.

Notably, if the environment variable `EMBARK_NO_PREPARE` is truthy (from JS
perspective) then embark's `prepare` script will exit early. This prevents
`install_all` and `prepare` from getting stuck in a loop (`install:core` uses
cross-env to set `EMBARK_NO_PREPARE`) and provides a mechanism for users to
skip the `prepare` script when doing a fresh install:

```
EMBARK_NO_PREPARE=t yarn install
```

**6.** Give `.js` extensions to node scripts in embark's `scripts/`, remove the
  shebang lines, and have npm-scripts explicitly invoke them with node.

This arrangement works for all platforms: Linux, macOS, and Windows.

**7.** Adjust travis and appveyor configs.

Since at present there aren't any tests or other CI steps that make use of
embark-ui's production build, set `EMBARK_NO_PREPARE` in the CI environments
and invoke `build:node` directly.

Check the working tree after `yarn install` for embark/-ui. This detects
situations where changes should have been committed to `yarn.lock` but were
not. Check the working tree again at the end to detect situations where ignore
files should have been adjusted but were not. Both checks could also detect
other surprising behavior that needs to be investigated. Any time the working
tree is not clean (there are untracked files or changes) CI will fail.

Drop CI runs for node 8.11.3 because that version ships with an older npm that
results in unstaged changes to the test apps' `package-lock.json` files,
causing the working tree check to fail at the end of the CI run. A simple
workaround isn't apparent, but the matter can be revisited.

**8.** Refactor embark's `release` script in light of the `prepare` script.

Notably, do the push step only after `npm publish` completes successfully. This
allows embark's `prepare` and `prepublishOnly` scripts to detect problems
before a commit and tag are pushed to GitHub, avoiding a need to rebase/revert
the remote release branch; the local branch will still need to have a commit
dropped and tag deleted before rerunning the `release` script.

Prompt the user if the `release` script is not being run in `--dry-run` mode.

Provide additional visual indicators of `--dry-run` mode.

Force the user to supply `--repo-branch [branch]` if the intention is to
release from a branch other than `master`.
2018-12-03 16:24:10 -06:00
Michael Bradley, Jr 1fac39197f fix(@embark/blockchain_process): ignore socket disconnect bytes
Ignore the sequence of bytes `03:ef:bf:bd` that are sent between
Chrome/Firefox (others?) and the node process when a browser connected via
websocket to the blockchain proxy is closed/reloaded. The theory is that
sequence is part of a socket control frame that is leaking to `parseJsonMaybe`
from `http-proxy-middleware`.
2018-12-03 16:24:10 -06:00
Jonathan Rainville 647f0ea478 chore(accountParser): put the accounts doc instead of printing opts 2018-12-03 16:06:00 -05:00
Anthony Laibe f68f1fc9b6 feat(scaffold): allow association/file
- Refactor everything to TS
- Add missing types
- Declare __ everywhere
2018-12-03 09:38:22 +00:00
Jonathan Rainville 5b3d8943cd refactor(test): make embarkJS importable in tests 2018-11-30 15:45:19 -05:00
Jonathan Rainville 9e69a7257e review comments 2018-11-29 11:16:39 -05:00
Jonathan Rainville c64c093a48 fix(ens/embarkjs): fix using await with embarkjs functions 2018-11-29 11:16:39 -05:00
Jonathan Rainville ca212e3ffb fix(ENS): register subdomain when not registered
was introduced when we did para deploy
We didn't register on error, but the error is the queue to register
2018-11-29 11:16:39 -05:00
Michael Bradley, Jr 801932b726 refactor(@embark/blockchain_process): improve the blockchain proxy
Use proper stream parsing to consistently track JSON-RPC messages.

For HTTP POST requests use the `stream-json` package to assemble request and
response message objects.

For WebSocket requests continue to use `simples/lib/parsers/ws` to process
stream frames into messages. For Websocket responses use the Receiver class of
the `ws` package to process stream data into messages. In both cases, make use
of the `cloneable-readable` and `stream-chain` packages to avoid leaks.

This mishmash of stream parsing approaches is the result of much
experimentation to find a working solution. For example,
`simples/lib/parsers/ws` does't work for processing WebSocket responses and
`ws.Receiver` doesn't work for processing requests. Additional revisions may be
necessary.

Revise `blockchain_process/dev_funds.js` to use web3's HTTP provider if a DApp
disables the WebSocket proxy.
2018-11-28 16:01:52 -06:00
Anthony Laibe 160015311e fix(ui): click on debug button start the debugger
Remove fake line
2018-11-28 09:21:45 +00:00
Michael Bradley, Jr a3392e8279 hotfix: remove yarn cache clean for CI 2018-11-27 15:21:52 -06:00
Michael Bradley, Jr 885d07483e hotfix: yarn cache clean for CI 2018-11-27 14:48:30 -06:00
Jonathan Rainville cb4f18c4c2 chore(plugins): remove second require as it always fails 2018-11-27 15:44:51 -05:00
Jonathan Rainville f9384733f8 fix(dependencies): lock remix-test and debug version
Caused an issue with ethereumjs-vm which introduced a breaking change
2018-11-27 15:44:51 -05:00
Jonathan Rainville 36da5a340e remove cache from yarn to fix malicious install 2018-11-27 10:48:08 -05:00
Jonathan Rainville 2b15388cd5 hotfix: fix tslint on the declare of debugtest 2018-11-27 10:03:29 -05:00
Anthony Laibe 6e784de507 fix: add missing external declaration 2018-11-27 09:48:59 -05:00
Michael Bradley, Jr 1d5e33e8a0 build: bump npm-run-all to the latest version 2018-11-26 19:51:50 +01:00
Anthony Laibe 92610ed70a fix: deploy hangs
The bug seems to be in web3 but we fix it
by avoiding extra tx
2018-11-26 12:59:42 -05:00
Pascal Precht ffb8f54939 feat(@embark/cli): introduce `eject-build-config` alias
As discussed in #1121, the `eject-webpack` command in Embark's CLI
exposes implementation details of the CLI's build process, namely webpack.

If we ever change our internal build tooling, commands like this
will become obsolete immediately. That's why this commit introduces
a new command `eject-build-config`, with `eject-webpack` being an alias for it.

So the following commands are the same:

```
$ embark eject-build-config
```
and
```
$ embark eject-webpack
```

The `eject-webpack` command can now be marked as deprecated and removed in future
versions of Embark.

Closes #1121
2018-11-26 12:33:19 -05:00
Anthony Laibe 7728c542e9 fix: open/close aside container 2018-11-26 15:38:35 +00:00
Anthony Laibe 5fb687c1d9 feat: expose dappPath 2018-11-25 18:38:44 -05:00