refactor(@embark/solidity): move solidity module into own package

This commit is contained in:
Pascal Precht 2019-05-10 12:52:34 +02:00 committed by Iuri Matias
parent f868d1216d
commit cae8075682
12 changed files with 111 additions and 9 deletions

View File

@ -0,0 +1,4 @@
engine-strict = true
package-lock = false
save-exact = true
scripts-prepend-node-path = true

View File

@ -0,0 +1,6 @@
# `embark-solidity`
> Solidity Compiler APIs for Embark
Visit [embark.status.im](https://embark.status.im/) to get started with
[Embark](https://github.com/embark-framework/embark).

View File

@ -0,0 +1,75 @@
{
"name": "embark-solidity",
"version": "4.1.0-beta.0",
"author": "Iuri Matias <iuri.matias@gmail.com>",
"contributors": [],
"description": "Solidity Compiler APIs for Embark",
"homepage": "https://github.com/embark-framework/embark/tree/master/packages/embark-solidity#readme",
"bugs": "https://github.com/embark-framework/embark/issues",
"keywords": [
"blockchain",
"dapps",
"ethereum",
"ipfs",
"serverless",
"solc",
"solidity"
],
"files": [
"dist"
],
"license": "MIT",
"repository": {
"directory": "packages/embark-solidity",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "./dist/index.js",
"scripts": {
"build": "cross-env BABEL_ENV=node babel src --extensions \".js\" --out-dir dist --root-mode upward --source-maps",
"ci": "npm run qa",
"clean": "npm run reset",
"lint": "npm-run-all lint:*",
"lint:js": "eslint src/",
"// lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
"package": "npm pack",
"// qa": "npm-run-all lint typecheck build package",
"qa": "npm-run-all lint build package",
"reset": "npx rimraf dist embark-*.tgz package",
"start": "npm run watch",
"// typecheck": "tsc",
"watch": "run-p watch:*",
"watch:build": "npm run build -- --verbose --watch",
"// watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
},
"eslintConfig": {
"extends": "../../.eslintrc.json"
},
"dependencies": {
"@babel/runtime-corejs2": "7.3.1",
"async": "2.6.1",
"embark-core": "^4.1.0-beta.0",
"embark-i18n": "^4.1.0-beta.0",
"embark-utils": "^4.1.0-beta.0",
"fs-extra": "7.0.1",
"live-plugin-manager-git-fix": "0.12.1",
"semver": "5.6.0",
"solc": "0.5.0",
"uuid": "3.3.2"
},
"devDependencies": {
"@babel/cli": "7.2.3",
"@babel/core": "7.2.2",
"cross-env": "5.2.0",
"eslint": "5.7.0",
"npm-run-all": "4.1.5",
"rimraf": "2.6.3",
"tslint": "5.16.0",
"typescript": "3.4.5"
},
"engines": {
"node": ">=8.12.0",
"npm": ">=6.4.1",
"yarn": ">=1.12.3"
}
}

View File

@ -1,4 +1,4 @@
let async = require('../../utils/async_extend.js');
let async = require('async');
let SolcW = require('./solcW.js');
const path = require('path');
import { __ } from 'embark-i18n';

View File

@ -1,7 +1,6 @@
import { __ } from 'embark-i18n';
import { ProcessLauncher } from 'embark-core';
import {joinPath} from 'embark-utils';
let currentSolcVersion = require('../../../../package.json').dependencies.solc;
const uuid = require('uuid/v1');
class SolcW {
@ -52,7 +51,7 @@ class SolcW {
this.solcProcess.once("result", "initiated", () => {
this.events.request("version:get:solc", function(solcVersion) {
if (solcVersion === currentSolcVersion) {
if (solcVersion === self.embark.config.package.dependencies.solc) {
return self.solcProcess.send({action: 'loadCompiler', requirePath: 'solc'});
}
self.events.request("version:getPackagePath", "solc", solcVersion, function(err, path) {

View File

@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*"]
}

View File

@ -0,0 +1,3 @@
{
"extends": "../../tslint.json"
}

View File

@ -112,6 +112,7 @@
"embark-reset": "^4.1.0-beta.0",
"embark-specialconfigs": "^4.1.0-beta.0",
"embark-scaffolding": "^4.1.0-beta.0",
"embark-solidity": "^4.1.0-beta.0",
"embark-ui": "^4.1.0-beta.0",
"embark-test-runner": "^4.1.0-beta.0",
"embark-transaction-tracker": "^4.1.0-beta.0",

View File

@ -215,7 +215,7 @@ class Engine {
setupCompilerAndContractsManagerService(options) {
this.registerModulePackage('embark-compiler', {plugins: this.plugins, isCoverage: options.isCoverage});
this.registerModule('solidity', {ipc: this.ipc, useDashboard: this.useDashboard});
this.registerModulePackage('embark-solidity', {ipc: this.ipc, useDashboard: this.useDashboard});
this.registerModulePackage('embark-vyper');
this.registerModulePackage('embark-contracts-manager', {plugins: this.plugins, compileOnceOnly: options.compileOnceOnly});
}
@ -224,7 +224,7 @@ class Engine {
let self = this;
this.setupCompilerAndContractsManagerService(options);
this.registerModule('solidity', {ipc: self.ipc, useDashboard: this.useDashboard});
this.registerModulePackage('embark-solidity', {ipc: self.ipc, useDashboard: this.useDashboard});
this.registerModulePackage('embark-vyper');
this.registerModulePackage('embark-profiler');
this.registerModule('deploytracker', {trackContracts: options.trackContracts});

View File

@ -10,7 +10,6 @@ let Events = require('../lib/core/events');
const fs = require('../lib/core/fs');
let assert = require('assert');
//let SolidityCompiler = require('../lib/modules/solidity');
let Plugins = require('../lib/core/plugins.js');
let readFile = function(file) {
@ -40,6 +39,9 @@ describe('embark.Contracts', function() {
"optimize-runs": 200
}
}
},
package: {
dependencies: { solc: currentSolcVersion }
}
}
});
@ -47,7 +49,7 @@ describe('embark.Contracts', function() {
ipcRole: 'none',
fs
});
plugins.loadInternalPlugin('solidity', {ipc: ipcObject});
plugins.loadInternalPlugin('embark-solidity', {ipc: ipcObject}, true);
let events = new Events();
let embarkObject = {
@ -180,6 +182,9 @@ describe('embark.Contracts', function() {
"optimize-runs": 200
}
}
},
package: {
dependencies: { solc: currentSolcVersion }
}
}
});
@ -187,7 +192,7 @@ describe('embark.Contracts', function() {
ipcRole: 'none',
fs
});
plugins.loadInternalPlugin('solidity', {ipc: ipcObject});
plugins.loadInternalPlugin('embark-solidity', {ipc: ipcObject}, true);
let events = new Events();
let compiler = new Compiler({events: events, logger: plugins.logger}, {plugins: plugins});

View File

@ -2,7 +2,7 @@
import { File, Types } from "../../../lib/core/file.js";
const fs = require('../../../lib/core/fs');
import { IPC } from 'embark-core';
let SolidityCompiler = require('../../../lib/modules/solidity');
let SolidityCompiler = require('embark-solidity');
let TestLogger = require('../../../lib/utils/test_logger');
let readFile = function(file) {
@ -30,6 +30,11 @@ let generateApiObject = function() {
logger: new TestLogger({}),
events: TestEvents,
config: {
package: {
dependencies: {
solc: solcVersion
}
},
contractDirectories: ['app/contracts/'],
embarkConfig: {
options: {