/**
 * Skypager
 * @copyright Jonathan Soeder <jon@chicago.com>
 */
import _Portfolio from './portfolio'
import Project from './project'
import _Helper from './helper'
import _Cache from './cache'
import { join } from 'path'

export const Portfolio = _Portfolio
export const Helper = _Helper
export const Cache = _Cache

export class Skypager extends Portfolio {
  dirname = join(__dirname, '..')

  static get namespace() {
    return 'Skypager'
  }
}

const instance = new Skypager({
  Project,
  Helper
})

instance.getter('cwd', () => instance.current)

instance.lazy('current', instance.load.bind(instance, process.cwd(), {
  sync: false
}))

instance.lazy('projectModule', () => instance.load(join(__dirname, '..')))

export default instance

export const load = instance.load.bind(instance)
