diff --git a/.lune/BuildRelease.luau b/.lune/BuildRelease.luau index 2fa9fbe..df45fcc 100644 --- a/.lune/BuildRelease.luau +++ b/.lune/BuildRelease.luau @@ -15,6 +15,43 @@ local stdio = require("@lune/stdio") local PROJECT_NAME = "built-release.project.json" local SOURCEMAP_NAME = "built-sourcemap.json" +local EXTRA_STEPS: { + { + Enabled: boolean, + Name: string, + Function: (builtProject: FileInstance.FileInstance) -> boolean, + } +} = + { + { + Enabled = true; + Name = "Fix Promise import"; + Function = function(builtProject) + local promise = builtProject:FindFirstFile("Promise.luau") + if not promise then + return false + end + + local promiseFileSource = promise:Read() + if not promiseFileSource then + return false + end + + promise:Write( + ( + string.gsub( + promiseFileSource, + "local Packages = script.Parent.Parent", + "local Packages = script.Parent.Packages" + ) + ) + ) + + return true + end; + }; + } + type Cleanup = () -> () local function CreateBuildProject(): Cleanup @@ -55,6 +92,13 @@ local function CreateBuildProject(): Cleanup end end + for _, extraStep in EXTRA_STEPS do + if not extraStep.Enabled then + continue + end + extraStep.Function(builtProject) + end + if not fs.isFile(PROJECT_NAME) then local json = serde.encode("json", { globIgnorePaths = { diff --git a/.lune/Classes/FileInstance.luau b/.lune/Classes/FileInstance.luau index 70a7e34..99908ed 100644 --- a/.lune/Classes/FileInstance.luau +++ b/.lune/Classes/FileInstance.luau @@ -142,9 +142,10 @@ function Private:GetDescendants() end function FileInstance:FindFirstFile(name, recursive) + name = PathUtilities.Join(self.Name, name) if recursive then for _, descendant in self:GetDescendants() do - if descendant.Name == name then + if PathUtilities.OsPath(descendant.Name) == name then return descendant end end @@ -153,7 +154,7 @@ function FileInstance:FindFirstFile(name, recursive) end for _, child in self:GetChildren() do - if child.Name == name then + if PathUtilities.OsPath(child.Name) == name then return child end end @@ -161,9 +162,10 @@ function FileInstance:FindFirstFile(name, recursive) return nil end function FileInstance:FindFirstDirectory(name, recursive) + name = PathUtilities.Join(self.Name, name) if recursive then for _, descendant in self:GetDescendants() do - if descendant.IsDirectory and descendant.Name == name then + if descendant.IsDirectory and PathUtilities.OsPath(descendant.Name) == name then return descendant end end @@ -172,7 +174,7 @@ function FileInstance:FindFirstDirectory(name, recursive) end for _, child in self:GetChildren() do - if child.IsDirectory and child.Name == name then + if child.IsDirectory and PathUtilities.OsPath(child.Name) == name then return child end end diff --git a/default.project.json b/default.project.json index 890a038..e52c54a 100644 --- a/default.project.json +++ b/default.project.json @@ -1,5 +1,5 @@ { - "name": "Janitor", + "name": "janitor", "tree": { "$path": "src" }