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")
|
2024-11-12 14:32:12 +00:00
|
|
|
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
|
|
|
|
2024-08-12 10:53:28 +01:00
|
|
|
local package_directory = process.args[1]
|
2024-08-12 00:15:04 +01:00
|
|
|
|
2024-08-12 10:53:28 +01:00
|
|
|
if fs.isFile(package_directory .. "/default.project.json") then
|
|
|
|
process.spawn("rojo", { "sourcemap", package_directory }, { cwd = process.cwd, stdio = "forward" })
|
2024-11-12 14:32:12 +00:00
|
|
|
elseif fs.isFile(package_directory .. "/init.luau") then
|
|
|
|
local sourcemap = { filePaths = { "init.luau" } }
|
|
|
|
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
|
2024-08-12 10:53:28 +01:00
|
|
|
stdio.ewrite("no default.project.json found in " .. package_directory)
|
2024-08-12 00:15:04 +01:00
|
|
|
end
|