From f5722546b101c1d440d687986d4046bb92a3a026 Mon Sep 17 00:00:00 2001 From: emizzle Date: Tue, 7 May 2019 13:37:28 +1000 Subject: [PATCH] refactor(@embark/debugger): Move to embark-debugger Move the debugger module to the `embark-debugger` package. Handle case where `debug` is entered as a console command, and there is no transaction to be debugged. add embark-i18n and mocha deps --- packages/embark-debugger/.npmrc | 4 ++ packages/embark-debugger/README.md | 6 ++ packages/embark-debugger/package.json | 68 +++++++++++++++++++ .../src}/debugger_manager.ts | 0 .../debugger => embark-debugger/src}/index.ts | 3 + packages/embark-debugger/tsconfig.json | 4 ++ packages/embark-debugger/tslint.json | 3 + packages/embark/package.json | 2 +- packages/embark/src/lib/core/engine.js | 2 +- 9 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 packages/embark-debugger/.npmrc create mode 100644 packages/embark-debugger/README.md create mode 100644 packages/embark-debugger/package.json rename packages/{embark/src/lib/modules/debugger => embark-debugger/src}/debugger_manager.ts (100%) rename packages/{embark/src/lib/modules/debugger => embark-debugger/src}/index.ts (99%) create mode 100644 packages/embark-debugger/tsconfig.json create mode 100644 packages/embark-debugger/tslint.json diff --git a/packages/embark-debugger/.npmrc b/packages/embark-debugger/.npmrc new file mode 100644 index 000000000..e031d3432 --- /dev/null +++ b/packages/embark-debugger/.npmrc @@ -0,0 +1,4 @@ +engine-strict = true +package-lock = false +save-exact = true +scripts-prepend-node-path = true diff --git a/packages/embark-debugger/README.md b/packages/embark-debugger/README.md new file mode 100644 index 000000000..65c182679 --- /dev/null +++ b/packages/embark-debugger/README.md @@ -0,0 +1,6 @@ +# `embark-debugger` + +> Debugger component for Embark + +Visit [embark.status.im](https://embark.status.im/) to get started with +[Embark](https://github.com/embark-framework/embark). diff --git a/packages/embark-debugger/package.json b/packages/embark-debugger/package.json new file mode 100644 index 000000000..36ec9e45a --- /dev/null +++ b/packages/embark-debugger/package.json @@ -0,0 +1,68 @@ +{ + "name": "embark-debugger", + "version": "4.1.0-beta.0", + "author": "Iuri Matias ", + "contributors": [], + "description": "Debugger component for Embark", + "homepage": "https://github.com/embark-framework/embark/tree/master/packages/embark-debugger#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-debugger", + "type": "git", + "url": "https://github.com/embark-framework/embark.git" + }, + "main": "./dist/index.js", + "scripts": { + "build": "cross-env BABEL_ENV=node babel src --extensions \".ts\" --out-dir dist --root-mode upward --source-maps", + "ci": "npm run qa", + "clean": "npm run reset", + "lint": "npm-run-all lint:*", + "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", + "package": "npm pack", + "qa": "npm-run-all lint typecheck build package", + "reset": "npx rimraf dist embark-*.tgz package", + "start": "npm run watch", + "// test": "nyc --reporter=html --reporter=json mocha \"dist/test/**/*.js\" --exit --no-timeouts --require source-map-support/register", + "typecheck": "tsc", + "watch": "run-p watch:*", + "watch:build": "npm run build -- --verbose --watch", + "watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch" + }, + "dependencies": { + "@babel/runtime-corejs2": "7.3.1", + "async": "2.6.1", + "colors": "1.3.2", + "embark-i18n": "^4.1.0-beta.0", + "remix-debug-debugtest": "0.2.16" + }, + "devDependencies": { + "@babel/cli": "7.2.3", + "@babel/core": "7.2.2", + "cross-env": "5.2.0", + "mocha": "5.2.0", + "npm-run-all": "4.1.5", + "nyc": "13.1.0", + "rimraf": "2.6.3", + "source-map-support": "0.5.9", + "tslint": "5.16.0", + "typescript": "3.4.5" + }, + "engines": { + "node": ">=8.12.0", + "npm": ">=6.4.1", + "yarn": ">=1.12.3" + } +} diff --git a/packages/embark/src/lib/modules/debugger/debugger_manager.ts b/packages/embark-debugger/src/debugger_manager.ts similarity index 100% rename from packages/embark/src/lib/modules/debugger/debugger_manager.ts rename to packages/embark-debugger/src/debugger_manager.ts diff --git a/packages/embark/src/lib/modules/debugger/index.ts b/packages/embark-debugger/src/index.ts similarity index 99% rename from packages/embark/src/lib/modules/debugger/index.ts rename to packages/embark-debugger/src/index.ts index a2d7ceb36..951129957 100644 --- a/packages/embark/src/lib/modules/debugger/index.ts +++ b/packages/embark-debugger/src/index.ts @@ -256,6 +256,9 @@ class TransactionDebugger { }); return; } + if (this.lastTx === "") { + return callback(undefined, __("No transaction to debug")); + } this.currentCmdTxHash = this.lastTx; const filename: string = this.txTracker[this.lastTx].contract.filename; startDebug(this.lastTx, filename, callback); diff --git a/packages/embark-debugger/tsconfig.json b/packages/embark-debugger/tsconfig.json new file mode 100644 index 000000000..52d43eaaa --- /dev/null +++ b/packages/embark-debugger/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*"] +} diff --git a/packages/embark-debugger/tslint.json b/packages/embark-debugger/tslint.json new file mode 100644 index 000000000..0946f2096 --- /dev/null +++ b/packages/embark-debugger/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tslint.json" +} diff --git a/packages/embark/package.json b/packages/embark/package.json index 5c73a5c58..3d6b6a42f 100644 --- a/packages/embark/package.json +++ b/packages/embark/package.json @@ -101,6 +101,7 @@ "embark-console-listener": "^4.1.0-beta.0", "embark-contracts-manager": "^4.1.0-beta.0", "embark-core": "^4.1.0-beta.0", + "embark-debugger": "^4.1.0-beta.0", "embark-deployment": "^4.1.0-beta.0", "embark-deploy-tracker": "^4.1.0-beta.0", "embark-ens": "^4.1.0-beta.0", @@ -165,7 +166,6 @@ "promptly": "2.2.0", "propose": "0.0.5", "pump": "3.0.0", - "remix-debug-debugtest": "0.2.16", "remix-tests": "0.1.1", "request": "2.88.0", "sass-loader": "7.1.0", diff --git a/packages/embark/src/lib/core/engine.js b/packages/embark/src/lib/core/engine.js index 8ce7a9aad..bb509b29c 100644 --- a/packages/embark/src/lib/core/engine.js +++ b/packages/embark/src/lib/core/engine.js @@ -232,7 +232,7 @@ class Engine { this.registerModulePackage('embark-console-listener', {ipc: self.ipc}); this.registerModulePackage('embark-deployment', {plugins: this.plugins, onlyCompile: options.onlyCompile}); this.registerModulePackage('embark-transaction-tracker'); - this.registerModule('debugger'); + this.registerModulePackage('embark-debugger'); this.events.on('file-event', function ({fileType, path}) { clearTimeout(self.fileTimeout);