2024-08-11 16:38:30 +01:00
|
|
|
local fs = require("@lune/fs")
|
2024-10-20 12:36:44 +01:00
|
|
|
local process = require("@lune/process")
|
2024-08-11 16:38:30 +01:00
|
|
|
local serde = require("@lune/serde")
|
|
|
|
|
2024-08-12 00:15:04 +01:00
|
|
|
local package_directory = process.args[1]
|
2024-08-11 16:38:30 +01:00
|
|
|
|
2024-08-12 10:53:28 +01:00
|
|
|
if fs.isFile(package_directory .. "/default.project.json") then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2024-08-11 16:38:30 +01:00
|
|
|
local output = {
|
|
|
|
tree = {},
|
|
|
|
}
|
|
|
|
|
2024-08-12 00:15:04 +01:00
|
|
|
for i, file in process.args do
|
|
|
|
if i == 1 then
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
|
2024-08-11 16:38:30 +01:00
|
|
|
local name = string.gsub(file, ".luau?$", "")
|
|
|
|
|
|
|
|
if name == "init" then
|
2024-10-20 12:36:44 +01:00
|
|
|
output.tree["$path"] = file
|
2024-08-11 16:38:30 +01:00
|
|
|
continue
|
|
|
|
end
|
|
|
|
|
|
|
|
output.tree[name] = {
|
|
|
|
["$path"] = file,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2024-10-20 12:36:44 +01:00
|
|
|
if not output.tree["$path"] then
|
|
|
|
output.tree["$className"] = "Folder"
|
|
|
|
end
|
|
|
|
|
|
|
|
if not output.tree["roblox_packages"] then
|
|
|
|
output.tree["roblox_packages"] = {
|
|
|
|
["$path"] = {
|
|
|
|
optional = "roblox_packages",
|
|
|
|
},
|
|
|
|
}
|
2024-08-11 16:38:30 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
fs.writeFile(package_directory .. "/default.project.json", serde.encode("json", output, true))
|