Skip to content

Commit 4cede18

Browse files
committed
add todo
1 parent 3e3709a commit 4cede18

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

lute/cli/commands/pkg/loom-core/src/packageresolution.luau

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,19 @@ local function createLockfile(resolved: ResolvedGraph): lockfile.Lockfile
7878
}
7979
end
8080

81-
local function resolve(directory: string): ResolvedGraph
82-
local manifestPath = getManifestPath(directory)
83-
if not fs.exists(manifestPath) then
84-
error(`Manifest file not found: {manifestPath}`)
81+
local function resolve(rootDirectory: string): ResolvedGraph
82+
local rootManifestPath = getManifestPath(rootDirectory)
83+
if not fs.exists(rootManifestPath) then
84+
error(`Manifest file not found: {rootManifestPath}`)
85+
end
86+
87+
local lockfilePath = getLockfilePath(rootDirectory)
88+
-- TODO: read lockfile and diff against manifest to determine which packages need to be updated, deleted, etc.
89+
-- local lockfile = lockfile.parseFile(lockfilePath)
90+
-- for now, just clear the installation directory if it exists
91+
local rootInstallPath = `{rootDirectory}/{getInstallPath("")}`
92+
if fs.exists(rootInstallPath) then
93+
fs.remove(rootInstallPath)
8594
end
8695

8796
local queue: { projectmanifest.DependencySpec } = {}
@@ -92,7 +101,7 @@ local function resolve(directory: string): ResolvedGraph
92101

93102
local nameIndex: { [string]: string } = {}
94103

95-
local rootManifest = projectmanifest.parseFile(manifestPath)
104+
local rootManifest = projectmanifest.parseFile(rootManifestPath)
96105
for _, spec in rootManifest.package.dependencies do
97106
table.insert(packages, getKey(spec))
98107
table.insert(queue, spec)
@@ -116,7 +125,7 @@ local function resolve(directory: string): ResolvedGraph
116125
graph[key] = {}
117126

118127
-- Download and install
119-
local installPath = getInstallPath(key)
128+
local installPath = `{rootDirectory}/{getInstallPath(key)}`
120129
if spec.sourceKind == "github" then
121130
github.installPackage(spec, installPath)
122131
else
@@ -145,7 +154,6 @@ local function resolve(directory: string): ResolvedGraph
145154
graph = graph,
146155
})
147156

148-
local lockfilePath = getLockfilePath(directory)
149157
local lf = createLockfile(resolved)
150158
fs.writeStringToFile(lockfilePath, `return {pp(lf)}\n`)
151159

0 commit comments

Comments
 (0)