Merge branch 'master' into remixd_terminal

pull/1342/head
David Zagi 3 years ago committed by GitHub
commit ee6fe2e5fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      apps/debugger/tsconfig.json
  2. 2
      apps/remix-ide-e2e/tsconfig.json
  3. 12
      apps/remix-ide/src/app/tabs/compile-tab.js
  4. 21
      apps/remix-ide/src/app/tabs/test-tab.js
  5. 4
      apps/remix-ide/src/app/ui/confirmDialog.js
  6. 8
      apps/remix-ide/src/blockchain/blockchain.js
  7. 2
      apps/remix-ide/tsconfig.json
  8. 2
      libs/remix-analyzer/tsconfig.json
  9. 2
      libs/remix-astwalker/tsconfig.json
  10. 2
      libs/remix-core-plugin/tsconfig.json
  11. 2
      libs/remix-debug/tsconfig.json
  12. 2
      libs/remix-lib/tsconfig.json
  13. 2
      libs/remix-simulator/tsconfig.json
  14. 2
      libs/remix-solidity/tsconfig.json
  15. 5
      libs/remix-tests/src/runTestSources.ts
  16. 8
      libs/remix-tests/src/testRunner.ts
  17. 1
      libs/remix-tests/src/types.ts
  18. 5
      libs/remix-tests/tests/examples_0/assert_ok_test.sol
  19. 1532
      libs/remix-tests/tests/examples_0/hardhat/console.sol
  20. 0
      libs/remix-tests/tests/testRunner.cli.spec_disabled.ts
  21. 39
      libs/remix-tests/tests/testRunner.spec.ts
  22. 2
      libs/remix-tests/tsconfig.json
  23. 35
      libs/remix-ui/README.md
  24. 2
      libs/remix-ui/checkbox/tsconfig.json
  25. 2
      libs/remix-ui/clipboard/tsconfig.json
  26. 2
      libs/remix-ui/debugger-ui/tsconfig.json
  27. 2
      libs/remix-ui/file-explorer/tsconfig.json
  28. 2
      libs/remix-ui/modal-dialog/tsconfig.json
  29. 2
      libs/remix-ui/publish-to-storage/tsconfig.json
  30. 2
      libs/remix-ui/renderer/tsconfig.json
  31. 2
      libs/remix-ui/settings/tsconfig.json
  32. 2
      libs/remix-ui/solidity-compiler/tsconfig.json
  33. 2
      libs/remix-ui/static-analyser/tsconfig.json
  34. 2
      libs/remix-ui/toaster/tsconfig.json
  35. 2
      libs/remix-ui/tree-view/tsconfig.json
  36. 2
      libs/remix-ui/utils/tsconfig.json
  37. 2
      libs/remix-ui/workspace/tsconfig.json
  38. 2
      libs/remix-url-resolver/tsconfig.json
  39. 24
      libs/remixd/src/services/slitherClient.ts
  40. 2
      libs/remixd/tsconfig.json
  41. 3
      nx.json
  42. 48
      tsconfig.base.json
  43. 4
      tsconfig.json

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "nightwatch"],
"esModuleInterop": true

@ -108,13 +108,21 @@ class CompileTab extends ViewPlugin {
this.call('editor', 'clearAnnotations')
}
this.on('filePanel', 'setWorkspace', (workspace) => {
const resetView = (isLocalhost) => {
this.compileTabLogic.isHardhatProject().then((result) => {
if (result && workspace.isLocalhost) this.isHardHatProject = true
if (result && isLocalhost) this.isHardHatProject = true
else this.isHardHatProject = false
this.renderComponent()
})
this.resetResults()
}
this.on('filePanel', 'setWorkspace', (workspace) => {
resetView(workspace.isLocalhost)
})
this.on('remixd', 'rootFolderChanged', () => {
resetView(true)
})
this.compileTabLogic.event.on('startingCompilation', this.data.eventHandlers.onStartingCompilation)

@ -1,6 +1,7 @@
import { ViewPlugin } from '@remixproject/engine-web'
import { removeMultipleSlashes, removeTrailingSlashes } from '../../lib/helper'
import { canUseWorker, urlFromVersion } from '@remix-project/remix-solidity'
import { format } from 'util'
var yo = require('yo-yo')
var async = require('async')
var tooltip = require('../ui/tooltip')
@ -179,6 +180,24 @@ module.exports = class TestTab extends ViewPlugin {
}
}
printHHLogs (logsArr, testName) {
let finalLogs = `<b>${testName}:</b>\n`
for (const log of logsArr) {
let formattedLog
// Hardhat implements the same formatting options that can be found in Node.js' console.log,
// which in turn uses util.format: https://nodejs.org/dist/latest-v12.x/docs/api/util.html#util_util_format_format_args
// For example: console.log("Name: %s, Age: %d", remix, 6) will log 'Name: remix, Age: 6'
// We check first arg to determine if 'util.format' is needed
if (typeof log[0] === 'string' && (log[0].includes('%s') || log[0].includes('%d'))) {
formattedLog = format(log[0], ...log.slice(1))
} else {
formattedLog = log.join(' ')
}
finalLogs = finalLogs + '&emsp;' + formattedLog + '\n'
}
this.call('terminal', 'log', { type: 'info', value: finalLogs })
}
testCallback (result, runningTests) {
this.testsOutput.hidden = false
if (result.type === 'contract') {
@ -197,6 +216,7 @@ module.exports = class TestTab extends ViewPlugin {
`
this.testsOutput.appendChild(this.outputHeader)
} else if (result.type === 'testPass') {
if (result.hhLogs && result.hhLogs.length) this.printHHLogs(result.hhLogs, result.value)
this.testsOutput.appendChild(yo`
<div
id="${this.runningTestFileName}"
@ -208,6 +228,7 @@ module.exports = class TestTab extends ViewPlugin {
</div>
`)
} else if (result.type === 'testFailure') {
if (result.hhLogs && result.hhLogs.length) this.printHHLogs(result.hhLogs, result.value)
if (!result.assertMethod) {
this.testsOutput.appendChild(yo`
<div

@ -113,8 +113,8 @@ function confirmDialog (tx, network, amount, gasEstimation, newGasPriceCb, initi
</div>
</div>
<div class="d-flex py-1 align-items-center custom-control custom-checkbox ${css.checkbox}">
<input class="form-check-input custom-control-input" id='confirmsetting' type="checkbox">
<label class="m-0 form-check-label custom-control-label">Do not show this warning again.</label>
<input class="form-check-input custom-control-input" id="confirmsetting" type="checkbox">
<label class="m-0 form-check-label custom-control-label" for="confirmsetting">Do not show this warning again.</label>
</div>
</div>
`

@ -323,8 +323,8 @@ class Blockchain extends Plugin {
// TODO : event should be triggered by Udapp instead of TxListener
/** Listen on New Transaction. (Cannot be done inside constructor because txlistener doesn't exist yet) */
startListening (txlistener) {
txlistener.event.register('newTransaction', (tx) => {
this.events.emit('newTransaction', tx)
txlistener.event.register('newTransaction', (tx, receipt) => {
this.events.emit('newTransaction', tx, receipt)
})
}
@ -501,7 +501,7 @@ class Blockchain extends Plugin {
if (isVM) {
const hhlogs = await this.web3().eth.getHHLogsForTx(txResult.transactionHash)
if (hhlogs && hhlogs.length) {
let finalLogs = 'console.log:\n'
let finalLogs = '<b>console.log:</b>\n'
for (const log of hhlogs) {
let formattedLog
// Hardhat implements the same formatting options that can be found in Node.js' console.log,
@ -513,7 +513,7 @@ class Blockchain extends Plugin {
} else {
formattedLog = log.join(' ')
}
finalLogs = finalLogs + formattedLog + '\n'
finalLogs = finalLogs + '&emsp;' + formattedLog + '\n'
}
this.call('terminal', 'log', { type: 'info', value: finalLogs })
}

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"],
"module": "commonjs",

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"],
"module": "commonjs",

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "tape"],
"esModuleInterop": true

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "tape"],
"esModuleInterop": true

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "mocha"],
"esModuleInterop": true

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"]
},

@ -5,7 +5,7 @@ import { deployAll } from './deployer'
import { runTest } from './testRunner'
import Web3 from 'web3'
import { Provider } from '@remix-project/remix-simulator'
import { Provider, extend } from '@remix-project/remix-simulator'
import {
FinalResult, SrcIfc, compilationInterface, ASTInterface, Options,
TestResultInterface, AstNode, CompilerConfiguration
@ -17,6 +17,7 @@ const createWeb3Provider = async function () {
const provider: any = new Provider()
await provider.init()
web3.setProvider(provider)
extend(web3)
return web3
}
@ -102,7 +103,7 @@ export async function runTestSources (contractSources: SrcIfc, compilerConfig: C
async.eachOfLimit(contractsToTest, 1, (contractName: string, index: string | number, cb: ErrorCallback) => {
const fileAST: AstNode = sourceASTs[contracts[contractName]['filename']]
runTest(contractName, contracts[contractName], contractsToTestDetails[index], fileAST, { accounts }, _testCallback, (err, result) => {
runTest(contractName, contracts[contractName], contractsToTestDetails[index], fileAST, { accounts, web3 }, _testCallback, (err, result) => {
if (err) {
return cb(err)
}

@ -217,7 +217,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
const isJSONInterfaceAvailable = testObject && testObject.options && testObject.options.jsonInterface
if (!isJSONInterfaceAvailable) { return resultsCallback(new Error('Contract interface not available'), { passingNum, failureNum, timePassed }) }
const runList: RunListInterface[] = createRunList(testObject.options.jsonInterface, fileAST, testName)
const web3 = new Web3()
const web3 = opts.web3 || new Web3()
const accts: TestResultInterface = {
type: 'accountList',
value: opts.accounts
@ -282,8 +282,10 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
}
if (!sendParams) sendParams = {}
sendParams.gas = 10000000 * 8
method.send(sendParams).on('receipt', (receipt) => {
method.send(sendParams).on('receipt', async (receipt) => {
try {
let hhLogs
if (web3.eth && web3.eth.getHHLogsForTx) hhLogs = await web3.eth.getHHLogsForTx(receipt.transactionHash)
const time: number = (Date.now() - startTime) / 1000.0
const assertionEventHashes = assertionEvents.map(e => Web3.utils.sha3(e.name + '(' + e.params.join() + ')'))
let testPassed = false
@ -313,6 +315,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
expected: testEvent[4],
location
}
if (hhLogs) resp.hhLogs = hhLogs
testCallback(undefined, resp)
failureNum += 1
timePassed += time
@ -331,6 +334,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
time: time,
context: testName
}
if (hhLogs) resp.hhLogs = hhLogs
testCallback(undefined, resp)
passingNum += 1
timePassed += time

@ -36,6 +36,7 @@ export interface TestResultInterface {
returned?: string | number
expected?: string | number
location?: string
hhLogs?: []
}
export interface TestCbInterface {
(error: Error | null | undefined, result: TestResultInterface) : void;

@ -1,12 +1,17 @@
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "./hardhat/console.sol";
contract AssertOkTest {
function okPassTest() public {
console.log("AssertOkTest", "okPassTest");
Assert.ok(true, "okPassTest passes");
}
function okFailTest() public {
console.log("AssertOkTest", "okFailTest");
Assert.ok(false, "okFailTest fails");
}
}

File diff suppressed because it is too large Load Diff

@ -1,7 +1,7 @@
import * as async from 'async'
import Web3 from 'web3';
import * as assert from 'assert'
import { Provider } from '@remix-project/remix-simulator'
import { Provider, extend } from '@remix-project/remix-simulator'
import { compileFileOrFiles } from '../src/compiler'
import { deployAll } from '../src/deployer'
@ -47,6 +47,7 @@ async function compileAndDeploy(filename: string, callback: Function) {
let sourceASTs: any = {}
await provider.init()
web3.setProvider(provider)
extend(web3)
let compilationData: object
async.waterfall([
function getAccountList(next: Function): void {
@ -72,7 +73,7 @@ async function compileAndDeploy(filename: string, callback: Function) {
}
}
], function (_err: Error | null | undefined, contracts: any): void {
callback(null, compilationData, contracts, sourceASTs, accounts)
callback(null, compilationData, contracts, sourceASTs, accounts, web3)
})
}
@ -106,8 +107,8 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_0/assert_ok_test.sol'
beforeAll((done) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => {
runTest('AssertOkTest', contracts.AssertOkTest, compilationData[filename]['AssertOkTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) => {
runTest('AssertOkTest', contracts.AssertOkTest, compilationData[filename]['AssertOkTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done))
})
})
@ -121,12 +122,14 @@ describe('testRunner', () => {
assert.equal(results.failureNum, 1)
})
const hhLogs1 = [ [ "AssertOkTest", "okPassTest"]]
const hhLogs2 = [ [ "AssertOkTest", "okFailTest"]]
it('should return', () => {
deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts },
{ type: 'contract', value: 'AssertOkTest', filename: __dirname + '/examples_0/assert_ok_test.sol' },
{ type: 'testPass', value: 'Ok pass test', filename: __dirname + '/examples_0/assert_ok_test.sol', context: 'AssertOkTest' },
{ type: 'testFailure', value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', assertMethod: 'ok', location: '234:36:0', expected: 'true', returned: 'false'},
{ type: 'testPass', value: 'Ok pass test', filename: __dirname + '/examples_0/assert_ok_test.sol', context: 'AssertOkTest', hhLogs: hhLogs1 },
{ type: 'testFailure', value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', hhLogs: hhLogs2, assertMethod: 'ok', location: '370:36:0', expected: 'true', returned: 'false'},
], ['time'])
})
@ -136,7 +139,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_0/assert_equal_test.sol'
beforeAll((done) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) => {
runTest('AssertEqualTest', contracts.AssertEqualTest, compilationData[filename]['AssertEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -175,7 +178,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_0/assert_notEqual_test.sol'
beforeAll((done) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) => {
runTest('AssertNotEqualTest', contracts.AssertNotEqualTest, compilationData[filename]['AssertNotEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -214,7 +217,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_0/assert_greaterThan_test.sol'
beforeAll((done) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) => {
runTest('AssertGreaterThanTest', contracts.AssertGreaterThanTest, compilationData[filename]['AssertGreaterThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -248,7 +251,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_0/assert_lesserThan_test.sol'
beforeAll((done) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) => {
runTest('AssertLesserThanTest', contracts.AssertLesserThanTest, compilationData[filename]['AssertLesserThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -283,7 +286,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_1/simple_storage_test.sol'
beforeAll((done) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => {
compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) => {
runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -314,7 +317,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_2/simple_storage_test.sol'
beforeAll(done => {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) {
runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -344,7 +347,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_3/simple_string_test.sol'
beforeAll(done => {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) {
runTest('StringTest', contracts.StringTest, compilationData[filename]['StringTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -370,7 +373,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_5/test/simple_storage_test.sol'
beforeAll(done => {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) {
runTest('StorageResolveTest', contracts.StorageResolveTest, compilationData[filename]['StorageResolveTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -397,7 +400,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/examples_4/SafeMath_test.sol'
beforeAll(done => {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) {
runTest('SafeMathTest', contracts.SafeMathTest, compilationData[filename]['SafeMathTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -417,7 +420,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/number/number_test.sol'
beforeAll(done => {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) {
runTest('IntegerTest', contracts.IntegerTest, compilationData[filename]['IntegerTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -437,7 +440,7 @@ describe('testRunner', () => {
const filename: string = __dirname + '/various_sender/sender_and_value_test.sol'
beforeAll(done => {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) {
runTest('SenderAndValueTest', contracts.SenderAndValueTest, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, resultsCallback(done))
})
})
@ -465,7 +468,7 @@ describe('testRunner', () => {
}
}
beforeAll(done => {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) {
compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[], web3: any) {
runTest('SenderAndValueTest', undefined, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, errorCallback(done))
})
})

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "jest"],
"module": "commonjs",

@ -0,0 +1,35 @@
# remix-ui
This library was generated with [Nx](https://nx.dev).
## Pre-requisite
- Install **NxConsole** vscose extension
## Steps To Generate React App
- Open **NxConsole** extension
- Click generate option
- Select **@nrwl/react - application**
- Enter the name of the application
- Set **e2eTestRunner** to **none**. (This is because we run e2e tests with nightwatch)
- Set **unitTestRunner** to **none**.
- Click the run button in the top right corner of the generate page.
- Your react application should be created in **{root}/apps** directory.
## Steps To Generate React Lib
- Open **NxConsole** extension
- Click generate option
- Select **@nrwl/react - library**
- Enter the name of the library
- Set **directory** to **remix-ui**
- Set **importPath** to **@remix-ui/{library-name}**
- Set **unitTestRunner** to **none**.
- Click the run button in the top right corner of the generate page.
- Your react library should be created on **{root}/libs/remix-ui** directory.
## Steps To Generate React Component
- Open **NxConsole** extension
- Click generate option
- Select **@nrwl/react - component**
- Enter the name of the component
- Select the name of the project/library that uses the component. (e.g TreeView library)
- Set component directory if needed.
- Click the run button in the top right corner of the generate page.
- Your react component should be created with the project/library name specified.

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"allowJs": true,

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "mocha"],
"module": "commonjs",

@ -2,7 +2,7 @@
import * as WS from 'ws' // eslint-disable-line
import { PluginClient } from '@remixproject/plugin'
import { existsSync, readFileSync, readdirSync } from 'fs'
import { existsSync, readFileSync, readdirSync, unlink } from 'fs'
import { OutputStandard } from '../types' // eslint-disable-line
const { spawn, execSync } = require('child_process')
@ -114,21 +114,30 @@ export class SlitherClient extends PluginClient {
// Allow paths and set solc remapping for import URLs
const fileContent = readFileSync(`${this.currentSharedFolder}/${filePath}`, 'utf8')
const importsArr = fileContent.match(/import ['"][^.|..](.+?)['"];/g)
let allowPaths = ''; let remaps = ''
let remaps = ''
if (importsArr?.length) {
const { remapString, allowPathString } = this.mapNpmDepsDir(importsArr)
allowPaths = allowPathString
const { remapString } = this.mapNpmDepsDir(importsArr)
remaps = remapString.trim()
}
const allowPathsOption: string = allowPaths ? `--allow-paths ${allowPaths} ` : ''
const optimizeOption: string = optimize ? '--optimize' : ''
const evmOption: string = evmVersion ? `--evm-version ${evmVersion}` : ''
const solcArgs: string = optimizeOption || evmOption || allowPathsOption ? `--solc-args '${allowPathsOption}${optimizeOption}${evmOption}'` : ''
let solcArgs = ''
if (optimizeOption) {
solcArgs += optimizeOption + ' '
}
if (evmOption) {
if (!solcArgs.endsWith(' ')) solcArgs += ' '
solcArgs += evmOption
}
if (solcArgs) {
solcArgs = `--solc-args "${solcArgs.trimStart()}"`
}
const solcRemaps = remaps ? `--solc-remaps "${remaps}"` : ''
const outputFile: string = 'remix-slitherReport_' + Math.floor(Date.now() / 1000) + '.json'
const cmd: string = `slither ${filePath} ${solcArgs} ${solcRemaps} --json ${outputFile}`
console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Running Slither...')
console.log(cmd)
// Added `stdio: 'ignore'` as for contract with NPM imports analysis which is exported in 'stderr'
// get too big and hangs the process. We process analysis from the report file only
const child = spawn(cmd, { cwd: this.currentSharedFolder, shell: true, stdio: 'ignore' })
@ -140,6 +149,9 @@ export class SlitherClient extends PluginClient {
if (existsSync(outputFileAbsPath)) {
let report = readFileSync(outputFileAbsPath, 'utf8')
report = JSON.parse(report)
unlink(outputFileAbsPath, (err) => {
if (err) console.log(err)
})
if (report['success']) {
response['status'] = true
if (!report['results'] || !report['results'].detectors || !report['results'].detectors.length) {

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [

@ -6,8 +6,9 @@
"dependencies": "*",
"devDependencies": "*"
},
"tsconfig.json": "*",
"tsconfig.base.json": "*",
"tslint.json": "*",
".eslintrc": "*",
"nx.json": "*"
},
"tasksRunnerOptions": {

@ -0,0 +1,48 @@
{
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"module": "commonjs",
"typeRoots": ["node_modules/@types"],
"lib": ["es2017", "es2019", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@remix-project/remix-analyzer": ["dist/libs/remix-analyzer/index.js"],
"@remix-project/remix-astwalker": ["dist/libs/remix-astwalker/index.js"],
"@remix-project/remix-debug": ["dist/libs/remix-debug/src/index.js"],
"@remix-project/remix-lib": ["dist/libs/remix-lib/src/index.js"],
"@remix-project/remix-simulator": ["dist/libs/remix-simulator/src/index.js"],
"@remix-project/remix-solidity": ["dist/libs/remix-solidity/index.js"],
"@remix-project/remix-tests": ["dist/libs/remix-tests/src/index.js"],
"@remix-project/remix-url-resolver": ["dist/libs/remix-url-resolver/index.js"],
"@remixproject/debugger-plugin": ["apps/debugger/src/index.ts"],
"@remix-project/remixd": ["dist/libs/remixd/index.js"],
"@remix-ui/tree-view": ["libs/remix-ui/tree-view/src/index.ts"],
"@remix-ui/debugger-ui": ["libs/remix-ui/debugger-ui/src/index.ts"],
"@remix-ui/utils": ["libs/remix-ui/utils/src/index.ts"],
"@remix-ui/clipboard": ["libs/remix-ui/clipboard/src/index.ts"],
"@remix-project/remix-solidity-ts": ["libs/remix-solidity/src/index.ts"],
"@remix-ui/modal-dialog": ["libs/remix-ui/modal-dialog/src/index.ts"],
"@remix-ui/toaster": ["libs/remix-ui/toaster/src/index.ts"],
"@remix-ui/file-explorer": ["libs/remix-ui/file-explorer/src/index.ts"],
"@remix-ui/workspace": ["libs/remix-ui/workspace/src/index.ts"],
"@remix-ui/static-analyser": ["libs/remix-ui/static-analyser/src/index.ts"],
"@remix-ui/checkbox": ["libs/remix-ui/checkbox/src/index.ts"],
"@remix-ui/settings": ["libs/remix-ui/settings/src/index.ts"],
"@remix-project/core-plugin": ["libs/remix-core-plugin/src/index.ts"],
"@remix-ui/solidity-compiler": ["libs/remix-ui/solidity-compiler/src/index.ts"],
"@remix-ui/publish-to-storage": ["libs/remix-ui/publish-to-storage/src/index.ts"],
"@remix-ui/renderer": ["libs/remix-ui/renderer/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
}

@ -10,8 +10,7 @@
"importHelpers": true,
"target": "es2015",
"module": "commonjs",
"typeRoots": ["node_modules/@types"],
"lib": ["es2017", "es2019", "dom"],
"lib": ["es2017", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
@ -44,6 +43,7 @@
"@remix-ui/publish-to-storage": ["libs/remix-ui/publish-to-storage/src/index.ts"],
"@remix-ui/renderer": ["libs/remix-ui/renderer/src/index.ts"]
}
"allowSyntheticDefaultImports": true
},
"exclude": ["node_modules", "tmp"]
}

Loading…
Cancel
Save