From 1429889f6fed636c527dad0586f3e0c96d372969 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 22 Jul 2025 16:29:30 -0700 Subject: [PATCH] Better naming --- ci.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ci.ts b/ci.ts index af50f0f..62b81fa 100644 --- a/ci.ts +++ b/ci.ts @@ -7,20 +7,26 @@ test("verify all package.json", async () => { const packageInfo = await getPackageInfo() const mainPackageFile = await Bun.file("package.json") const mainPackageJson = await mainPackageFile.json() - const catalog = mainPackageJson.workshop?.catalog ?? {} + const catalog = mainPackageJson.workspaces?.catalog ?? {} for (const { json, path } of packageInfo) { const dirname = basename(path) ensure(json, `package.json in ${dirname} must exist`) + // Packages must be named after the dir they are in OR the name of the dir prefixed with @workshop/ const unscopedName = json.name.replace("@workshop/", "") expect(unscopedName, `Name in package.json must match the dir name`).toBe(dirname) + // Make sure all packages use the catalog version of deps const dependencies = { ...json.dependencies, ...json.devDependencies } Object.entries(dependencies).forEach(([dep, version]) => { - if (catalog[dep]) { - expect(version, `Dependency "${dep}" in "${json.name}" must be "catalog:"`).toBe("catalog:") // The dep is in the catalog because having multiple versions causes hard to diagnose bugs - } + if (!catalog[dep]) return + expect(version, `Dependency "${dep}" in "${json.name}" must be "catalog:"`).toBe("catalog:") // The dep is in the catalog because having multiple versions causes hard to diagnose bugs }) + + // If you define a subdomain:start you must also define subdomain:dev + if (json.scripts?.["subdomain:start"]) { + expect(json.scripts?.["subdomain:dev"], `subdomain:dev not defined in ${json.name}`).toBeDefined() + } } })