mirror of https://github.com/embarklabs/embark.git
Merge branch 'next' into develop
This commit is contained in:
commit
dd8135445d
|
@ -0,0 +1,273 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"accessor-pairs": "error",
|
||||||
|
"array-bracket-newline": "error",
|
||||||
|
"array-bracket-spacing": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"array-callback-return": "off",
|
||||||
|
"array-element-newline": "off",
|
||||||
|
"arrow-body-style": "error",
|
||||||
|
"arrow-parens": "off",
|
||||||
|
"arrow-spacing": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"after": true,
|
||||||
|
"before": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"block-scoped-var": "error",
|
||||||
|
"block-spacing": "error",
|
||||||
|
"brace-style": "off",
|
||||||
|
"callback-return": "off",
|
||||||
|
"camelcase": "off",
|
||||||
|
"capitalized-comments": "off",
|
||||||
|
"class-methods-use-this": "off",
|
||||||
|
"comma-dangle": "error",
|
||||||
|
"comma-spacing": "off",
|
||||||
|
"comma-style": [
|
||||||
|
"error",
|
||||||
|
"last"
|
||||||
|
],
|
||||||
|
"complexity": "error",
|
||||||
|
"computed-property-spacing": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"consistent-return": "off",
|
||||||
|
"consistent-this": "off",
|
||||||
|
"curly": "off",
|
||||||
|
"default-case": "error",
|
||||||
|
"dot-location": [
|
||||||
|
"error",
|
||||||
|
"property"
|
||||||
|
],
|
||||||
|
"dot-notation": "off",
|
||||||
|
"eol-last": "error",
|
||||||
|
"eqeqeq": "off",
|
||||||
|
"for-direction": "error",
|
||||||
|
"func-call-spacing": "error",
|
||||||
|
"func-name-matching": "error",
|
||||||
|
"func-names": "off",
|
||||||
|
"func-style": "off",
|
||||||
|
"function-paren-newline": "off",
|
||||||
|
"generator-star-spacing": "error",
|
||||||
|
"getter-return": "error",
|
||||||
|
"global-require": "off",
|
||||||
|
"guard-for-in": "off",
|
||||||
|
"handle-callback-err": "off",
|
||||||
|
"id-blacklist": "error",
|
||||||
|
"id-length": "off",
|
||||||
|
"id-match": "error",
|
||||||
|
"indent": "off",
|
||||||
|
"indent-legacy": "off",
|
||||||
|
"init-declarations": "off",
|
||||||
|
"jsx-quotes": "error",
|
||||||
|
"key-spacing": "off",
|
||||||
|
"keyword-spacing": "off",
|
||||||
|
"line-comment-position": "off",
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"lines-around-comment": "error",
|
||||||
|
"lines-around-directive": "error",
|
||||||
|
"max-depth": "error",
|
||||||
|
"max-len": "off",
|
||||||
|
"max-lines": "off",
|
||||||
|
"max-nested-callbacks": "error",
|
||||||
|
"max-params": "off",
|
||||||
|
"max-statements": "off",
|
||||||
|
"max-statements-per-line": "error",
|
||||||
|
"multiline-ternary": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"new-parens": "off",
|
||||||
|
"newline-after-var": "off",
|
||||||
|
"newline-before-return": "off",
|
||||||
|
"newline-per-chained-call": "off",
|
||||||
|
"no-alert": "error",
|
||||||
|
"no-array-constructor": "error",
|
||||||
|
"no-await-in-loop": "error",
|
||||||
|
"no-bitwise": "error",
|
||||||
|
"no-buffer-constructor": "error",
|
||||||
|
"no-caller": "error",
|
||||||
|
"no-catch-shadow": "error",
|
||||||
|
"no-confusing-arrow": "error",
|
||||||
|
"no-console": "off",
|
||||||
|
"no-continue": "off",
|
||||||
|
"no-div-regex": "error",
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-else-return": "off",
|
||||||
|
"no-empty-function": "off",
|
||||||
|
"no-eq-null": "error",
|
||||||
|
"no-eval": "off",
|
||||||
|
"no-extend-native": "error",
|
||||||
|
"no-extra-bind": "error",
|
||||||
|
"no-extra-label": "error",
|
||||||
|
"no-extra-parens": "off",
|
||||||
|
"no-floating-decimal": "error",
|
||||||
|
"no-implicit-coercion": "error",
|
||||||
|
"no-implicit-globals": "error",
|
||||||
|
"no-implied-eval": "error",
|
||||||
|
"no-inline-comments": "off",
|
||||||
|
"no-inner-declarations": [
|
||||||
|
"error",
|
||||||
|
"functions"
|
||||||
|
],
|
||||||
|
"no-invalid-this": "off",
|
||||||
|
"no-iterator": "error",
|
||||||
|
"no-label-var": "error",
|
||||||
|
"no-labels": "error",
|
||||||
|
"no-lone-blocks": "error",
|
||||||
|
"no-lonely-if": "off",
|
||||||
|
"no-loop-func": "error",
|
||||||
|
"no-magic-numbers": "off",
|
||||||
|
"no-mixed-operators": "error",
|
||||||
|
"no-mixed-requires": "error",
|
||||||
|
"no-multi-assign": "error",
|
||||||
|
"no-multi-spaces": "off",
|
||||||
|
"no-multi-str": "error",
|
||||||
|
"no-multiple-empty-lines": "error",
|
||||||
|
"no-native-reassign": "error",
|
||||||
|
"no-negated-condition": "off",
|
||||||
|
"no-negated-in-lhs": "error",
|
||||||
|
"no-nested-ternary": "error",
|
||||||
|
"no-new": "error",
|
||||||
|
"no-new-func": "error",
|
||||||
|
"no-new-object": "error",
|
||||||
|
"no-new-require": "error",
|
||||||
|
"no-new-wrappers": "error",
|
||||||
|
"no-octal-escape": "error",
|
||||||
|
"no-param-reassign": "off",
|
||||||
|
"no-path-concat": "error",
|
||||||
|
"no-plusplus": "off",
|
||||||
|
"no-process-env": "off",
|
||||||
|
"no-process-exit": "off",
|
||||||
|
"no-proto": "error",
|
||||||
|
"no-prototype-builtins": "off",
|
||||||
|
"no-restricted-globals": "error",
|
||||||
|
"no-restricted-imports": "error",
|
||||||
|
"no-restricted-modules": "error",
|
||||||
|
"no-restricted-properties": "error",
|
||||||
|
"no-restricted-syntax": "error",
|
||||||
|
"no-return-assign": "error",
|
||||||
|
"no-return-await": "error",
|
||||||
|
"no-script-url": "error",
|
||||||
|
"no-self-compare": "error",
|
||||||
|
"no-sequences": "error",
|
||||||
|
"no-shadow": "off",
|
||||||
|
"no-shadow-restricted-names": "error",
|
||||||
|
"no-spaced-func": "error",
|
||||||
|
"no-sync": "off",
|
||||||
|
"no-tabs": "error",
|
||||||
|
"no-template-curly-in-string": "error",
|
||||||
|
"no-ternary": "off",
|
||||||
|
"no-throw-literal": "error",
|
||||||
|
"no-trailing-spaces": "off",
|
||||||
|
"no-undef-init": "error",
|
||||||
|
"no-undefined": "off",
|
||||||
|
"no-underscore-dangle": "off",
|
||||||
|
"no-unmodified-loop-condition": "error",
|
||||||
|
"no-unneeded-ternary": "error",
|
||||||
|
"no-unused-expressions": "error",
|
||||||
|
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
||||||
|
"no-use-before-define": "off",
|
||||||
|
"no-useless-call": "off",
|
||||||
|
"no-useless-computed-key": "error",
|
||||||
|
"no-useless-concat": "error",
|
||||||
|
"no-useless-constructor": "error",
|
||||||
|
"no-useless-rename": "error",
|
||||||
|
"no-useless-return": "off",
|
||||||
|
"no-var": "off",
|
||||||
|
"no-void": "error",
|
||||||
|
"no-warning-comments": "off",
|
||||||
|
"no-whitespace-before-property": "error",
|
||||||
|
"no-with": "error",
|
||||||
|
"nonblock-statement-body-position": "error",
|
||||||
|
"object-curly-newline": "off",
|
||||||
|
"object-curly-spacing": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"object-property-newline": "off",
|
||||||
|
"object-shorthand": "off",
|
||||||
|
"one-var": "off",
|
||||||
|
"one-var-declaration-per-line": "off",
|
||||||
|
"operator-assignment": "off",
|
||||||
|
"operator-linebreak": "error",
|
||||||
|
"padded-blocks": "off",
|
||||||
|
"padding-line-between-statements": "error",
|
||||||
|
"prefer-arrow-callback": "off",
|
||||||
|
"prefer-const": "off",
|
||||||
|
"prefer-destructuring": "off",
|
||||||
|
"prefer-numeric-literals": "error",
|
||||||
|
"prefer-promise-reject-errors": "error",
|
||||||
|
"prefer-reflect": "off",
|
||||||
|
"prefer-rest-params": "off",
|
||||||
|
"prefer-spread": "off",
|
||||||
|
"prefer-template": "off",
|
||||||
|
"quote-props": "off",
|
||||||
|
"quotes": "off",
|
||||||
|
"radix": "error",
|
||||||
|
"require-await": "error",
|
||||||
|
"require-jsdoc": "off",
|
||||||
|
"rest-spread-spacing": "error",
|
||||||
|
"semi": "error",
|
||||||
|
"semi-spacing": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"after": true,
|
||||||
|
"before": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"semi-style": [
|
||||||
|
"error",
|
||||||
|
"last"
|
||||||
|
],
|
||||||
|
"sort-imports": "error",
|
||||||
|
"sort-keys": "off",
|
||||||
|
"sort-vars": "off",
|
||||||
|
"space-before-blocks": "off",
|
||||||
|
"space-before-function-paren": "off",
|
||||||
|
"space-in-parens": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"space-infix-ops": "off",
|
||||||
|
"space-unary-ops": "error",
|
||||||
|
"spaced-comment": "off",
|
||||||
|
"strict": "error",
|
||||||
|
"switch-colon-spacing": "error",
|
||||||
|
"symbol-description": "error",
|
||||||
|
"template-curly-spacing": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"template-tag-spacing": "error",
|
||||||
|
"unicode-bom": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"valid-jsdoc": "error",
|
||||||
|
"vars-on-top": "off",
|
||||||
|
"wrap-iife": "error",
|
||||||
|
"wrap-regex": "error",
|
||||||
|
"yield-star-spacing": "error",
|
||||||
|
"yoda": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ class CodeGenerator {
|
||||||
listenToCommands() {
|
listenToCommands() {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
|
// deprecated events; to remove in embark 2.7.0
|
||||||
this.events.setCommandHandler('abi-vanila', function(cb) {
|
this.events.setCommandHandler('abi-vanila', function(cb) {
|
||||||
let vanillaABI = self.generateABI({useEmbarkJS: false});
|
let vanillaABI = self.generateABI({useEmbarkJS: false});
|
||||||
let contractsJSON = self.generateContractsJSON();
|
let contractsJSON = self.generateContractsJSON();
|
||||||
|
@ -54,6 +55,37 @@ class CodeGenerator {
|
||||||
|
|
||||||
cb(vanillaABI, contractsJSON);
|
cb(vanillaABI, contractsJSON);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// new events
|
||||||
|
this.events.setCommandHandler('code-vanila', function(cb) {
|
||||||
|
let vanillaABI = self.generateABI({useEmbarkJS: false});
|
||||||
|
let contractsJSON = self.generateContractsJSON();
|
||||||
|
|
||||||
|
cb(vanillaABI, contractsJSON);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.events.setCommandHandler('code', function(cb) {
|
||||||
|
let embarkJSABI = self.generateABI({useEmbarkJS: true});
|
||||||
|
let contractsJSON = self.generateContractsJSON();
|
||||||
|
|
||||||
|
cb(embarkJSABI, contractsJSON);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.events.setCommandHandler('code-contracts-vanila', function(cb) {
|
||||||
|
let vanillaContractsABI = self.generateContracts(false, true, false);
|
||||||
|
let contractsJSON = self.generateContractsJSON();
|
||||||
|
|
||||||
|
cb(vanillaContractsABI, contractsJSON);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.events.setCommandHandler('code-vanila-deployment', function(cb) {
|
||||||
|
let vanillaABI = self.generateABI({useEmbarkJS: false, deployment: true});
|
||||||
|
let contractsJSON = self.generateContractsJSON();
|
||||||
|
|
||||||
|
cb(vanillaABI, contractsJSON);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generateProvider(isDeployment) {
|
generateProvider(isDeployment) {
|
||||||
|
@ -104,8 +136,6 @@ class CodeGenerator {
|
||||||
let contractsPlugins;
|
let contractsPlugins;
|
||||||
|
|
||||||
if (useLoader === false) {
|
if (useLoader === false) {
|
||||||
let result;
|
|
||||||
|
|
||||||
for (let className in this.contractsManager.contracts) {
|
for (let className in this.contractsManager.contracts) {
|
||||||
let contract = this.contractsManager.contracts[className];
|
let contract = this.contractsManager.contracts[className];
|
||||||
let abi = JSON.stringify(contract.abiDefinition);
|
let abi = JSON.stringify(contract.abiDefinition);
|
||||||
|
|
|
@ -83,11 +83,12 @@ class Compiler {
|
||||||
self.logger.info("compiling contracts...");
|
self.logger.info("compiling contracts...");
|
||||||
solcW.compile({sources: input}, 1, function (output) {
|
solcW.compile({sources: input}, 1, function (output) {
|
||||||
if (output.errors) {
|
if (output.errors) {
|
||||||
if (output.errors.length === 1 && output.errors[0].indexOf('Warning:') >= 0) {
|
for (let i=0; i<output.errors; i++) {
|
||||||
self.logger.warn(output.errors[0]);
|
if (output.errors[i].indexOf('Warning:') >= 0) {
|
||||||
} else {
|
return callback(new Error("Solidity errors: " + output.errors).message);
|
||||||
return callback(new Error("Solidity errors: " + output.errors).message);
|
}
|
||||||
}
|
}
|
||||||
|
self.logger.warn(output.errors.join('\n'));
|
||||||
}
|
}
|
||||||
callback(null, output);
|
callback(null, output);
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@ class ContractsManager {
|
||||||
this.logger = options.logger;
|
this.logger = options.logger;
|
||||||
this.plugins = options.plugins;
|
this.plugins = options.plugins;
|
||||||
if (!options.contractsConfig.versions) {
|
if (!options.contractsConfig.versions) {
|
||||||
this.solcVersion = "0.4.11";
|
this.solcVersion = "0.4.17";
|
||||||
} else {
|
} else {
|
||||||
this.solcVersion = options.contractsConfig.versions.solc;
|
this.solcVersion = options.contractsConfig.versions.solc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ Config.prototype.loadContractsConfigFile = function() {
|
||||||
var configObject = {
|
var configObject = {
|
||||||
"versions": {
|
"versions": {
|
||||||
"web3.js": "0.19.1",
|
"web3.js": "0.19.1",
|
||||||
"solc": "0.4.11"
|
"solc": "0.4.17"
|
||||||
},
|
},
|
||||||
"deployment": {
|
"deployment": {
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Engine {
|
||||||
plugins: this.plugins
|
plugins: this.plugins
|
||||||
});
|
});
|
||||||
this.events.on('code-generator-ready', function () {
|
this.events.on('code-generator-ready', function () {
|
||||||
self.events.request('abi', function (abi, contractsJSON) {
|
self.events.request('code', function (abi, contractsJSON) {
|
||||||
self.currentAbi = abi;
|
self.currentAbi = abi;
|
||||||
self.contractsJSON = contractsJSON;
|
self.contractsJSON = contractsJSON;
|
||||||
pipeline.build(abi, contractsJSON, null, function() {
|
pipeline.build(abi, contractsJSON, null, function() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ var EventEmitter = require('events');
|
||||||
function warnIfLegacy(eventName) {
|
function warnIfLegacy(eventName) {
|
||||||
const legacyEvents = ['abi-vanila', 'abi', 'abi-contracts-vanila', 'abi-vanila-deployment'];
|
const legacyEvents = ['abi-vanila', 'abi', 'abi-contracts-vanila', 'abi-vanila-deployment'];
|
||||||
if (legacyEvents.indexOf(eventName) >= 0) {
|
if (legacyEvents.indexOf(eventName) >= 0) {
|
||||||
console.warn("this event is deprecated and will be removed in future versions: " + eventName);
|
console.info("this event is deprecated and will be removed in future versions: " + eventName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,21 +71,10 @@ Test.prototype.deployAll = function(contractsConfig, cb) {
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
function deploy(callback) {
|
function deploy(callback) {
|
||||||
//self.engine.events.setHandler('abi-contracts-vanila', function(vanillaABI) {
|
|
||||||
//elf.engine.events.on('abi-contracts-vanila', function(vanillaABI) {
|
|
||||||
self.engine.events.on('code-generator-ready', function () {
|
self.engine.events.on('code-generator-ready', function () {
|
||||||
self.engine.events.request('abi-contracts-vanila', function(vanillaABI) {
|
self.engine.events.request('code-contracts-vanila', function(vanillaABI) {
|
||||||
console.log("got abi-contracts-vanila request");
|
|
||||||
callback(null, vanillaABI);
|
callback(null, vanillaABI);
|
||||||
});
|
});
|
||||||
//self.engine.events.on('abi-contracts-vanila', function(vanillaABI) {
|
|
||||||
// console.log("got abi-contracts-vanila");
|
|
||||||
// callback(null, vanillaABI);
|
|
||||||
//});
|
|
||||||
//self.engine.events.request('abi', function(vanillaABI) {
|
|
||||||
// console.log("got abi");
|
|
||||||
// callback(null, vanillaABI);
|
|
||||||
//});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
self.engine.deployManager.deployContracts(function(err, result) {
|
self.engine.deployManager.deployContracts(function(err, result) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Embark {
|
||||||
});
|
});
|
||||||
dashboard.start(function () {
|
dashboard.start(function () {
|
||||||
engine.events.on('code-generator-ready', function () {
|
engine.events.on('code-generator-ready', function () {
|
||||||
engine.events.request('abi-vanila-deployment', function (abi) {
|
engine.events.request('code-vanila-deployment', function (abi) {
|
||||||
dashboard.console.runCode(abi);
|
dashboard.console.runCode(abi);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// TODO: this is horrible and needs to be refactored ASAP
|
||||||
let utils = require('../utils/utils.js');
|
let utils = require('../utils/utils.js');
|
||||||
let fs = require('../core/fs.js');
|
let fs = require('../core/fs.js');
|
||||||
let o_fs = require('fs-extra');
|
let o_fs = require('fs-extra');
|
||||||
|
@ -26,7 +27,6 @@ class Npm {
|
||||||
res.on('end', function () {
|
res.on('end', function () {
|
||||||
let registryJSON = JSON.parse(body);
|
let registryJSON = JSON.parse(body);
|
||||||
|
|
||||||
console.log(JSON.stringify(registryJSON));
|
|
||||||
let tarball = registryJSON.dist.tarball;
|
let tarball = registryJSON.dist.tarball;
|
||||||
|
|
||||||
var download = function(url, dest, cb) {
|
var download = function(url, dest, cb) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "embark",
|
"name": "embark",
|
||||||
"version": "2.5.2",
|
"version": "2.6.0",
|
||||||
"description": "Embark is a framework that allows you to easily develop and deploy DApps",
|
"description": "Embark is a framework that allows you to easily develop and deploy DApps",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "grunt jshint && mocha test/ --no-timeouts"
|
"test": "grunt jshint && mocha test/ --no-timeouts"
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
"promptly": "^2.1.0",
|
"promptly": "^2.1.0",
|
||||||
"serve-static": "^1.11.1",
|
"serve-static": "^1.11.1",
|
||||||
"shelljs": "^0.5.0",
|
"shelljs": "^0.5.0",
|
||||||
"solc": "0.4.11",
|
"solc": "0.4.17",
|
||||||
"tar": "^3.1.5",
|
"tar": "^3.1.5",
|
||||||
"toposort": "^1.0.0",
|
"toposort": "^1.0.0",
|
||||||
"underscore": "^1.8.3",
|
"underscore": "^1.8.3",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"default": {
|
"default": {
|
||||||
"versions": {
|
"versions": {
|
||||||
"web3.js": "1.0.0-beta",
|
"web3.js": "1.0.0-beta",
|
||||||
"solc": "0.4.11"
|
"solc": "0.4.17"
|
||||||
},
|
},
|
||||||
"deployment": {
|
"deployment": {
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
|
|
|
@ -28,7 +28,7 @@ describe("Token", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("not deploy Token", function(done) {
|
it("not deploy Token", function(done) {
|
||||||
assert.equal(Token.address, "undefined");
|
assert.equal(Token.address, "");
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue