   cachePath: ->
     path.resolve @baseDir, './.noflo.json'
 
-  writeCache: ->
+  writeCache: (callback) ->
     cacheData =
       components: {}
       loaders: @componentLoaders or []

      @ready = true
      @processing = false
      @emit 'ready', true
      callback @components if callback
      @writeCache() if @options.cache

    @getCoreComponents (coreComponents) =>
      @components[name] = cPath for name, cPath of coreComponents

    filePath = @cachePath()
    fs.writeFile filePath, JSON.stringify(cacheData, null, 2),
      encoding: 'utf-8'
    , callback

  readCache: (callback) ->
    filePath = @cachePath()
