scripts/lune/rojo/sourcemap_generator.luau

20 lines
837 B
Text
Raw Normal View History

2024-08-12 00:15:04 +01:00
local fs = require("@lune/fs")
2024-10-20 12:36:44 +01:00
local process = require("@lune/process")
local serde = require("@lune/serde")
2024-08-12 00:15:04 +01:00
local stdio = require("@lune/stdio")
2024-08-11 16:43:54 +01:00
local package_directory = process.args[1]
2024-08-12 00:15:04 +01:00
if fs.isFile(package_directory .. "/default.project.json") then
process.spawn("rojo", { "sourcemap", package_directory }, { cwd = process.cwd, stdio = "forward" })
elseif fs.isFile(package_directory .. "/init.luau") then
local sourcemap = { filePaths = { "init.luau" } }
stdio.write(serde.encode("json", sourcemap, false))
2024-11-14 06:47:12 +00:00
elseif fs.isFile(package_directory .. "/init.lua") then
local sourcemap = { filePaths = { "init.lua" } }
stdio.write(serde.encode("json", sourcemap, false))
2024-08-12 00:15:04 +01:00
else
-- use stderr to avoid this being parsed as the output of the sourcemap command
stdio.ewrite("no default.project.json found in " .. package_directory)
2024-08-12 00:15:04 +01:00
end