mirror of
https://github.com/pesde-pkg/scripts.git
synced 2024-12-12 07:00:35 +00:00
style: apply stylua formatter
This commit is contained in:
parent
e019e5a8ed
commit
51994dfd13
3 changed files with 109 additions and 97 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue