diff --git a/checks/locks/main.go b/checks/locks/main.go index e0b5c5829..fb9c6b651 100644 --- a/checks/locks/main.go +++ b/checks/locks/main.go @@ -5,7 +5,8 @@ // go run . // // Exits 1 on a finding. The packages that count are those the build module counts (mesh-build-node fetch.go -// ownDependencies): the `dependencies` beyond the SDK, typescript and the @types packages. +// ownDependencies): the `dependencies` beyond the mesh's own packages (@novox/mesh-*, the SDK among them), typescript and the +// @types packages. package main import ( @@ -17,6 +18,10 @@ import ( "strings" ) +// meshPackages is the prefix of every package the mesh itself publishes: the build module's toolchain and the mesh's registry +// give them, as they give the SDK, so a module naming only them needs no lock (design 47 G A-56). +const meshPackages = "@novox/mesh-" + // Finding is one module refused: it names Packages beyond the SDK and has no lock file. type Finding struct { Module string @@ -70,7 +75,7 @@ func Check(root string) ([]Finding, error) { } var names []string for n := range pkg.Dependencies { - if n != "@novox/mesh-sdk" && n != "typescript" && !strings.HasPrefix(n, "@types/") { + if !strings.HasPrefix(n, meshPackages) && n != "typescript" && !strings.HasPrefix(n, "@types/") { names = append(names, n) } } diff --git a/checks/locks/main_test.go b/checks/locks/main_test.go index 11aab626d..6ab888974 100644 --- a/checks/locks/main_test.go +++ b/checks/locks/main_test.go @@ -35,6 +35,8 @@ func TestAModuleNamingOnlyTheSDKNeedsNoLock(t *testing.T) { root := t.TempDir() module(t, root, "plain", "typescript", sdkOnly, false) module(t, root, "none", "typescript", "", false) + // The mesh's own packages count as the SDK does (design 47 G A-56): a contracts package needs no lock. + module(t, root, "contracts", "typescript", `{"dependencies":{"@novox/mesh-sdk":"^0.1.1","@novox/mesh-delivery-contracts-git":"^0.1.0"}}`, false) got, err := Check(root) if err != nil || len(got) != 0 { t.Fatalf("%v %v", got, err)