Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lute/cli/.luaurc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"languageMode": "strict",
"aliases": {
"batteries": "../../batteries"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local cli = require("@batteries/cli")
local authStore = require("../authenticationstore")
local authStore = require("../authentication")

local function authenticate(...: string)
local args = cli.parser()
Expand Down
4 changes: 2 additions & 2 deletions lute/cli/commands/pkg/loom-core/src/commands/install.luau
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local lockfile = require("../lockfile")
local packageresolution = require("../packageresolution")
local resolution = require("../resolution")
local path = require("@std/path")
local process = require("@std/process")

Expand All @@ -24,7 +24,7 @@ end

local function install()
local rootDirectory = path.format(process.cwd())
local lock = packageresolution.resolve(rootDirectory)
local lock = resolution.resolve(rootDirectory)
printDiagnostics(lock)
end

Expand Down
9 changes: 4 additions & 5 deletions lute/cli/commands/pkg/loom-core/src/github.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local authenticationStore = require("./authenticationstore")
local authenticationStore = require("./authentication")
local fs = require("@std/fs")
local net = require("@std/net")
local path = require("@std/path")
Expand Down Expand Up @@ -101,14 +101,13 @@ local function installPackage(source: string, rev: string, installPath: string):
fs.removeDirectory(tempDir, { recursive = true })
end

local ok, err = pcall(installZipArchive, zipArchive, tempDir)

if not ok then
xpcall(installZipArchive, function(err)
if fs.exists(tempDir) then
fs.removeDirectory(tempDir, { recursive = true })
end

error(err, 0)
end
end, zipArchive, tempDir)

fs.move(tempDir, installPath)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local github = require("./github")
local lockfile = require("./lockfile")
local path = require("@std/path")
local pp = require("@batteries/pp")
local projectmanifest = require("./projectmanifest")
local manifest = require("./manifest")
local store = require("./store")

local function getManifestPath(directory: string): string
Expand All @@ -14,22 +14,22 @@ local function getLockfilePath(directory: string): string
return `{directory}/loom.lock.luau`
end

local function getKey(spec: projectmanifest.DependencySpec): string
local function getKey(spec: manifest.DependencySpec): string
if spec.rev ~= nil then
return `{spec.name}@{spec.rev}`
end
return spec.name
end

local function hasConflict(specA: projectmanifest.DependencySpec, specB: projectmanifest.DependencySpec): boolean
local function hasConflict(specA: manifest.DependencySpec, specB: manifest.DependencySpec): boolean
return specA.rev ~= specB.rev or specA.source ~= specB.source or specA.sourceKind ~= specB.sourceKind
end

local function normalizePathDependency(
spec: projectmanifest.DependencySpec,
spec: manifest.DependencySpec,
installPath: string,
rootDirectory: string
): projectmanifest.DependencySpec
): manifest.DependencySpec
if spec.sourceKind == "path" then
local sourcePath = path.format(path.resolve(installPath, spec.source))
if not fs.exists(sourcePath) then
Expand All @@ -45,7 +45,7 @@ local function normalizePathDependency(
return spec
end

local function fetchSource(spec: projectmanifest.DependencySpec, rootDirectory: string): string
local function fetchSource(spec: manifest.DependencySpec, rootDirectory: string): string
if spec.sourceKind == "path" then
local sourcePath = path.format(path.resolve(rootDirectory, spec.source))
if not fs.exists(sourcePath) then
Expand Down Expand Up @@ -76,12 +76,12 @@ local function resolve(rootDirectory: string): lockfile.Lockfile

local lockfilePath = getLockfilePath(rootDirectory)

local queue: { projectmanifest.DependencySpec } = {}
local queue: { manifest.DependencySpec } = {}

local dependencies: { [string]: string } = {}
local packages: { [string]: lockfile.LockfileDependency } = {}

local rootManifest = projectmanifest.parseFile(rootManifestPath)
local rootManifest = manifest.parseFile(rootManifestPath)
for depAlias, depSpec in rootManifest.package.dependencies do
dependencies[depAlias] = getKey(depSpec)
table.insert(queue, depSpec)
Expand Down Expand Up @@ -128,7 +128,7 @@ local function resolve(rootDirectory: string): lockfile.Lockfile
-- Check for transitive dependencies
local nestedManifestPath = getManifestPath(installPath)
if fs.exists(nestedManifestPath) then
local depManifest = projectmanifest.parseFile(nestedManifestPath)
local depManifest = manifest.parseFile(nestedManifestPath)
for depAlias, depSpec in depManifest.package.dependencies do
-- Normalize transitive path dep sources to be rootDirectory-relative
local normalizedSpec = normalizePathDependency(depSpec, installPath, rootDirectory)
Expand Down
Loading