style: apply stylua formatter

This commit is contained in:
Erica Marigold 2024-12-02 16:57:31 +00:00
parent e019e5a8ed
commit 51994dfd13
Signed by: DevComp
GPG key ID: 429EF1C337871656
3 changed files with 109 additions and 97 deletions

View file

@ -24,8 +24,12 @@ return function(packageDirectory: string?): boolean
}).code
end,
["init.lua"] = stdio.write(serde.encode("json", { filePaths = { "init.lua" } }, false)),
["init.luau"] = stdio.write(serde.encode("json", { filePaths = { "init.luau" } }, false)),
["init.lua"] = stdio.write(
serde.encode("json", { filePaths = { "init.lua" } }, false)
),
["init.luau"] = stdio.write(
serde.encode("json", { filePaths = { "init.luau" } }, false)
),
}
-- We go through the action mappings in order of priority and check for the

View file

@ -16,7 +16,9 @@ export type TreeBase = {
export type TreeNormal = TreeBase & {
[string]: TreeNormal,
} & ({ ["$className"]: string } | { ["$path"]: string | { optional: string } })
} & ({ ["$className"]: string } | {
["$path"]: string | { optional: string },
})
export type TreeService = TreeBase & {
[string]: TreeNormal,
@ -54,9 +56,14 @@ local PLATFORM_SEP = if process.os == "windows" then "\\" else "/"
--- ## Errors
--- * The current process lacks permissions to a file
--- * Any I/O error occurs
return function(packageDirectory: string?, files: { string }, writeToFile: boolean?): (boolean, string?)
return function(
packageDirectory: string?,
files: { string },
writeToFile: boolean?
): (boolean, string?)
packageDirectory = packageDirectory or process.cwd
local syncConfigPath = `{packageDirectory}{PLATFORM_SEP}default.project.json`
local syncConfigPath =
`{packageDirectory}{PLATFORM_SEP}default.project.json`
if fs.isFile(syncConfigPath) then
return true, nil
end
@ -95,7 +102,8 @@ return function(packageDirectory: string?, files: { string }, writeToFile: boole
-- Finally, we serialize the config to a JSON string and optionally write it
-- to the sync config path
local serializedConfig = serde.encode("json", { tree = syncConfigTree }, true)
local serializedConfig =
serde.encode("json", { tree = syncConfigTree }, true)
if writeToFile then
fs.writeFile(syncConfigPath, serializedConfig)
end