Autonomous-Finance / aoform

provisioning tool for AO
2 stars 2 forks source link

Throw if the eval message errors #1

Open kernelwhisperer opened 4 months ago

kernelwhisperer commented 4 months ago

Sometimes I still use aos and .load contract.lua to deploy because if there is a compile time error, it prints to the console.

Would be nice if aoform did the same.

@smowden thoughts?

smowden commented 4 months ago

i actually use a lua linter for that in my build script

/opt/homebrew/bin/luacheck process.lua schemas.lua sqlschema.lua intervals.lua candles.lua stats.lua validation.lua indicators.lua
/opt/homebrew/bin/amalg.lua -s process.lua -o build/output.lua sqlschema intervals schemas validation candles stats indicators
npx aoform apply
kernelwhisperer commented 4 months ago

Me too: https://github.com/Autonomous-Finance/dexscreener/blob/feat/agents/ao/build.sh

#!/bin/bash

if [[ "$(uname)" == "Linux" ]]; then
    BIN_PATH="$HOME/.luarocks/bin"
else
    BIN_PATH="/opt/homebrew/bin"
fi

# Navigate to src directory
cd "$(dirname "$0")/src"

# Run lint
$BIN_PATH/luacheck process.lua validation-schemas.lua db-utils.lua

# Run build
$BIN_PATH/amalg.lua -s process.lua -o ../build/output.lua db-utils validation-schemas validation

I had to update it to work on linux, but it's almost the same.

The issue I had was:

  1. I moved all the lua files in src
  2. I built with amalg.lua -s src/process.lua -o build/output.lua src/db-utils src/validation-schemas src/validation

This built it successfully, but failed when doing .load output.lua

This is why the script changes directory to src now.