LOCKS (A-56): the locks check counts the mesh's own @novox/mesh-* packages as it counts the SDK
A module naming only the mesh's packages beyond typescript and the types needs no lock (gitea names the contracts' git and mesh-catalog packages); a row in the first test fails without the change, as does the catalogue's own run. Builds: design 47 G A-56, ADR 0469 §5 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
// go run . <catalogue root>
|
||||
//
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user