Skip to content

Commit

Permalink
Changed checksum command to use neu hasher (airtasker#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
lfportal authored Jan 22, 2020
1 parent 3273bc0 commit ac2dd1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ npx @airtasker/spot generate --contract api.ts

## `spot checksum SPOT_CONTRACT`

Generate a version tag based on a Spot contract
Generate a checksum for a Spot contract

```
USAGE
Expand All @@ -135,7 +135,7 @@ OPTIONS
-h, --help show CLI help
EXAMPLE
$ spot mock api.ts
$ spot checksum api.ts
```

_See code: [build/cli/src/commands/checksum.js](https://github.com/airtasker/spot/blob/v0.3.1/build/cli/src/commands/checksum.js)_
Expand Down
14 changes: 7 additions & 7 deletions cli/src/commands/checksum.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Command, flags } from "@oclif/command";
import { hashContractDefinition } from "../../../lib/src/checksum/hash";
import { safeParse } from "../common/safe-parse";
import { hashContract } from "../../../lib/src/neu/checksum/hash";
import { parse } from "../../../lib/src/neu/parser";

const ARG_API = "spot_contract";

/**
* oclif command to generate a tag based on a Spot contract
* oclif command to generate a checksum for a Spot contract
*/
export default class Checksum extends Command {
static description = "Generate a version tag based on a Spot contract";
static description = "Generate a checksum for a Spot contract";

static examples = ["$ spot mock api.ts"];
static examples = ["$ spot checksum api.ts"];

static args = [
{
Expand All @@ -28,8 +28,8 @@ export default class Checksum extends Command {
async run() {
const { args } = this.parse(Checksum);
try {
const contract = safeParse.call(this, args[ARG_API]).definition;
const hash = hashContractDefinition(contract);
const contract = parse(args[ARG_API]);
const hash = hashContract(contract);
this.log(hash);
} catch (e) {
this.error(e, { exit: 1 });
Expand Down

0 comments on commit ac2dd1c

Please sign in to comment.