all files / lib/ status.js

100% Statements 12/12
100% Branches 6/6
100% Functions 1/1
100% Lines 12/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                    
const config = require('../common/config');
const utils = require('../common/utils');
const polyglotUtils = require('../common/polyglot');
 
module.exports = function() {
  const err = polyglotUtils.checkInitErrors();
  if (err) {
    return err;
  }
 
  return polyglotUtils.getLastUpdatedAt()
    .then((lastUpdatedAt) => {
      if (lastUpdatedAt === config.project.lastUpdatedAt) {
        return utils.log('Your translations are up to date!');
      }
      const localLast = config.project.lastUpdatedAt || 'Never';
      return utils.error(`Your translations are NOT up to date!
        Server: ${lastUpdatedAt}
        Local: ${localLast}`);
    }, utils.error);
};