import { FileSystemAdapter } from "@codotype/core" ; /**
 * InMemoryFileSystemAdapter
 * FileSystemAdapter for writing to the local file system
 */ export class InMemoryFileSystemAdapter implements FileSystemAdapter { files : { [ key ] : string ; } ; constructor ( ) { this . files = { } ; } ensureDir ( dir ) { return Promise . resolve ( true ) ; } readFile ( filepath ) { if ( this . files [ filepath ] !== undefined ) { return Promise . resolve ( this . files [ filepath ] ) ; } return Promise . resolve ( null ) ; } fileExists ( filepath ) { return Promise . resolve ( this . files [ filepath ] !== undefined ) ; } writeFile ( dest , compiledTemplate ) { this . files [ dest ] = compiledTemplate ; return Promise . resolve ( true ) ; } }