From ef56fa6c7e62dfa05fb0d69caec44192cd7edb27 Mon Sep 17 00:00:00 2001 From: Pawan Paudel Date: Mon, 6 May 2024 00:34:01 +0545 Subject: [PATCH] chore: Update README --- README.md | 40 ++++++++++++++++------------------------ package.json | 2 +- src/cli.ts | 4 ++-- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 591d435..1ae981e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![JSDocs][jsdocs-src]][jsdocs-href] [![License][license-src]][license-href] -A package to deploy AO contracts. +A package for deploying AO contracts. ## Installation @@ -52,32 +52,26 @@ Options: -w, --wallet [wallet] Path to the wallet JWK file. -l, --lua-path [luaPath] Specify the Lua modules path seperated by semicolon. -d, --deploy [deploy] List of deployment configuration names, separated by commas. - -s, --scheduler [scheduler] Scheduler to use for the process. (default: "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA") + -s, --scheduler [scheduler] Scheduler to be used for the process. (default: "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA") -m, --module [module] Module source for spawning the process. -c, --cron [interval] Cron interval for the process (e.g. 1-minute, 5-minutes). -t, --tags [tags...] Additional tags for spawning the process. - -p, --process-id [processId] Process Id of existing process. + -p, --process-id [processId] Specify process Id of existing process. --concurrency [limit] Concurrency limit for deploying multiple processes. (default: "5") --retry-count [count] Number of retries for deploying contract. (default: "10") --retry-delay [delay] Delay between retries in milliseconds. (default: "3000") -h, --help display help for command ``` -#### CLI Example +#### CLI Examples ```sh ao-deploy process.lua -n tictactoe -w wallet.json --tags name1:value1 name2:value2 ``` -OR, +##### Deployment with configuration -```sh -aod process.lua -n tictactoe -w wallet.json --tags name1:value1 name2:value2 -``` - -#### CLI Example with Deployment configuration - -Here is an example of a deployment configuration. +Here is an example using a deployment configuration: ```ts // aod.config.ts @@ -110,13 +104,13 @@ const config = defineConfig({ export default config ``` -You can deploy all the contracts using the above config file with the following command: +Deploy all specified contracts: ```sh ao-deploy aod.config.ts ``` -You can deploy particular contracts using the above config file with the following command: +Deploy specific contracts: ```sh ao-deploy aod.config.ts --deploy=contract_1,contract_3 @@ -125,17 +119,17 @@ ao-deploy aod.config.ts --deploy=contract_1,contract_3 > [!Note] A wallet is generated and saved if not passed. -Run this command to get the generated wallet path: +Retrieve the generated wallet path: ```sh node -e "const path = require('path'); const os = require('os'); console.log(path.resolve(os.homedir(), '.aos.json'));" ``` -### Code +### API Usage To deploy a contract, you need to import and call the `deployContract` function from your script. Here is a basic example: -#### Example: deployConfig +#### Example: deployContract ```ts import { deployContract } from 'ao-deploy' @@ -159,8 +153,7 @@ async function main() { console.log(`\nDeployed Process: ${processUrl} \nDeployment Message: ${messageUrl}`) } catch (error: any) { - console.log('Deployment failed!') - console.log(error?.message ?? 'Failed to deploy contract!') + console.log(`Deployment failed!: ${error?.message ?? 'Failed to deploy contract!'}\n`) } } @@ -213,10 +206,10 @@ async function main() { delay: 3000, }, } - ] + ], + 2 ) results.forEach((result, idx) => { - const configName = deployConfigs[idx].configName! if (result.status === 'fulfilled') { const { processId, messageId } = result.value const processUrl = `https://ao_marton.g8way.io/#/process/${processId}` @@ -224,13 +217,12 @@ async function main() { console.log(`\nDeployed Process: ${processUrl} \nDeployment Message: ${messageUrl}`) } else { - console.log(`Failed to deploy contract!: ${result.reason}`) + console.log(`Failed to deploy contract!: ${result.reason}\n`) } }) } catch (error: any) { - console.log('Deployment failed!') - console.log(error?.message ?? 'Failed to deploy contract!') + console.log(`Deployment failed!: ${error?.message ?? 'Failed to deploy contract!'}\n`) } } diff --git a/package.json b/package.json index fae6ff5..3410fc0 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "type": "module", "version": "0.1.4", "packageManager": "pnpm@8.15.3", - "description": "A package to deploy AO contracts", + "description": "A package for deploying AO contracts", "author": "Pawan Paudel ", "license": "MIT", "funding": "https://github.com/sponsors/pawanpaudel93", diff --git a/src/cli.ts b/src/cli.ts index 6e606a5..2bac39b 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -64,11 +64,11 @@ program .option('-w, --wallet [wallet]', 'Path to the wallet JWK file.') .option('-l, --lua-path [luaPath]', 'Specify the Lua modules path seperated by semicolon.') .option('-d, --deploy [deploy]', 'List of deployment configuration names, separated by commas.') - .option('-s, --scheduler [scheduler]', 'Scheduler to use for the process.', '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA') + .option('-s, --scheduler [scheduler]', 'Scheduler to be used for the process.', '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA') .option('-m, --module [module]', 'Module source for spawning the process.') .option('-c, --cron [interval]', 'Cron interval for the process (e.g. 1-minute, 5-minutes).') .option('-t, --tags [tags...]', 'Additional tags for spawning the process.') - .option('-p, --process-id [processId]', 'Process Id of existing process.') + .option('-p, --process-id [processId]', 'Specify process Id of an existing process.') .option('--concurrency [limit]', 'Concurrency limit for deploying multiple processes.', '5') .option('--retry-count [count]', 'Number of retries for deploying contract.', '10') .option('--retry-delay [delay]', 'Delay between retries in milliseconds.', '3000')