mirror of
https://github.com/pesde-pkg/scripts.git
synced 2024-12-12 15:00:37 +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
|
}).code
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["init.lua"] = stdio.write(serde.encode("json", { filePaths = { "init.lua" } }, false)),
|
["init.lua"] = stdio.write(
|
||||||
["init.luau"] = stdio.write(serde.encode("json", { filePaths = { "init.luau" } }, false)),
|
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
|
-- 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 & {
|
export type TreeNormal = TreeBase & {
|
||||||
[string]: TreeNormal,
|
[string]: TreeNormal,
|
||||||
} & ({ ["$className"]: string } | { ["$path"]: string | { optional: string } })
|
} & ({ ["$className"]: string } | {
|
||||||
|
["$path"]: string | { optional: string },
|
||||||
|
})
|
||||||
|
|
||||||
export type TreeService = TreeBase & {
|
export type TreeService = TreeBase & {
|
||||||
[string]: TreeNormal,
|
[string]: TreeNormal,
|
||||||
|
@ -54,9 +56,14 @@ local PLATFORM_SEP = if process.os == "windows" then "\\" else "/"
|
||||||
--- ## Errors
|
--- ## Errors
|
||||||
--- * The current process lacks permissions to a file
|
--- * The current process lacks permissions to a file
|
||||||
--- * Any I/O error occurs
|
--- * 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
|
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
|
if fs.isFile(syncConfigPath) then
|
||||||
return true, nil
|
return true, nil
|
||||||
end
|
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
|
-- Finally, we serialize the config to a JSON string and optionally write it
|
||||||
-- to the sync config path
|
-- to the sync config path
|
||||||
local serializedConfig = serde.encode("json", { tree = syncConfigTree }, true)
|
local serializedConfig =
|
||||||
|
serde.encode("json", { tree = syncConfigTree }, true)
|
||||||
if writeToFile then
|
if writeToFile then
|
||||||
fs.writeFile(syncConfigPath, serializedConfig)
|
fs.writeFile(syncConfigPath, serializedConfig)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue