Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contract name to manifest #36

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading