import { cli , Command , flag } from '@deepkit/app' ; import { join } from 'path' ; import { readFileSync , unlinkSync } from 'fs' ; import { decodeFrameData , decodeFrames } from '@deepkit/framework-debug-api' ; import { frameworkConfig } from '../module.config' ; import { Logger } from '@deepkit/logger' ; class Config extends frameworkConfig . slice ( 'varPath' , 'debugStorePath' ) { } @ cli . controller ( 'debug:debug:frames' , { } ) export class DebugDebugFramesCommand implements Command { constructor ( protected config , protected logger ) { } async execute ( @ flag . optional reset = false ) { const path = join ( this . config . varPath , this . config . debugStorePath ) ; if ( reset ) { unlinkSync ( join ( path , 'frames.bin' ) ) ; unlinkSync ( join ( path , 'frames-data.bin' ) ) ; this . logger . log ( 'Files removed.' ) ; return ; } console . log ( 'frames' , decodeFrames ( readFileSync ( join ( path , 'frames.bin' ) ) ) ) ; console . log ( 'data' , decodeFrameData ( readFileSync ( join ( path , 'frames-data.bin' ) ) ) ) ; } }