#! /usr/bin/env node

'use strict'

const sh = require('shelljs');
const rimraf = require('rimraf');
const ncp = require('ncp').ncp;
const chalk = require('chalk');

const downloadDir = './tmp/';
const outputDir = './i18n/';
const repoUrl = 'https://github.com/Enplug/localization';

rimraf.sync(downloadDir);
console.log('dir: ', process.cwd());
const repoFetchCommand = `git clone ${repoUrl} ${downloadDir}`;
sh.exec(repoFetchCommand);
ncp(`${downloadDir}/components`, `${outputDir}`, function (err) {
  if (err) {
    return console.error(`${chalk.default.red(err)}`);
  }
  console.log(`${chalk.default.green('Translations fetched!')}`);
 });

//rimraf.sync(downloadDir);

