Commit Graph

4934 Commits

Author SHA1 Message Date
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
Anthony Laibe 8f59647f36 refactor: extract types that are shared 2018-11-25 18:38:44 -05:00
Anthony Laibe db35d7f573 feat: add new event before build 2018-11-25 18:38:44 -05:00
Pascal Precht 17cec1b787 feat(@embark/contracts_manager): allow ABI definition non-owned contracts
This commit allows dapp developers to specify an ABI for contracts that are
already deployed and which source they don't own.

Prior to this commit there were two options to use web3 contract instances of 3rd
party contracts in Embark:

1. Define an interface for the 3rd party contract and have Embark compile that
2. Define path to source file of 3rd party contract and have Embark compile that

Both options result in Embark getting hold of the contracts ABI so it can be used
by web3 to create instances.

Now there's a third option that doesn't require creating an interface, nor the
source of the 3rd party contract.

Example:

```
// config/contracts.js

...
contracts: {
  SimpleStorage: {
    address: '0x0bFb07f9144729EEF54A9057Af0Fcf87aC7Cbba9',
    abiDefinition: [...] // full ABI
  }
},
afterDeploy: async(deps) => {
  const simpleStorage = deps.contracts.SimpleStorage;
  const value = await simpleStorage.methods.get().call();
  console.log('value', value);
}
```
2018-11-23 16:34:12 -05:00
Jonathan Rainville d09d410021 refactor(ENS): adds a whitelist for ens
Enables only the use of domains in that white list
2018-11-23 16:32:57 -05:00
Anthony Laibe bae31165dd feat: handle missing directive
WhileStatement
UsingForDirective
EnumDefinition
2018-11-23 16:30:15 -05:00
Anthony Laibe 154a4f0284 feat(coverage): count node by line only 2018-11-23 16:30:15 -05:00
Anthony Laibe 4aa15fe869 docs: remove old logo 2018-11-23 16:29:56 -05:00
Pascal Precht 903e9d44f2 fix(@embark/core): expect `afterDeploy` hook on contracts config environment
In d3f6b43986 we ensured that Embark automatically
expands `0x0` address to full zero addresses in order to stay backward compatible
with existing projects that made use of `0x0`, even after we've upgraded web3,
which doesn't allow that syntax anymore.

Turns out however, that the address expansion for `afterDeploy` hook was
done in the wrong place. This was due to a bug in our documentation that has been
fixed in 66a5bec46d
2018-11-23 10:36:20 +01:00
Pascal Precht 191929832c chore: remove npm-shrinkwrap.json which had been accidently introduced
227decde0a re-added the npm-shrinkwrap which
we don't rely on anymore.
2018-11-22 15:46:43 +01:00
Iuri Matias 05ef36441f refactor(@embark/debugger): rename function to camelcase 2018-11-22 09:00:55 -05:00
Iuri Matias 7b5613a70f refactor(@embark/debugger): simplify code 2018-11-22 09:00:55 -05:00
Iuri Matias 6e5fe85695 refactor(@embark/debugger): remove unneded type definition 2018-11-22 09:00:55 -05:00
Iuri Matias e02d026499 refactor(@embark/debugger): add ts definition for async; use imports instead of requires 2018-11-22 09:00:55 -05:00
Iuri Matias d06ad53ece refactor(@embark/debugger): initialize default values in private variables instead of constructor 2018-11-22 09:00:55 -05:00
Iuri Matias e2efa4baa0 feature(@embark/debugger): limit steps; display possible actions & line info 2018-11-22 09:00:55 -05:00
Iuri Matias b86634886e refactor(@embark/debugger): move debugger index.js to typescript 2018-11-22 09:00:55 -05:00
Iuri Matias 227decde0a refactor(@embark/debugger): move debugger_manager.js to typescript 2018-11-22 09:00:55 -05:00
Pascal Precht 6526e83742 fix(@embark/ens): use local ZERO_ADDRESS in ENSFunctions
We've introduced a regression in 2dfaaa8201 where zero addresses
have been replaced with a constant, including the ones within ENSFunctions.

The problem is that this code is as well added to the EmbarkJS client, where importing
`../../utils/addressUtils` won't work as it isn't available.

