[{"data":1,"prerenderedAt":306,"buildId":307},["ShallowReactive",2],{"page:\u002Fblog\u002Fkubb-lock":3},{"id":4,"title":5,"body":6,"description":289,"extension":290,"frontmatter":291,"heading":295,"meta":296,"navigation":297,"order":295,"path":298,"seo":299,"sitemap":300,"source":303,"stem":304,"__hash__":305},"site\u002Fblog\u002Fkubb-lock.md","How kubb-lock.json works",{"type":7,"value":8,"toc":279},"minimark",[9,16,20,36,41,59,63,74,218,222,233,242,246,252,259,263],[10,11,12],"p",{},[13,14],"img",{"src":15,"alt":5},"\u002Fblog\u002Fkubb-lock\u002Fcover.svg",[17,18,5],"h1",{"id":19},"how-kubb-lockjson-works",[10,21,22,23,27,28,31,32,35],{},"Kubb 5.27 writes ",[24,25,26],"code",{},"kubb-lock.json"," to your project root. Commit it with your generated code. With it, ",[24,29,30],{},"kubb generate"," skips the build when nothing changed, and ",[24,33,34],{},"kubb generate --check"," verifies formatted output without running your formatter.",[37,38,40],"h2",{"id":39},"why-it-exists","Why it exists",[10,42,43,46,47,50,51,54,55,58],{},[24,44,45],{},"output.format",", ",[24,48,49],{},"output.lint",", and ",[24,52,53],{},"output.postGenerate"," rewrite the files Kubb generates, so the generated text rarely matches the file on disk. Before 5.27, ",[24,56,57],{},"--check"," ran the formatter and linter again in a temporary folder to compare them. That was slow, and it broke when an ignore rule skipped that folder.",[37,60,62],{"id":61},"what-it-holds","What it holds",[10,64,65,66,69,70,73],{},"Only hashes. Each generated file gets two: ",[24,67,68],{},"source"," for the code Kubb generated, and ",[24,71,72],{},"output"," for the file after formatting. Each config also gets one hash of everything the build read.",[75,76,80],"pre",{"language":77,"filename":26,"code":78,"class":79},"json","{\n \"lockfileVersion\": 1,\n \"inputs\": {\n \"src\u002Fgen\": { \"hash\": \"0c3bf1dc…\", \"sources\": [\"openapi.yaml\"] }\n },\n \"files\": {\n \"src\u002Fgen\u002Ftypes\u002FPet.ts\": { \"source\": \"647596c2…\", \"output\": \"002220b7…\" }\n }\n}","highlights",[24,81,83,92,93,92,111,92,122,92,160,92,167,92,178,92,210,92,214],{"class":82},"language-json",[84,85,88],"span",{"class":86,"style":87},"line","display: inline",[84,89,91],{"style":90},"color:#005cc5;--hls-dark:#79b8ff","{","\n",[84,94,95,98,101,105,108],{"class":86,"style":87},[84,96,97],{"style":90}," ",[84,99,100],{"style":90},"\"lockfileVersion\"",[84,102,104],{"style":103},"color:#d73a49;--hls-dark:#f97583",": ",[84,106,107],{"style":90},"1",[84,109,110],{"style":103},",",[84,112,113,115,118,120],{"class":86,"style":87},[84,114,97],{"style":103},[84,116,117],{"style":90},"\"inputs\"",[84,119,104],{"style":103},[84,121,91],{"style":90},[84,123,124,127,130,132,135,138,140,144,146,149,151,154,157],{"class":86,"style":87},[84,125,126],{"style":90}," ",[84,128,129],{"style":90},"\"src\u002Fgen\"",[84,131,104],{"style":103},[84,133,134],{"style":90},"{ ",[84,136,137],{"style":90},"\"hash\"",[84,139,104],{"style":103},[84,141,143],{"style":142},"color:#032f62;--hls-dark:#9ecbff","\"0c3bf1dc…\"",[84,145,46],{"style":103},[84,147,148],{"style":90},"\"sources\"",[84,150,104],{"style":103},[84,152,153],{"style":90},"[",[84,155,156],{"style":142},"\"openapi.yaml\"",[84,158,159],{"style":90},"] }",[84,161,162,165],{"class":86,"style":87},[84,163,164],{"style":90}," }",[84,166,110],{"style":103},[84,168,169,171,174,176],{"class":86,"style":87},[84,170,97],{"style":103},[84,172,173],{"style":90},"\"files\"",[84,175,104],{"style":103},[84,177,91],{"style":90},[84,179,180,182,185,187,189,192,194,197,199,202,204,207],{"class":86,"style":87},[84,181,126],{"style":90},[84,183,184],{"style":90},"\"src\u002Fgen\u002Ftypes\u002FPet.ts\"",[84,186,104],{"style":103},[84,188,134],{"style":90},[84,190,191],{"style":90},"\"source\"",[84,193,104],{"style":103},[84,195,196],{"style":142},"\"647596c2…\"",[84,198,46],{"style":103},[84,200,201],{"style":90},"\"output\"",[84,203,104],{"style":103},[84,205,206],{"style":142},"\"002220b7…\" ",[84,208,209],{"style":90},"}",[84,211,212],{"class":86,"style":87},[84,213,164],{"style":90},[84,215,216],{"class":86,"style":87},[84,217,209],{"style":90},[37,219,221],{"id":220},"faster-checks-and-skipped-builds","Faster checks and skipped builds",[10,223,224,226,227,229,230,232],{},[24,225,57],{}," generates in memory. When a file's ",[24,228,68],{}," hash matches the new code and its ",[24,231,72],{}," hash matches the disk, the formatter already did its work, so Kubb skips it. A fresh CI checkout gets the answer without running a formatter.",[10,234,235,237,238,241],{},[24,236,30],{}," prints \"Up to date\" and exits when the config, the spec, the installed package versions, and the generated files all match. Pass ",[24,239,240],{},"--force"," to build anyway, for example after you change your formatter config, which Kubb does not track.",[37,243,245],{"id":244},"merge-conflicts","Merge conflicts",[10,247,248,249,251],{},"Don't merge the lockfile by hand. Run ",[24,250,30],{},", then commit the result. Kubb treats a lockfile it cannot parse as missing, so one full run rewrites it.",[10,253,254,255,258],{},"To turn the lockfile off, pass ",[24,256,257],{},"--no-lockfile",".",[37,260,262],{"id":261},"try-it","Try it",[10,264,265,266,273,274,278],{},"Update to Kubb 5.27. The ",[267,268,270,272],"a",{"href":269},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fgenerate#kubb-lock",[24,271,30],{}," reference"," has every rule, and ",[267,275,277],{"href":276},"\u002Fdocs\u002F5.x\u002Fhow-to\u002Frecipes#check-generated-code-in-ci","Check generated code in CI"," has example workflows.",{"title":280,"searchDepth":281,"depth":281,"links":282},"",5,[283,285,286,287,288],{"id":39,"depth":284,"text":40},2,{"id":61,"depth":284,"text":62},{"id":220,"depth":284,"text":221},{"id":244,"depth":284,"text":245},{"id":261,"depth":284,"text":262},"Kubb 5.27 writes kubb-lock.json next to your config. It lets kubb generate skip a build when nothing changed, and lets --check verify formatted output without running the formatter.","md",{"layout":292,"title":5,"description":289,"outline":293,"image":15,"date":294},"doc","deep","2026-11-26",null,{"layout":292,"outline":293,"image":15,"date":294},true,"\u002Fblog\u002Fkubb-lock",{"title":5,"description":289},{"loc":298,"images":301,"lastmod":294},[302],{"loc":15},"platform\u002Fapps\u002Fkubb.dev\u002Fcontent\u002Fblog\u002Fkubb-lock.md","blog\u002Fkubb-lock","SP8fJO-_0dtwtJBPdLvW4Mm1d4Apm3au8X7lY_W-_ko",1795727671030,"1b64b1eb-29b7-4f90-ad41-6f24721e1669"]