32 Commits

Author SHA1 Message Date
Anthony Laibe
f32ddc9935 fix: coverage count
Instead of full match, start to count as soon
as there is 1 match
2018-11-21 08:50:01 +00:00
Pascal Precht
c66fe695f0 refactor(@embark/deployment): make use of newly introduced ZERO_ADDRESS 2018-11-20 16:41:32 +01:00
Pascal Precht
8b68beca17 feat: introduce function support for deploy lifecycle hooks
Prior to this commits deployment lifecycle hooks had been defined as Array<string> due
to historical reasons (contracts.js) used to be a json file back in the days.

`deployIf`, `onDeploy` and `afterDeploy` can now be defined as (async)
function and have access to several dependencies such as contract instances and web3.
However, in order to have needed dependencies registered in the dependencies object,
all lifecycle hook dependencies need to be listed in the `deps` property
as shown below.

Also note that this is NOT a breaking change. Existing deployment lifecycle
hooks written in Array<string> style still work.

All three lifecycle hooks can now be defined as (async) functions and get an dependency
object with a shape like this:

```
interface DeploymentLifecycleHookDependencies {
  contracts: Map<string, ContractInstance>;
  web3: Web3Instance
}
```

`deployIf` lifecycle hook has to return a promise (or be defined using async/await and return
a value) like this:

```
contracts: {
  MyToken: {...},
  SimpleStorage: {
    deps: ['MyToken'], // this is needed to make `MyToken` available within `dependencies`
    deployIf: async (dependencies) => {
      return dependencies.contracts.MyToken_address;
    }
  },
}
```

Vanilla promises (instead of async/await) can be used as well:

```
contracts: {
  MyToken: {...},
  SimpleStorage: {
    deps: ['MyToken'],
    deployIf: (dependencies) => {
      return new Promise(resolve => resolve(dependencies.contracts.MyToken_address);
    }
  },
}
```

`onDeploy` as well, returns either a promise or is used using async/await:

```
contracts: {
  SimpleStorage: {
    onDeploy: async (dependencies) => {
      const simpleStorage = dependencies.contracts.SimpleStorage;
      const value = await simpleStorage.methods.get().call();
      console.log(value);
    }
  },
}
```

`afterDeploy` has automatically access to all configured and deployed contracts of the dapp:

```
contracts: {
  SimpleStorage: {...},
  MyToken: {...},
  afterDeploy: (dependencies) => {
    console.log('Done!');
  }
}
```

Closes #1029
2018-11-20 16:41:03 +01:00
Jonathan Rainville
cabfa939e7 fix(ipc): sends requests and events only when connected
Fixes #1063
2018-11-18 13:00:44 -05:00
Santiago Gonzalez Toral
89e3eb6156 feat(@embark/cli): add --template option to embark demo cli command
Adds a --template option to the embark demo cli command so it is now possible to generate a demo project using an existing embark's template repository on Github with an existing demo branch (e.g. embark demo --template vue will use embark-framework/embark-vue-template#demo), or any other git URL repository. If no --template option is specified, the command  will generate a demo from default template in templates/demo
2018-11-18 12:50:02 -05:00
Anthony Laibe
58795ca7d2 refactor(core): convert i18n to TS 2018-11-18 12:30:36 -05:00
Jonathan Rainville
c85c3bc809
Merge pull request #1089 from embark-framework/bug_fix/deploy-error
Fix using an object as arguments
2018-11-16 08:37:24 -05:00
Anthony Laibe
b63525e7c0 style(modules/coverage): replace var 2018-11-16 09:49:30 +00:00
Anthony Laibe
f84d7f1d21 feat: run coverage for bytecode and deployedBytecode 2018-11-16 09:49:30 +00:00
Anthony Laibe
3406ae833c feat: Allow parallel deploy 2018-11-16 09:35:12 +00:00
Anthony Laibe
51b8224325 feat: permanently save logs/events 2018-11-16 09:31:14 +00:00
Jonathan Rainville
6b61c8ada9 fix(contracts_manager): fix object contract arguments 2018-11-15 14:53:27 -05:00
Jonathan Rainville
7a5035ec49 fix(deployment): add a message when the errror is about the input 2018-11-15 14:19:44 -05:00
Iuri Matias
21dff441d1 refactor(@embark/console): move console index.js to typescript 2018-11-15 14:00:30 -05:00
Iuri Matias
d427e626c2 feat(@embark/console): better determine suggestions for any js object not just with the dot.' 2018-11-15 13:51:05 -05:00
Iuri Matias
23f623d750 refactor(@embark/console): convert suggestions class into typescript 2018-11-15 13:51:05 -05:00
Iuri Matias
f206062919 feat(@embark/console): determine suggestions automatically for a js object of the type 'command.' 2018-11-15 13:51:05 -05:00
Iuri Matias
29117c280a refactor(@embark/console): refactor getSuggestions to return results in a callback; move sorting to its own method 2018-11-15 13:51:05 -05:00
Pascal Precht
d3f6b43986 fix(@embark/core): ensure 0x0 address are extended to full zero addresses
This was a regression introduced in a web3 upgrade where `0x0` addresses where no longer
accepted as valid addresses and have to be replaced with full zero addresses.

This commit ensures that, if Embark apps still make use of `0x0` addresses in
their configs, they are properly replaced or extended to satisfy web3's APIs.

Fixes #956
2018-11-14 16:03:39 +01:00
Pascal Precht
70a61c5965 uiux(@embark/cli): propose build --contracts as alternative if compile` is used 2018-11-14 12:16:56 +01:00
Iuri Matias
3986d9761c chore(@embark/utils): convert utils/hosts.js to typescript 2018-11-13 10:35:24 -05:00
Jonathan Rainville
1a29a8f6c9
fix(simulator): adds node to sim command to comply with Windows 2018-11-13 10:19:51 +01:00
Jonathan Rainville
3353a05c3e
fix(simulator): use config's gas limit if no option provided
Fixes #1054
2018-11-13 10:19:51 +01:00
Jonathan Rainville
43be2a28d6
fix(cmd): removes -h as an option for host for the simulator 2018-11-13 10:19:50 +01:00
Pascal Precht
4961f70e5f fix(@embark/core): don't expect balance on accounts
In 594d1323fa we've introduced the ability
to configure balance-related options with human readable ether units.

There are cases where there's account configurations that don't come
with a `balance` property, which breaks Embark when running an Embark app.

Fixes #1067
2018-11-13 10:17:55 +01:00
Anthony Laibe
f82d3de1b0 feat: add CRUD to file explorer 2018-11-13 09:13:23 +00:00
Anthony Laibe
c8d6f18648
Merge pull request #1068 from embark-framework/bugfix/no-webserver-no-url
fix: do not display log if no webserver
2018-11-13 09:13:01 +00:00
Pascal Precht
8a00e04c06 chore(@embark/cli): introduce alias for --simple option in run command
Closes #1025
2018-11-13 10:11:08 +01:00
Michael Bradley, Jr
96f7688ee8 fix(@embark/webserver): load embark-ui sources from the correct path
embark's webserver needs to serve the production build of embark-ui from the
root of the package not from dist/
2018-11-12 12:08:43 -05:00
Michael Bradley, Jr
23f19a0df5 fix: runtime environment needs to support locally installed embark
Reintroduce NODE_PATH so that DApps with embark locally installed can properly
resolve modules supplied by embark. Refactor process.env related settings into
src/lib/core/env.js
2018-11-12 11:03:48 -06:00
Anthony Laibe
97829c04f4 fix(module/authenticator): do not display log if no webserver 2018-11-12 15:30:30 +00:00
Michael Bradley, Jr
69dd8c5b89 build(packaging): reorg sources for transpilation with Babel
Allow for embark sources to be authored in TypeScript and/or JavaScript, and to
make use of upcoming features of the JS language. Sources in the src/ directory
are transpiled into the dist/ directory, and npm-scripts are provided to
support and automate various aspect of the build process. Source map support is
enabled at runtime, i.e. when invoking the embark cli and running embark's test
suite.
2018-11-11 15:08:55 -06:00