This commit reverts back to have ENSFunctions having its own ZERO_ADDRESS constant.
2018-11-22 12:40:46 +01:00
Pascal Precht 2dfaaa8201 refactor(@embark/ens): use ZERO_ADDRESS constant 2018-11-21 16:28:44 -05:00
Pascal Precht 2ff119d2df fix(@embark/contracts_manager): set contract `deployedAddress` if address is set
This commit fixes a bug in a scenario where dapp developers choose to refer
to an already deployed Smart Contract (they don't own) and want to use its web3 instance
on the client-side, or in deployment hooks.

For example, Dapp developers might want to do something like this:

```
// config/contract.js
...
contracts: {
  SimpleStorage: {
    address: '0x1234...' // SimpleStorage is already deployed
  }
},
afterDeploy: async (deps) => {
  const simpleStorage = deps.contracts.SimpleStorage; // this is the web3 instance created from an ABI
  const value = await simpleStorage.methods.get().call();
  console.log(value);
}
...
```

In order for Embark to create ready-to-use web3 Smart Contract instances,
it needs the contract's ABI. At the moment there are two possible ways to
achieve this for contracts we don't own:

1. Set the `address` of the already deployed contract and create a Solidity
   interface with the same name of the existing Contract that matches that
   Contract's interface. Embark is then going to compile that interface
   which will output an ABI whic can be used for web3 instance creation.

2. If the source of the 3rd party Smart Contract is available, use the
   `file` option to specify the path to the source, which Embark then picks
   up for compilation. Again, this results in ABI code which is then used
   for web3 instance creation.

As of now option 1) doesn't actually work, at least web3 is going to throw
an error when trying to access Smart Contract instances that have been created
that way. The reason for that is that the instance doesn't have a `deployedAddress`.

This commit ensures that the `deployedAddress` is set when the Smart Contract
config comes with a preconfigured `address`.
2018-11-21 16:28:23 -05:00
Andre Medeiros 4dca72368b fix(@embark/cmd): output contract json
This fix ensures that `embark build --contracts` outputs the contracts
the same way a normal build would.
2018-11-21 16:13:54 -05:00
Richard Ramos 46e351ed36 feat(@embark/whister): Add signature and recipient public key to whisper envelope 2018-11-21 16:08:56 -05:00
Jonathan Rainville 0032569b50 fix(tests): enable coverage only when --coverage
Fixes #1091
Speeds up tests because coverage does stuff on each block
2018-11-21 15:57:42 -05:00
Filip Š 6522aaae24 Add Slovenian translation 2018-11-21 15:53:37 -05:00
Andre Medeiros 485b8ef558
fix: handle contracts being removed
Fixes #1077
2018-11-21 13:40:41 +01:00
Pascal Precht ab41860d9b chore: introduce release script
This commit automates our release process. It takes care of a couple of things:

- Bumps version number in package.json as needed, see below
- Generates changelog based on commit history
- Create release commit
- Tags release commit
- Pushes release commit including tags to upstream repository
- Publishes release on npm

There are a couple of options supported. The base command is run like this:

```
npm run release
```

This will do a minor bump and try to push to `origin` on `master`. However,
this can be altered with the following options.

```
npm run release -- --dry-run
```

Can be used to perform dry run and not actually committing, tagging, pushing,
publishing anything.

```
npm run release -- --release-as <something>
```

Something can be `minor`, `major`, `patch` or anything you want `foo`, `1.0.0` etc.

```
npm run release -- --prerelease alpha
```

Will create a prerelease version a la `4.0.0-alpha.x`.

```
npm run release -- --prerelease alpha --npm-dist-tag next
```

Publishes a dist tag on npm using dist tag `next`

```
npm run release -- --sign
```

Signs the release commit (you need to have PGP setup for that).

```
npm run release -- --repo-origin pascal --repo-branch foo/bar
```

Pushes the release commit into `pascal/foo/bar`.
2018-11-21 13:28:50 +01:00
Anthony Laibe 45afe83cb3 feat: update to solc 0.5.0 2018-11-21 08:50:43 +00:00
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