Skip to content

Commit

Permalink
build: use 'bundle' field instead of table
Browse files Browse the repository at this point in the history
  • Loading branch information
lukadev-0 committed Feb 5, 2024
1 parent 7110b91 commit 8ab9b66
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
10 changes: 3 additions & 7 deletions .lune/build.luau
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,16 @@ local function buildBundle()
stdio.write(stdio.style("reset"))

local entrypoint = ""
entrypoint ..= "local util = {}\n"
entrypoint ..= "return {\n"

for _, dir in fs.readDir("packages") do
local packageConfig = serde.decode("toml", fs.readFile(`packages/{dir}/config.toml`))
if packageConfig.bundle then
entrypoint ..= `local util_{dir} = require("../pkg/{dir}/lune")\n`
for name, path in pairs(packageConfig.bundle) do
local fullPath = path:gsub("%$", `util_{dir}`)
entrypoint ..= `util.{name} = {fullPath}\n`
end
entrypoint ..= ` {packageConfig.bundle} = require("../pkg/{dir}/lune"),\n`
end
end

entrypoint ..= "return util\n"
entrypoint ..= "}\n"

fs.writeFile("build/src/util.luau", entrypoint)

Expand Down
4 changes: 1 addition & 3 deletions packages/option/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ description = "Option<T> type in Luau"
version = "1.0.0"

types = ["Option<T>"]

[bundle]
Option = "$"
bundle = "Option"
4 changes: 1 addition & 3 deletions packages/result/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ description = "Result<T, E> type in Luau"
version = "1.0.0"

types = ["Result<T, E>"]

[bundle]
Result = "$"
bundle = "Result"

0 comments on commit 8ab9b66

Please sign in to comment.