Better naming
This commit is contained in:
parent
99645e3993
commit
1429889f6f
14
ci.ts
14
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()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user