Skip to content

Commit

Permalink
Add contract name to manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
corrideat committed Mar 28, 2024
1 parent 406fec0 commit 96152aa
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# HISTORY

### v2.1.2

- Add a `name` field to the manifest with the contract's name

### v2.1.1

- Change the way signing key files are read (from `import` to `readFile`) so that `chel manifest` works.
Expand Down
1 change: 0 additions & 1 deletion bin/chel

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chelonia/cli",
"version": "2.1.1",
"version": "2.1.2",
"description": "Chelonia Command-line Interface",
"main": "src/main.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function help (args?: string[]) {
chel version
chel keygen [--out <key.json>] [--pubout <key.pub.json>]
chel verifySignature [-k <pubkey.json>] <manifest.json>
chel manifest [-k|--key <pubkey1.json> [-k|--key <pubkey2.json> ...]] [--out=<manifest.json>] [-s|--slim <contract-slim.js>] [-v|--version <version>] <key.json> <contract-bundle.js>
chel manifest [-k|--key <pubkey1.json> [-k|--key <pubkey2.json> ...]] [--out=<manifest.json>] [-s|--slim <contract-slim.js>] [-v|--version <version>] [-n|--name <name>] <key.json> <contract-bundle.js>
chel deploy <url-or-dir-or-sqlitedb> <contract-manifest.json> [<manifest2.json> [<manifest3.json> ...]]
chel upload <url-or-dir-or-sqlitedb> <file1> [<file2> [<file3> ...]]
chel latestState <url> <contractID>
Expand Down
6 changes: 4 additions & 2 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ export async function manifest (args: string[]) {
const parsedArgs = flags.parse(args, { collect: ['key'], alias: { 'key': 'k' } })
const [keyFile, contractFile] = parsedArgs._
const parsedFilepath = path.parse(contractFile as string)
const { name: contractName, base: contractBasename, dir: contractDir } = parsedFilepath
const { name: contractFileName, base: contractBasename, dir: contractDir } = parsedFilepath
const name = parsedArgs.name || parsedArgs.n || contractFileName
const version = parsedArgs.version || parsedArgs.v || 'x'
const slim = parsedArgs.slim || parsedArgs.s
const outFilepath = path.join(contractDir, `${contractName}.${version}.manifest.json`)
const outFilepath = path.join(contractDir, `${contractFileName}.${version}.manifest.json`)
if (!keyFile) exit('Missing signing key file')

const signingKeyDescriptor = await readJsonFile(keyFile)
Expand All @@ -41,6 +42,7 @@ export async function manifest (args: string[]) {
) || []))
))
const body: {[key: string]: unknown} = {
name,
version,
contract: {
hash: await hash([contractFile as string], true),
Expand Down

0 comments on commit 96152aa

Please sign in to comment.