All files / src/commands outdated.ts

83.33% Statements 10/12
42.86% Branches 3/7
100% Functions 2/2
81.82% Lines 9/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 301x 1x             1x 1x   1x 1x   1x   1x     1x                    
import { logger } from '@/utils'
import { Project } from '@/internal'
 
 
interface OutdatedOptions {
  cwd?: string
}
 
export default async(options: OutdatedOptions = {}) => {
  const cwd = options.cwd || process.cwd()
 
  const project = await Project.load(cwd)
  const repo = await project.getTemplateRepo()
 
  Iif (await repo.isVerioning()) {
    throw new Error('`mili outdated` cannot check the template without version control')
  } else Iif (await repo.isLatest()) {
    logger.info('Congratulations, the current template is the latest version.')
  } else {
    logger.warn([
      '',
      '',
      'Project Mili Template Is Outdated',
      'run `npx mili upgrade` to upgrade template',
      '',
      '',
    ].join('\n'))
  }
}