File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,19 @@ export const GenerateCommand = {
2525 ]
2626 }
2727 }
28- const json = JSON . stringify ( specs , null , 2 )
28+ const raw = JSON . stringify ( specs , null , 2 )
29+
30+ // Format through prettier so output is byte-identical to committed file
31+ // regardless of whether ./script/format.ts runs afterward.
32+ const prettier = await import ( "prettier" )
33+ const babel = await import ( "prettier/plugins/babel" )
34+ const estree = await import ( "prettier/plugins/estree" )
35+ const format = prettier . format ?? prettier . default ?. format
36+ const json = await format ( raw , {
37+ parser : "json" ,
38+ plugins : [ babel . default ?? babel , estree . default ?? estree ] ,
39+ printWidth : 120 ,
40+ } )
2941
3042 // Wait for stdout to finish writing before process.exit() is called
3143 await new Promise < void > ( ( resolve , reject ) => {
You can’t perform that action at this time.
0 commit comments