From 217be0bb504ff2a745feec9f824d5d336ecb8d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Iv=C3=A1n=20Vieitez=20Parra?= <3857362+corrideat@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:55:30 +0100 Subject: [PATCH] Add contract name to manifest --- HISTORY.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/help.ts | 2 +- src/manifest.ts | 6 ++++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 635465e..18ca6d0 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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. diff --git a/package-lock.json b/package-lock.json index 338683e..0963ce1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@chelonia/cli", - "version": "2.1.1", + "version": "2.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@chelonia/cli", - "version": "2.1.1", + "version": "2.1.2", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { diff --git a/package.json b/package.json index a4cb5b5..72ff615 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/help.ts b/src/help.ts index 6f6cfba..7f2583c 100644 --- a/src/help.ts +++ b/src/help.ts @@ -8,7 +8,7 @@ export function help (args?: string[]) { chel version chel keygen [--out ] [--pubout ] chel verifySignature [-k ] - chel manifest [-k|--key [-k|--key ...]] [--out=] [-s|--slim ] [-v|--version ] + chel manifest [-k|--key [-k|--key ...]] [--out=] [-s|--slim ] [-v|--version ] [-n|--name ] chel deploy [ [ ...]] chel upload [ [ ...]] chel latestState diff --git a/src/manifest.ts b/src/manifest.ts index 6a0687d..94ad42b 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -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) @@ -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),