fix: Releases, port to new scripts
"+ Releases used the lib/ folder instead of a darklua processed dist/ folder, leading to them using unsupported string requires" -m "+ Port lune scripts to new, more awesome and strictly typed scripts" -m "+ Bump to and release v0.1.1"
This commit is contained in:
parent
655d47274e
commit
f30b3b677d
21 changed files with 2671 additions and 64 deletions
39
.lune/util/spawn.luau
Normal file
39
.lune/util/spawn.luau
Normal file
|
@ -0,0 +1,39 @@
|
|||
--!strict
|
||||
local process = require("@lune/process")
|
||||
local task = require("@lune/task")
|
||||
|
||||
--- Start a process with the given command and options
|
||||
--- ```luau
|
||||
--- spawn.start("lune run test")
|
||||
--- ```
|
||||
--- @param cmd string
|
||||
--- @param options process.SpawnOptions?
|
||||
--- @return process.SpawnResult
|
||||
local function start_process(cmd: string, options: process.SpawnOptions?): process.SpawnResult
|
||||
local arguments = string.split(cmd, " ")
|
||||
local command = arguments[1]
|
||||
table.remove(arguments, 1)
|
||||
|
||||
local opts: process.SpawnOptions = options ~= nil and options or {}
|
||||
opts.stdio = opts.stdio ~= nil and opts.stdio or "forward"
|
||||
|
||||
return process.spawn(command, arguments, opts)
|
||||
end
|
||||
|
||||
--- `task.spawn` a process with the given command and options
|
||||
--- ```luau
|
||||
--- spawn.spawn("lune run test") -- process now runs in the background!
|
||||
--- ```
|
||||
--- @param cmd string
|
||||
--- @param options process.SpawnOptions?
|
||||
--- @return process.SpawnResult
|
||||
local function spawn_process(cmd: string, options: process.SpawnOptions?)
|
||||
task.spawn(start_process, cmd, options)
|
||||
end
|
||||
|
||||
local spawn = {
|
||||
start = start_process,
|
||||
spawn = spawn_process,
|
||||
}
|
||||
|
||||
return spawn
|
Loading…
Add table
Add a link
Reference in a new issue