Skip to content

Commit

Permalink
Merge pull request #5 from pawanpaudel93/feat/build-support
Browse files Browse the repository at this point in the history
feat: build support
  • Loading branch information
pawanpaudel93 authored Jul 28, 2024
2 parents 3ffb979 + b8edf4d commit 3ea7d98
Show file tree
Hide file tree
Showing 10 changed files with 491 additions and 67 deletions.
92 changes: 91 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1,91 @@
Please refer to https://github.com/pawanpaudel93/contribute
# Contributing to ao-deploy

Thank you for considering contributing to ao-deploy! We welcome contributions from everyone. To ensure a smooth process, please follow the guidelines below.

## How to Contribute

### Reporting Issues

1. **Search for existing issues**: Before opening a new issue, make sure to check if the issue has already been reported.
2. **Provide detailed information**: Include a clear and concise description of the issue, steps to reproduce it, and any relevant screenshots or logs.
3. **Open an issue**: Report issues on our [issue tracker](https://github.com/pawanpaudel93/ao-deploy/issues).

### Contributing Code

1. **Fork the repository**: Create a personal copy of the repository on GitHub by forking it.
2. **Create a branch**: Make sure to create a new branch for your changes. Use a descriptive name for your branch (e.g., `fix-typo`, `add-new-feature`).
3. **Install dependencies**: Use `pnpm` to install dependencies.

```bash
pnpm install
```

4. **Make changes**: Implement your changes in your branch.
5. **Test your changes**: Ensure that your changes do not break any existing functionality.

6. **Lint your code**: Ensure your code follows the project's coding standards.
```bash
pnpm lint
```
7. **Submit a pull request**: Push your changes to your forked repository and open a pull request to the main repository. Provide a clear description of the changes and why they are needed.
### Development Guidelines
1. **Code style**:
- Follow the coding style and guidelines as configured in our ESLint setup. We use `@antfu/eslint-config` for ESLint configuration.
- Ensure code formatting using ESLint. We have `lint-staged` configured to run `eslint --fix` on staged files before committing.
2. **Documentation**: Update documentation as necessary to reflect your changes.
3. **Commit messages**: Write clear and concise commit messages that explain the purpose of the changes.
### Scripts
- **Build**: Build the project using `unbuild`.
```bash
pnpm build
```
- **Dev**: Start the development server.
```bash
pnpm dev
```
- **Lint**: Lint the project using ESLint.
```bash
pnpm lint
```
- **Test**: Run tests using Vitest.
```bash
pnpm test
```
- **Typecheck**: Check TypeScript types.
```bash
pnpm typecheck
```
- **Release**: Bump version and publish.
```bash
pnpm release
```
- **Prepare**: Prepare git hooks using `simple-git-hooks`.
```bash
pnpm prepare
```
## Need Help?
If you need assistance or have questions, feel free to reach out to us through our [issue tracker](https://github.com/pawanpaudel93/ao-deploy/issues).
Thank you for contributing!
84 changes: 79 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![JSDocs][jsdocs-src]][jsdocs-href]
[![License][license-src]][license-href]

A package for deploying AO contracts.

## Features

- Build only or deploy AO contracts with ease.
- Custom LUA_PATH support.
- Support LuaRocks packages.
- Support for deployment configuration.
- Flexible concurrency and retry options for reliable deployments.
- CLI and API interfaces for versatile usage.

## Installation

### Using npm
Expand Down Expand Up @@ -52,24 +60,27 @@ 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.
-b, --build [build] List of deployment configuration names, separated by commas.
-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] Specify process Id of existing process.
--build-only Bundle the contract into a single file and store it in the process-dist directory.
--out-dir [outDir] Used with --build-only to output the single bundle contract file to a specified directory.
--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 Examples
#### Example: Deploy contract

```sh
ao-deploy process.lua -n tictactoe -w wallet.json --tags name1:value1 name2:value2
```

##### Deployment with configuration
#### Example: Deploy contracts with configuration

Here is an example using a deployment configuration:

Expand Down Expand Up @@ -116,6 +127,71 @@ Deploy specific contracts:
ao-deploy aod.config.ts --deploy=contract_1,contract_3
```

#### Example: Build Contract

To Build contracts and produce single bundle lua file, take a look at below provided commands

Build contract and save to default(`process-dist`) directory:

```sh
aod src/process.lua -n my-process --build-only
```

Build contract and save to specific directory:

```sh
aod src/process.lua -n my-process --build-only --out-dir <PATH>
aod src/process.lua -n my-process --build-only --out-dir ./dist
```

#### Example: Build Contracts using Configuration

To Build contracts using config, take a look at below provided example

Here is an example using a deployment configuration:

```ts
// aod.config.ts
import { defineConfig } from 'ao-deploy'

const luaPath = './?.lua;./src/?.lua'

const config = defineConfig({
contract_1: {
luaPath,
name: `contract-1`,
contractPath: 'contract-1.lua',
outDir: './dist',
},
contract_2: {
luaPath,
name: `contract-2`,
contractPath: 'contract-2.lua',
outDir: './dist',
},
contract_3: {
luaPath,
name: `contract-3`,
contractPath: 'contract-3.lua',
outDir: './dist',
}
})

export default config
```

Build all specified contracts:

```sh
ao-deploy aod.config.ts --build-only
```

Build specific contracts:

```sh
ao-deploy aod.config.ts --build=contract_1,contract_3 --build-only
```

> [!Note]
A wallet is generated and saved if not passed.

Expand Down Expand Up @@ -251,8 +327,6 @@ Copyright © 2024 [Pawan Paudel](https://github.com/pawanpaudel93).
[npm-version-href]: https://npmjs.com/package/ao-deploy
[npm-downloads-src]: https://img.shields.io/npm/dm/ao-deploy?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/ao-deploy
[bundle-src]: https://img.shields.io/bundlephobia/minzip/ao-deploy?style=flat&colorA=080f12&colorB=1fa669&label=minzip
[bundle-href]: https://bundlephobia.com/result?p=ao-deploy
[license-src]: https://img.shields.io/github/license/pawanpaudel93/ao-deploy.svg?style=flat&colorA=080f12&colorB=1fa669
[license-href]: https://github.com/pawanpaudel93/ao-deploy/blob/main/LICENSE
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"prepare": "simple-git-hooks"
},
"dependencies": {
"@permaweb/aoconnect": "^0.0.53",
"@permaweb/aoconnect": "^0.0.57",
"ardb": "^1.1.10",
"arweave": "^1.15.1",
"chalk": "^5.3.0",
Expand Down
Loading

0 comments on commit 3ea7d98

Please sign in to comment.