Skip to content

Commit

Permalink
refactor(encrypt): Change output format
Browse files Browse the repository at this point in the history
BREAKING CHANGE: JSON string format changed
  • Loading branch information
JisuPark committed Oct 14, 2018
1 parent 5c95748 commit 3ab87dc
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 31 deletions.
7 changes: 6 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"packages": [
"packages/*"
],
"version": "0.0.2-alpha.0"
"version": "0.0.2-alpha.0",
"command": {
"publish": {
"conventionalCommits": true
}
}
}
11 changes: 4 additions & 7 deletions packages/sooho-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->

# Usage
<!-- usage -->

```sh-session
$ npm install -g @sooho/cli
$ sooho COMMAND
Expand All @@ -25,9 +23,9 @@ USAGE
$ sooho COMMAND
...
```
<!-- usagestop -->

# Commands
<!-- commands -->

* [`sooho encrypt FILEPATH`](#sooho-encrypt-filepath)
* [`sooho help [COMMAND]`](#sooho-help-command)

Expand Down Expand Up @@ -68,4 +66,3 @@ OPTIONS
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.1.3/src/commands/help.ts)_
<!-- commandsstop -->
11 changes: 7 additions & 4 deletions packages/sooho-cli/src/commands/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand All @@ -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'))
}
}
})
Expand Down
10 changes: 5 additions & 5 deletions packages/sooho-cli/test/commands/encrypt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
''
])
Expand All @@ -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',
''
])
Expand Down
9 changes: 0 additions & 9 deletions packages/sooho-parser/CHANGES.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 4 additions & 5 deletions packages/sooho-parser/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 3ab87dc

Please sign in to comment.