Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/doodle-node-cli / src / prompts / i18n-prompt.js
Size: Mime:
const inquirer = require('inquirer');
const chalk = require('chalk');
const pkgDir = require('pkg-dir');
const { getAlli18nDataFromPath, discoverProblemsWithKeys, getPrettyPrintSummary } = require('../utils/i18n-checker');

async function i18nPrompt(options) {
  const rootDir = await pkgDir();

  await inquirer
    .prompt([
      {
        type: 'input',
        name: 'dirPath',
        message: 'What is the absolute path to the /i18n/onesky directory?',
        default: options.dirPath || `${rootDir || ''}/i18n/onesky`,
        when: !options.dirPath,
      },
      {
        type: 'list',
        name: 'verbose',
        message: 'Print a minimal or verbose summary?',
        choices: ['minimal', 'verbose'],
        default: options.verbose || 'verbose',
        when: !options.verbose,
      },
    ])
    .then(async answers => {
      const { dirPath, verbose } = {
        ...answers,
        ...options,
      };

      console.log(`Searching for onesky files: ${chalk.gray(dirPath)}`);

      const allI18nData = await getAlli18nDataFromPath(dirPath);
      Object.keys(allI18nData).forEach(folder => {
        console.log(
          getPrettyPrintSummary(discoverProblemsWithKeys(allI18nData[folder], 'en', folder), verbose === 'verbose')
        );
      });
    });
}

module.exports = i18nPrompt;