Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.

Commit 3ab87dc

Browse files
committed
refactor(encrypt): Change output format
BREAKING CHANGE: JSON string format changed
1 parent 5c95748 commit 3ab87dc

6 files changed

Lines changed: 26 additions & 31 deletions

File tree

lerna.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "0.0.2-alpha.0"
5+
"version": "0.0.2-alpha.0",
6+
"command": {
7+
"publish": {
8+
"conventionalCommits": true
9+
}
10+
}
611
}

packages/sooho-cli/README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33

44
CLI tool to interact with Sooho
55

6-
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
76
[![Version](https://img.shields.io/npm/v/@sooho/cli.svg)](https://npmjs.org/package/@sooho/cli)
87
[![Downloads/week](https://img.shields.io/npm/dw/@sooho/cli.svg)](https://npmjs.org/package/@sooho/cli)
98
[![License](https://img.shields.io/npm/l/@sooho/cli.svg)](https://github.com/soohoio/sooho/blob/master/package.json)
109

11-
<!-- toc -->
1210
* [Usage](#usage)
1311
* [Commands](#commands)
14-
<!-- tocstop -->
12+
1513
# Usage
16-
<!-- usage -->
14+
1715
```sh-session
1816
$ npm install -g @sooho/cli
1917
$ sooho COMMAND
@@ -25,9 +23,9 @@ USAGE
2523
$ sooho COMMAND
2624
...
2725
```
28-
<!-- usagestop -->
26+
2927
# Commands
30-
<!-- commands -->
28+
3129
* [`sooho encrypt FILEPATH`](#sooho-encrypt-filepath)
3230
* [`sooho help [COMMAND]`](#sooho-help-command)
3331

@@ -68,4 +66,3 @@ OPTIONS
6866
```
6967

7068
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.1.3/src/commands/help.ts)_
71-
<!-- commandsstop -->

packages/sooho-cli/src/commands/encrypt.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export default class Encrypt extends Command {
2020

2121
async run() {
2222
const {args, flags} = this.parse(Encrypt)
23-
const filePath = args.filePath;
24-
const abstract = flags.abstract || false;
23+
const filePath = args.filePath
24+
const abstract = flags.abstract || false
2525

2626
this.log(
2727
`Extracting signatures in ${filePath}`,
@@ -42,8 +42,11 @@ export default class Encrypt extends Command {
4242
} else {
4343
this.log('[Function]')
4444
const body = node.self.getText()
45-
this.log(JSON.stringify(node.loc))
46-
this.log(crypto.createHash('md5').update(body).digest("hex"))
45+
this.log(JSON.stringify({
46+
startLine: node.loc.start.line,
47+
endLine: node.loc.end.line
48+
}))
49+
this.log(crypto.createHash('md5').update(body).digest('hex'))
4750
}
4851
}
4952
})

packages/sooho-cli/test/commands/encrypt.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ describe('encrypt', () => {
77
.it('runs extract functions from Test.sol without abstraction', ctx => {
88
const result = ctx.stdout.split('\n')
99

10-
expect(result).to.equal([
10+
expect(result).to.deep.equal([
1111
'Extracting signatures in test/commands/Test.sol without abstraction',
1212
'[Function]',
13-
JSON.stringify({ start: {line: 17, column: 2}, end: {line: 20, column: 2}}),
13+
JSON.stringify({ startLine: 17, endLine: 20 }),
1414
'c1804baf32d7f6c23426803ffd8d9456',
1515
'[Function]',
16-
JSON.stringify({ start: {line: 22, column: 2}, end: {line: 25, column: 2}}),
16+
JSON.stringify({ startLine: 22, endLine: 25 }),
1717
'5e3c146b68293fe4808f0dd8c1a88c8d',
1818
''
1919
])
@@ -28,10 +28,10 @@ describe('encrypt', () => {
2828
expect(result).to.deep.equal([
2929
'Extracting signatures in test/commands/Test.sol with abstraction',
3030
'[Function]',
31-
JSON.stringify({ start: {line: 17, column: 2}, end: {line: 20, column: 2}}),
31+
JSON.stringify({ startLine: 17, endLine: 20 }),
3232
'2ca728bd15bd3a7616d189e355fe6431',
3333
'[Function]',
34-
JSON.stringify({ start: {line: 22, column: 2}, end: {line: 25, column: 2}}),
34+
JSON.stringify({ startLine: 22, endLine: 25 }),
3535
'5e3c146b68293fe4808f0dd8c1a88c8d',
3636
''
3737
])

packages/sooho-parser/CHANGES.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
### 0.3.1
2-
3-
* Fix parsing of zero-component tuples.
4-
5-
### 0.3.0
6-
7-
* Use `components` for all `TupleExpression` nodes. Earlier versions
8-
incorrectly stored tuple components under the `elements` key.
9-
* Fix parsing of decimal literals without integer part.

packages/sooho-parser/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
solidity-parser-antlr
1+
@sooho/parser
22
=====================
33

4-
[![npm](https://img.shields.io/npm/v/solidity-parser-antlr.svg)](https://www.npmjs.com/package/solidity-parser-antlr)
5-
[![Build Status](https://travis-ci.org/federicobond/solidity-parser-antlr.svg?branch=master)](https://travis-ci.org/federicobond/solidity-parser-antlr)
6-
74
A Solidity parser built on top of a robust [ANTLR4 grammar](https://github.com/solidityj/solidity-antlr4).
85

96
### Usage
@@ -68,7 +65,9 @@ parser.visit(ast, {
6865

6966
### Author
7067

71-
Federico Bond ([@federicobond](https://github.com/federicobond))
68+
Jisu Park ([@jisupark](https://github.com/jisupark))
69+
70+
And thanks to Federico Bond ([@federicobond](https://github.com/federicobond)) for the previous projects
7271

7372
### License
7473

0 commit comments

Comments
 (0)