diff --git a/.luaurc b/.luaurc index 91767e4..35866cb 100644 --- a/.luaurc +++ b/.luaurc @@ -1,9 +1,9 @@ { "languageMode": "strict", "aliases": { - "std": "~/.lute/typedefs/0.1.0/std", - "lint": "~/.lute/typedefs/0.1.0/lint", - "lute": "~/.lute/typedefs/0.1.0/lute", + "std": "~/.lute/typedefs/1.0.0/std", + "lint": "~/.lute/typedefs/1.0.0/lint", + "lute": "~/.lute/typedefs/1.0.0/lute", "batteries": "./src/batteries" } } diff --git a/foreman-release.toml b/foreman-release.toml index 132e9de..e61c62f 100644 --- a/foreman-release.toml +++ b/foreman-release.toml @@ -1,2 +1,2 @@ [tools] -lute = { source = "luau-lang/lute", version = "=0.1.0-nightly.20260303" } +lute = { source = "luau-lang/lute", version = "=1.0.0" } diff --git a/foreman.toml b/foreman.toml index 00983fb..ad13034 100644 --- a/foreman.toml +++ b/foreman.toml @@ -1,4 +1,4 @@ [tools] -lute = { source = "luau-lang/lute", version = "=0.1.0-nightly.20260303" } +lute = { source = "luau-lang/lute", version = "=1.0.0" } stylua = { source = "JohnnyMorganz/StyLua", version = "2.0.1" } rojo = { source = "rojo-rbx/rojo", version = "7.3.0" } diff --git a/scripts/build.luau b/scripts/build.luau index 0994d4d..97052a5 100644 --- a/scripts/build.luau +++ b/scripts/build.luau @@ -11,7 +11,7 @@ log.setLevel("debug") local runProcess = require("../src/util/runProcess") if not fs.exists("build") then - fs.createdirectory("build") + fs.createDirectory("build") end local output_path = "build/rocale-cli" diff --git a/scripts/test.luau b/scripts/test.luau index bfc0602..2d3b2b2 100644 --- a/scripts/test.luau +++ b/scripts/test.luau @@ -24,7 +24,7 @@ runProcess({ "--verbose", }) -local testOutput = fs.readfiletostring("build/testOutput.txt") +local testOutput = fs.readFileToString("build/testOutput.txt") fs.remove("build/testOutput.txt") assert(testOutput == "hello world!", `Expected binary output to be "hello world!"`) diff --git a/src/commands/run.luau b/src/commands/run.luau index 9e27afd..815e7a9 100644 --- a/src/commands/run.luau +++ b/src/commands/run.luau @@ -185,7 +185,7 @@ return function(...) if enableBinaryOutput and completedTask.binaryOutputUri then local binaryOutput = ocaleSdk.getBinaryOutput(completedTask.binaryOutputUri) assert(binaryOutputPath, "Binary output path should be a valid file path") - fs.writestringtofile(binaryOutputPath, binaryOutput) + fs.writeStringToFile(binaryOutputPath, binaryOutput) log.info(`{richterm.green("✓", log.noColor())} Binary output saved to '{binaryOutputPath}'`) end diff --git a/src/core/ocaleSdk.luau b/src/core/ocaleSdk.luau index 16adc56..a15d5e9 100644 --- a/src/core/ocaleSdk.luau +++ b/src/core/ocaleSdk.luau @@ -1,4 +1,4 @@ -local net = require("@lute/net") +local client = require("@lute/net/client") local json = require("@std/json") local fs = require("@std/fs") local task = require("@lute/task") @@ -10,9 +10,9 @@ local OcaleSDK = {} export type BinaryInputResponse = { path: string, size: number, uploadUri: string } function OcaleSDK.createBinaryInput(apiKey: string, universeId: number, filePath: string): BinaryInputResponse - local fileSize = #fs.readfiletostring(filePath) + local fileSize = #fs.readFileToString(filePath) - local response = net.request( + local response = client.request( `https://apis.roblox.com/cloud/v2/universes/{universeId}/luau-execution-session-task-binary-inputs`, { method = "POST", @@ -25,10 +25,10 @@ function OcaleSDK.createBinaryInput(apiKey: string, universeId: number, filePath end function OcaleSDK.uploadBinaryFile(uploadUri: string, filePath: string) - local response = net.request(uploadUri, { + local response = client.request(uploadUri, { method = "PUT", headers = { ["content-type"] = "application/octet-stream" }, - body = fs.readfiletostring(filePath), + body = fs.readFileToString(filePath), }) log.fatalif(not response.ok, `{response.status} - {response.body}`) end @@ -44,14 +44,16 @@ function OcaleSDK.uploadPlaceFile(filePath: string, placeInfo: PlaceInfo, apiKey local url = `https://apis.roblox.com/universes/v1/{placeInfo.universeId}/places/{placeInfo.placeId}/versions?versionType=Saved` log.debug(`Request URL: {url}`) - local response = net.request(url, { + local isXml = string.match(filePath, "%.rbxlx$") ~= nil + local contentType = if isXml then "application/xml" else "application/octet-stream" + local response = client.request(url, { method = "POST", headers = { ["x-api-key"] = apiKey, - ["content-type"] = "application/xml", + ["content-type"] = contentType, ["Accept"] = "application/json", }, - body = fs.readfiletostring(filePath), + body = fs.readFileToString(filePath), }) log.fatalif(not response.ok, `{response.status} - {response.body}`) log.debug(`Response body: {log.pretty(response.body)}`) @@ -98,7 +100,7 @@ function OcaleSDK.createTask( ): TaskResponse log.info(`{richterm.blue("→", log.noColor())} Creating the OCALE task...`) local url = getCreateTaskPath(placeInfo) - local entryScript = fs.readfiletostring(scriptPath) + local entryScript = fs.readFileToString(scriptPath) -- inject globals at the top of the entry script if luaGlobals and next(luaGlobals) then @@ -112,7 +114,7 @@ function OcaleSDK.createTask( entryScript = assignGlobals .. entryScript end - local req: net.Metadata = { + local req: client.Metadata = { method = "POST", headers = { ["x-api-key"] = apiKey, ["content-type"] = "application/json" }, body = json.serialize({ @@ -124,7 +126,7 @@ function OcaleSDK.createTask( } log.debug(`Request URL: {url}`) - local response = net.request(url, req) + local response = client.request(url, req) log.fatalif(not response.ok, `{response.status} - {response.body}`) local taskResponse = json.deserialize(response.body) :: TaskResponse log.debug(`Task path: {taskResponse.path}`) @@ -164,7 +166,7 @@ function OcaleSDK.pollTaskCompletion( while timeRemaining > 0 do timeRemaining = timeRemaining - interval - local response = net.request(`https://apis.roblox.com/cloud/v2/{taskPath}`, { + local response = client.request(`https://apis.roblox.com/cloud/v2/{taskPath}`, { method = "GET", headers = { ["x-api-key"] = apiKey }, }) @@ -196,7 +198,7 @@ end function OcaleSDK.getBinaryOutput(binaryOutputUri: string): string log.debug(`Binary output URI: {binaryOutputUri}`) - local response = net.request(binaryOutputUri, { + local response = client.request(binaryOutputUri, { method = "GET", }) log.fatalif(not response.ok, `{response.status} - {response.body}`) @@ -204,7 +206,7 @@ function OcaleSDK.getBinaryOutput(binaryOutputUri: string): string end function OcaleSDK.getTaskLogs(apiKey: string, taskPath: string): { string } - local response = net.request(`https://apis.roblox.com/cloud/v2/{taskPath}/logs`, { + local response = client.request(`https://apis.roblox.com/cloud/v2/{taskPath}/logs`, { method = "GET", headers = { ["x-api-key"] = apiKey }, })