From 3ab87dcd7b3ec1a9fbb624144c59155ea783df1b Mon Sep 17 00:00:00 2001 From: JisuPark Date: Mon, 15 Oct 2018 06:02:03 +0900 Subject: [PATCH] refactor(encrypt): Change output format BREAKING CHANGE: JSON string format changed --- lerna.json | 7 ++++++- packages/sooho-cli/README.md | 11 ++++------- packages/sooho-cli/src/commands/encrypt.ts | 11 +++++++---- packages/sooho-cli/test/commands/encrypt.test.ts | 10 +++++----- packages/sooho-parser/CHANGES.md | 9 --------- packages/sooho-parser/README.md | 9 ++++----- 6 files changed, 26 insertions(+), 31 deletions(-) diff --git a/lerna.json b/lerna.json index 92e5ff07..f1694f48 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,10 @@ "packages": [ "packages/*" ], - "version": "0.0.2-alpha.0" + "version": "0.0.2-alpha.0", + "command": { + "publish": { + "conventionalCommits": true + } + } } diff --git a/packages/sooho-cli/README.md b/packages/sooho-cli/README.md index 04bbe07a..26f5e047 100644 --- a/packages/sooho-cli/README.md +++ b/packages/sooho-cli/README.md @@ -3,17 +3,15 @@ CLI tool to interact with Sooho -[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io) [![Version](https://img.shields.io/npm/v/@sooho/cli.svg)](https://npmjs.org/package/@sooho/cli) [![Downloads/week](https://img.shields.io/npm/dw/@sooho/cli.svg)](https://npmjs.org/package/@sooho/cli) [![License](https://img.shields.io/npm/l/@sooho/cli.svg)](https://github.com/soohoio/sooho/blob/master/package.json) - * [Usage](#usage) * [Commands](#commands) - + # Usage - + ```sh-session $ npm install -g @sooho/cli $ sooho COMMAND @@ -25,9 +23,9 @@ USAGE $ sooho COMMAND ... ``` - + # Commands - + * [`sooho encrypt FILEPATH`](#sooho-encrypt-filepath) * [`sooho help [COMMAND]`](#sooho-help-command) @@ -68,4 +66,3 @@ OPTIONS ``` _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.1.3/src/commands/help.ts)_ - diff --git a/packages/sooho-cli/src/commands/encrypt.ts b/packages/sooho-cli/src/commands/encrypt.ts index e01cc23e..0676f973 100644 --- a/packages/sooho-cli/src/commands/encrypt.ts +++ b/packages/sooho-cli/src/commands/encrypt.ts @@ -20,8 +20,8 @@ export default class Encrypt extends Command { async run() { const {args, flags} = this.parse(Encrypt) - const filePath = args.filePath; - const abstract = flags.abstract || false; + const filePath = args.filePath + const abstract = flags.abstract || false this.log( `Extracting signatures in ${filePath}`, @@ -42,8 +42,11 @@ export default class Encrypt extends Command { } else { this.log('[Function]') const body = node.self.getText() - this.log(JSON.stringify(node.loc)) - this.log(crypto.createHash('md5').update(body).digest("hex")) + this.log(JSON.stringify({ + startLine: node.loc.start.line, + endLine: node.loc.end.line + })) + this.log(crypto.createHash('md5').update(body).digest('hex')) } } }) diff --git a/packages/sooho-cli/test/commands/encrypt.test.ts b/packages/sooho-cli/test/commands/encrypt.test.ts index 4828b994..238be880 100644 --- a/packages/sooho-cli/test/commands/encrypt.test.ts +++ b/packages/sooho-cli/test/commands/encrypt.test.ts @@ -7,13 +7,13 @@ describe('encrypt', () => { .it('runs extract functions from Test.sol without abstraction', ctx => { const result = ctx.stdout.split('\n') - expect(result).to.equal([ + expect(result).to.deep.equal([ 'Extracting signatures in test/commands/Test.sol without abstraction', '[Function]', - JSON.stringify({ start: {line: 17, column: 2}, end: {line: 20, column: 2}}), + JSON.stringify({ startLine: 17, endLine: 20 }), 'c1804baf32d7f6c23426803ffd8d9456', '[Function]', - JSON.stringify({ start: {line: 22, column: 2}, end: {line: 25, column: 2}}), + JSON.stringify({ startLine: 22, endLine: 25 }), '5e3c146b68293fe4808f0dd8c1a88c8d', '' ]) @@ -28,10 +28,10 @@ describe('encrypt', () => { expect(result).to.deep.equal([ 'Extracting signatures in test/commands/Test.sol with abstraction', '[Function]', - JSON.stringify({ start: {line: 17, column: 2}, end: {line: 20, column: 2}}), + JSON.stringify({ startLine: 17, endLine: 20 }), '2ca728bd15bd3a7616d189e355fe6431', '[Function]', - JSON.stringify({ start: {line: 22, column: 2}, end: {line: 25, column: 2}}), + JSON.stringify({ startLine: 22, endLine: 25 }), '5e3c146b68293fe4808f0dd8c1a88c8d', '' ]) diff --git a/packages/sooho-parser/CHANGES.md b/packages/sooho-parser/CHANGES.md index f6a91a62..e69de29b 100644 --- a/packages/sooho-parser/CHANGES.md +++ b/packages/sooho-parser/CHANGES.md @@ -1,9 +0,0 @@ -### 0.3.1 - - * Fix parsing of zero-component tuples. - -### 0.3.0 - - * Use `components` for all `TupleExpression` nodes. Earlier versions - incorrectly stored tuple components under the `elements` key. - * Fix parsing of decimal literals without integer part. diff --git a/packages/sooho-parser/README.md b/packages/sooho-parser/README.md index 645d29dd..a5c5500f 100644 --- a/packages/sooho-parser/README.md +++ b/packages/sooho-parser/README.md @@ -1,9 +1,6 @@ -solidity-parser-antlr +@sooho/parser ===================== -[![npm](https://img.shields.io/npm/v/solidity-parser-antlr.svg)](https://www.npmjs.com/package/solidity-parser-antlr) -[![Build Status](https://travis-ci.org/federicobond/solidity-parser-antlr.svg?branch=master)](https://travis-ci.org/federicobond/solidity-parser-antlr) - A Solidity parser built on top of a robust [ANTLR4 grammar](https://github.com/solidityj/solidity-antlr4). ### Usage @@ -68,7 +65,9 @@ parser.visit(ast, { ### Author -Federico Bond ([@federicobond](https://github.com/federicobond)) +Jisu Park ([@jisupark](https://github.com/jisupark)) + +And thanks to Federico Bond ([@federicobond](https://github.com/federicobond)) for the previous projects ### License