Skip to content

Commit 9886663

Browse files
committed
Fix all logic for Lune 0.8, bump Wax from 0.3.7 -> 0.4.0
1 parent 4619584 commit 9886663

File tree

6 files changed

+44
-21
lines changed

6 files changed

+44
-21
lines changed

README.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
A Fast Runtime Lua 5.1x+/Luau Project Bundler, Using Roblox Models and Module-Require Semantics
2222

23-
*Powered by [Lune](https://github.com/filiptibell/lune), a standalone Luau script runtime*
23+
*Powered by [Lune](https://github.com/lune-org/lune), a standalone Luau script runtime*
2424

2525
## 🎉 About
2626

@@ -37,29 +37,30 @@ This is more of a successor to [Maui](https://github.com/latte-soft/maui), a sim
3737
* Built-in support for minifying bundled output directly with [Darklua](https://darklua.com) and either our default configuration (no extra steps), or your project's own `.darklua.json/json5` file for making personal tweaks.
3838
* Localized/flattened modified globals in closures, meaning `getfenv`/`setfenv` aren't used to modify the script's environment - This also means that in Luau, `safeenv` runtime optimizations are maintained, and closures run 'natively' with no user modification!
3939
* Automated CI/deployment pipeline usage in mind, with the `ci-mode` flag; no user confirmation prompts, and exits with a `1` status code upon any errors
40-
* A 'virtual' Roblox-like DOM for scripts that can run completely outside of Roblox, while also allowing module imports (`require()`) with a simulated relative `script` global, or traditional filesystem path strings like in [Lune](https://github.com/filiptibell/lune) or the Lua/Luau CLI REPLs.
40+
* A 'virtual' Roblox-like DOM for scripts that can run completely outside of Roblox, while also allowing module imports (`require()`) with a simulated relative `script` global, or traditional filesystem path strings like in [Lune](https://github.com/lune-org/lune) or the Lua/Luau CLI REPLs.
4141

4242
Additionally, you can check out some example "projects" in our [tests](tests) directory if you don't really know what all of this is about, or how to get started..
4343

4444
## ⚙️ Installation
4545

46-
For your project, you **must** have at least [Lune](https://github.com/filiptibell/lune) installed, most easily done and managed with [Aftman](https://github.com/LPGhatguy/aftman):
46+
For your project, you **must** have at least [Lune](https://github.com/lune-org/lune) installed, most easily done and managed with [Aftman](https://github.com/LPGhatguy/aftman):
4747

4848
1. Goto Aftman's GitHub repository (linked above), and follow its installation instructions for your platform
4949
2. Open the root directory of your project in your system's terminal, and run the following:
5050

5151
```
5252
aftman init
53-
aftman add filiptibell/lune
53+
aftman add lune-org/lune
5454
```
5555

5656
3. If you've setup Aftman properly, you can now try running `lune --help`, and if all is well you should see something similar to the following in your terminal:
5757

5858
```
5959
$ lune --help
60-
A Luau script runner
60+
A standalone Luau runtime
6161
62-
Usage: lune [OPTIONS] [SCRIPT_PATH] [SCRIPT_ARGS]...
62+
Usage: lune [COMMAND]
63+
...
6364
```
6465

6566
### Add Wax to Your Lune Scripts
@@ -78,7 +79,7 @@ If you already have a "`lune`", "`.lune`", or similar directory in your project
7879
]]
7980

8081
-- You set the following string to "latest" (case insensitive), or any version tag
81-
-- on Wax's releases page (e.g. "0.3.7")
82+
-- on Wax's releases page (e.g. "0.4.0")
8283
local WaxVersion = "latest"
8384

8485
-------------------------------------------------------------------------------
@@ -96,14 +97,14 @@ luau.load(net.request(FileLink).body, {
9697

9798
```
9899

99-
3. Now, when running `lune wax`, you should see something similar to what's in the next section ([Usage](#🚀-usage)) in your terminal. Voilà!
100+
3. Now, when running `lune run wax`, you should see something similar to what's in the next section ([Usage](#🚀-usage)) in your terminal. Voilà!
100101

101102
## 🚀 Usage
102103

103-
From your terminal in the root directory of your project, run `lune wax`, or just `lune <path/to/wax.luau>`
104+
From your terminal in the root directory of your project, run `lune run wax`, or just `lune run <path/to/wax.luau>`
104105

105106
```
106-
Wax 0.3.7
107+
Wax 0.4.0
107108
A Fast Runtime Lua 5.1x+/Luau Project Bundler, Using Roblox Models and Module-Require Semantics
108109
109110
USAGE:

lune/lib/data/Version.luau

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
return "0.3.7"
1+
return "0.4.0"

lune/make.luau

+21-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ local CodegenHeader = [[
3030
3131
]=]
3232

33+
local BuildFlags = {
34+
["build-standalone-wine"] = false
35+
}
36+
37+
for _, BuildFlag in process.args do
38+
if BuildFlags[BuildFlag] ~= nil then
39+
BuildFlags[BuildFlag] = true
40+
end
41+
end
42+
3343
local CodegenHeaderExtraLines = StringUtils.LineCount(CodegenHeader) - 1
3444

3545
CommandUtils.CheckCommands({"lune", "rojo", "darklua"})
@@ -66,12 +76,21 @@ local function HandleRun(...)
6676
end
6777
end
6878

69-
HandleRun("lune", {"wax", "bundle", "output=build/wax.dbg.luau", `extra-offset-lines={CodegenHeaderExtraLines}`, "ci-mode=true"})
70-
HandleRun("lune", {"wax", "bundle", "output=build/wax.luau", "minify=true", "ci-mode=true"})
79+
HandleRun("lune", {"run", "wax", "bundle", "output=build/wax.dbg.luau", `extra-offset-lines={CodegenHeaderExtraLines}`, "ci-mode=true"})
80+
HandleRun("lune", {"run", "wax", "bundle", "output=build/wax.luau", "minify=true", "ci-mode=true"})
7181

7282
Log.Info("(Adding CodegenHeader)")
7383
WriteFile("build/wax.dbg.luau", CodegenHeader .. fs.readFile("build/wax.dbg.luau"))
7484
WriteFile("build/wax.luau", CodegenHeader .. fs.readFile("build/wax.luau"))
7585

86+
Log.Info("Building standalone Wax binary")
87+
HandleRun("lune", {"build", "build/wax.luau"})
88+
89+
-- For cross-compilation to Windows from Unix
90+
if BuildFlags["build-standalone-wine"] then
91+
Log.Info("Cross-building standalone Wax binary for Windows (via Wine on Unix)")
92+
HandleRun("wine", {"lune", "build", "build/wax.luau"})
93+
end
94+
7695
print()
7796
Log.Info(`++++++++ Finished build target ++++++++`)

lune/run-tests.luau

+7-4
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ for _, TestName in fs.readDir("tests") do
4343
pcall(fs.removeFile, OutputScriptPathMin)
4444
end
4545

46-
local BundleResult = Run("lune", {"wax", "bundle", `input={RojoProjectFilePath}`, `output={OutputScriptPath}`, "minify=false", "ci-mode=true", "verbose=false"})
47-
local BundleResultMin = Run("lune", {"wax", "bundle", `input={RojoProjectFilePath}`, `output={OutputScriptPathMin}`, "minify=true", "ci-mode=true", "verbose=false"})
46+
local BundleResult = Run("lune", {"run", "wax", "bundle", `input={RojoProjectFilePath}`, `output={OutputScriptPath}`, "minify=false", "ci-mode=true", "verbose=false"})
47+
local BundleResultMin = Run("lune", {"run", "wax", "bundle", `input={RojoProjectFilePath}`, `output={OutputScriptPathMin}`, "minify=true", "ci-mode=true", "verbose=false"})
4848

4949
local BadResult = if not BundleResult.ok then BundleResult elseif not BundleResultMin.ok then BundleResultMin else nil
5050
if BadResult and not DoNotExitForErrors then
@@ -65,8 +65,11 @@ for _, ScriptPathObject in ScriptFilesToTest do
6565

6666
Log.Info(`Running script file "{StringUtils.FileNameFromPath(ScriptPath)}" for all targets..\n`)
6767

68-
local function RunWithCommand(binary: string)
69-
Run(binary, {ScriptPath}, false, function(message: string?)
68+
local function RunWithCommand(binary: string, args: {string}?)
69+
args = args or {}
70+
table.insert(args :: {any}, ScriptPath)
71+
72+
Run(binary, args, false, function(message: string?)
7073
if not DoNotExitForErrors then
7174
if message then
7275
Log.Error(message)

lune/wax-remote.luau

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
]]
55

66
-- You set the following string to "latest" (case insensitive), or any version tag
7-
-- on Wax's releases page (e.g. "0.3.7")
7+
-- on Wax's releases page (e.g. "0.4.0")
88
local WaxVersion = "latest"
99

1010
-------------------------------------------------------------------------------

lune/wax.luau

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ do
99
-- Minimum "recommended" ver
1010
local MajorRec,
1111
MinorRec,
12-
PatchRec = 0, 7, 11
12+
PatchRec = 0, 8, 0
1313

1414
local Major,
1515
Minor,
@@ -21,8 +21,8 @@ do
2121
print(`! Can't parse Lune's version on the assumed format from "{_VERSION}", continuing anyway..\n`)
2222
else
2323
_G.LuneVersion = `{Major}.{Minor}.{Patch}`
24-
if Major < MajorRec or Minor < MinorRec or Patch < PatchRec then
25-
print(`! Lune version "{_G.LuneVersion}" detected, Wax currently recommends Lune {MajorRec}.{MinorRec}.{PatchRec} or higher, continuing anyway..\n`)
24+
if Major < MajorRec or (Minor < MinorRec and Major <= MajorRec) or (Patch < PatchRec and Minor <= MinorRec and Major <= MajorRec) then
25+
print(`! Lune version "{_G.LuneVersion}" detected, but Wax currently recommends Lune {MajorRec}.{MinorRec}.{PatchRec} or higher, continuing anyway..\n`)
2626
end
2727
end
2828
end

0 commit comments

Comments
 (0)