Skip to content

Commit

Permalink
Fix Lune script type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vocksel committed Sep 7, 2024
1 parent 40a5461 commit 71f5d8b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .lune/build.luau
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local watch = require("./lib/watcher/watch")
local args = parseArgs(process.args)

local target = if args.target then args.target else "prod"
assert(target == "dev" or target == "prod", `bad value for target (must be one of "dev" or "prod", got "{target}")`)

local function build()
run("rm", { "-rf", project.BUILD_PATH })
Expand Down
2 changes: 1 addition & 1 deletion .lune/lib/findClientSettings.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local run = require("./run")

local function findClientSettings(os: string)
local function findClientSettings(os: string): string?
if os == "macos" then
return "/Applications/RobloxStudio.app/Contents/MacOS/ClientSettings"
elseif os == "windows" then
Expand Down
13 changes: 6 additions & 7 deletions .lune/lib/parseArgs.luau
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
local FLAG_PATTERN = "%-%-(%w+)"
local FLAG_ALL_IN_ONE_PATTERN = `{FLAG_PATTERN}=(%w+)`

local function parseArgs(args: { string }): { [string]: string | boolean | number }
local parsedArgs: { [string]: string } = {}
local function parseArgs(args: { string })
local parsedArgs: { [string]: string | boolean | number } = {}

local skipNextToken = false

for index, token in args do
Expand All @@ -28,16 +29,14 @@ local function parseArgs(args: { string }): { [string]: string | boolean | numbe
if nextToken then
-- When processing `--foo` in `--foo --bar` treat it like a boolean
if nextToken:match(FLAG_PATTERN) then
flagValue = true
parsedArgs[flagName] = true
else
flagValue = nextToken
parsedArgs[flagName] = nextToken
skipNextToken = true
end
else
flagValue = true
parsedArgs[flagName] = true
end

parsedArgs[flagName] = flagValue
else
error(`something went wrong: {token}`)
end
Expand Down
6 changes: 4 additions & 2 deletions .lune/lib/setFlags.luau
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ local run = require("./run")

local function setFlags(os: string)
local clientSettings = findClientSettings(os)
run("mkdir", { "-p", clientSettings })
run("cp", { "-R", "tests/ClientAppSettings.json", clientSettings })
if clientSettings then
run("mkdir", { "-p", clientSettings })
run("cp", { "-R", "tests/ClientAppSettings.json", clientSettings })
end
end

return setFlags
2 changes: 1 addition & 1 deletion .lune/lib/watcher/watch.luau
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Options = {
}

local function watch(options: Options)
local prevWatchedFileMetadata: { [string]: string } = {}
local prevWatchedFileMetadata: { [string]: fs.Metadata } = {}
local watchedFiles = getWatchedFiles(options.filePatterns)
local prevWatchedFiles

Expand Down

0 comments on commit 71f5d8b

Please sign in to comment.