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(ao-cli): ao build accept multiple files #120 #121

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

twilson63
Copy link
Contributor

This PR, updates the build script to support adding multiple lua files to the wasm process. Since the compiler is running inside docker you have to require your files using the convention that they will be bundled. All files in your current directory are located in the /src/ folder of the docker container.

To properly require you files, you need to do the following:

local foo = require(".src.foo")

In lua, the dots represent slashes, so "/src/foo.lua" is represented by ".src.foo". If you create a folder in your dev environment, then you will need to create that representation in your lua file.

File: /src/lib/bar.lua

local bar = require(".src.lib.bar")

@TillaTheHun0 TillaTheHun0 self-requested a review October 23, 2023 19:40
Copy link
Member

@TillaTheHun0 TillaTheHun0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM.

This looks to be backwards compatible because loader.lua requires .src.contract then invokes handle exported from that module. That module can require as needed.

So since that module will still be included in the bundle, we should be good?

@twilson63 twilson63 merged commit 57aa803 into main Oct 24, 2023
3 checks passed
@TillaTheHun0 TillaTheHun0 linked an issue Oct 26, 2023 that may be closed by this pull request
@TillaTheHun0 TillaTheHun0 deleted the twilson63/feat-ao-cli-ao-build-120 branch October 30, 2023 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(ao-cli): ao build require file support
2 participants