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

feat: build support #5

Merged
merged 21 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d8394a5
chore: release v0.2.3
kranthicodes Jul 20, 2024
cbcf4b2
chore: release v0.2.4
kranthicodes Jul 20, 2024
ce8383b
chore: release v0.2.5
kranthicodes Jul 20, 2024
3d5a8fc
chore: release v0.2.6
kranthicodes Jul 20, 2024
01253b0
chore: release v0.2.7
kranthicodes Jul 20, 2024
922f27f
feat: add utils to write/clear build file to project dir
kranthicodes Jul 20, 2024
056a6e8
feat: add BundleResult and BundlingConfig types
kranthicodes Jul 20, 2024
c238850
feat: add Error types for Build and Deploy
kranthicodes Jul 20, 2024
841f5ad
feat: add handle to load and bundle process code
kranthicodes Jul 20, 2024
26230da
refactor: use deploying logger after load contract
kranthicodes Jul 20, 2024
f0b8c63
feat: add flags to handle onlyBuild case
kranthicodes Jul 20, 2024
146b0e1
fix: undo package name and version
kranthicodes Jul 20, 2024
84b9a19
chore: update README
kranthicodes Jul 20, 2024
6e2b876
refactor: update docs and address pr reviews
kranthicodes Jul 22, 2024
9ffb347
Merge pull request #4 from kranthicodes/main
pawanpaudel93 Jul 27, 2024
c92e534
refactor: Support building contract with provided names from config w…
pawanpaudel93 Jul 27, 2024
9a9660e
chore: Add CONTRIBUTING.md
pawanpaudel93 Jul 27, 2024
ee8c0bf
refactor: Rename build arguments & added lua path for build
pawanpaudel93 Jul 28, 2024
487200e
chore: Update README
pawanpaudel93 Jul 28, 2024
e2c6cbf
chore: Update README
pawanpaudel93 Jul 28, 2024
b8edf4d
chore: Update README with Features section
pawanpaudel93 Jul 28, 2024
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
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
Loading