Skip to content

Commit 0c021cc

Browse files
authored
Preserve case-sensitive local Wally dependency paths (#92)
Recognize caret-prefixed Wally dependencies as case-sensitive local filesystem paths rather than registry references. Registry package names and references still require lowercase, and dependency values must remain strings in shared, server, and development sections. The checker does not rewrite manifests or require paths to exist. Regression tests cover preserved mixed-case paths, uppercase registry rejection alongside local dependencies, and dependency type validation. The complete suite passes all 419 tests, with formatting, static analysis, and `git diff --check` also passing.
1 parent 47c3e12 commit 0c021cc

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

‎Scripts/CheckWallyFormat.exec.luau‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
CheckWallyFormat.exec
66
77
Validates that wally.toml follows the project format guidelines. Specifically checks that
8-
all repository strings (package name and dependency values) are lowercase.
8+
registry package names and dependency references are lowercase, preserving local paths.
99
1010
[Usage] ./Scripts/CheckWallyFormat.exec.luau [filename]
1111
> filename → Optional path to the file to check. Defaults to "wally.toml".
@@ -62,7 +62,11 @@ function CheckWallyFormat.exec()
6262
end
6363
table.sort(keys)
6464
for _, key in keys do
65-
checkLowercase(dependencies[key], `Dependency "{key}"`)
65+
const value = dependencies[key]
66+
assert(type(value) == "string", `Expected Dependency "{key}" to be a string in "{filename}".`)
67+
if string.sub(value, 1, 1) ~= "^" then
68+
checkLowercase(value, `Dependency "{key}"`)
69+
end
6670
end
6771
end
6872
end

‎Tests/CheckWallyFormatTest.spec.luau‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,39 @@ return function()
177177
end
178178
end)
179179

180+
it("should preserve mixed-case local paths in every dependency table", function()
181+
for _, section in { "dependencies", "dev-dependencies", "server-dependencies" } do
182+
env.WriteFile(
183+
"test-wally.toml",
184+
`[{section}]\nFusion = "^Source/ForkedPackages/fusion"\nRegistry = "owner/package@1.0.0"\n`
185+
)
186+
187+
const result = env.RunScript("CheckWallyFormat", { "test-wally.toml" })
188+
189+
expect(result.ok).to.equal(true)
190+
expect(string.find(result.stdout, '"test-wally.toml" format is valid.', 1, true)).to.be.ok()
191+
expect(env.ReadFile("test-wally.toml")).to.equal(
192+
`[{section}]\nFusion = "^Source/ForkedPackages/fusion"\nRegistry = "owner/package@1.0.0"\n`
193+
)
194+
end
195+
end)
196+
197+
it("should reject uppercase registry references alongside local paths in every dependency table", function()
198+
for _, section in { "dependencies", "dev-dependencies", "server-dependencies" } do
199+
env.WriteFile(
200+
"test-wally.toml",
201+
`[{section}]\nFusion = "^Source/ForkedPackages/fusion"\nRegistry = "Owner/Package@1.0.0"\n`
202+
)
203+
204+
const result = env.RunScript("CheckWallyFormat", { "test-wally.toml" })
205+
206+
expect(result.ok).to.equal(false)
207+
expect(string.find(result.stdout, "1 format error", 1, true)).to.be.ok()
208+
expect(string.find(result.stdout, 'Dependency "Registry"', 1, true)).to.be.ok()
209+
expect(string.find(result.stdout, 'Dependency "Fusion"', 1, true)).to.equal(nil)
210+
end
211+
end)
212+
180213
it("should ignore commented assignments and unrelated sections", function()
181214
env.WriteFile(
182215
"test-wally.toml",
@@ -193,6 +226,10 @@ return function()
193226
{ Content = 'package = "invalid"\n', Message = 'Expected "package" to be a table' },
194227
{ Content = "[package]\nname = 123\n", Message = "Expected Package name to be a string" },
195228
{ Content = 'dependencies = "invalid"\n', Message = 'Expected "dependencies" to be a table' },
229+
{
230+
Content = "[dependencies]\nDependency = 123\n",
231+
Message = 'Expected Dependency "Dependency" to be a string',
232+
},
196233
{
197234
Content = "[dev-dependencies]\nDependency = false\n",
198235
Message = 'Expected Dependency "Dependency" to be a string',

0 commit comments

Comments
 (0)