"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

function _react() {
  const data = _interopRequireDefault(require("react"));

  _react = function _react() {
    return data;
  };

  return data;
}

function _path() {
  const data = require("path");

  _path = function _path() {
    return data;
  };

  return data;
}

function _fs() {
  const data = require("fs");

  _fs = function _fs() {
    return data;
  };

  return data;
}

function _chalk() {
  const data = _interopRequireDefault(require("chalk"));

  _chalk = function _chalk() {
    return data;
  };

  return data;
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = api => {
  api.registerCommand('version', {
    description: 'show related versions'
  }, args => {
    // eslint-disable-next-line import/no-dynamic-require
    const pkg = require((0, _path().join)(process.env.UMI_DIR, 'package.json'));

    if (args.verbose) {
      const versions = api.applyPlugins('addVersionInfo', {
        initialValue: [`umi@${pkg.version}`, `${process.platform} ${process.arch}`, `node@${process.version}`, `umi-build-dev@${require('../../../package').version}`, `af-webpack@${require('af-webpack/package').version}`, `babel-preset-umi@${require('babel-preset-umi/package').version}`, `umi-test@${require('umi-test/package').version}`]
      });
      versions.forEach(version => {
        console.log(version);
      });
    } else {
      console.log(pkg.version);
    }

    if ((0, _fs().existsSync)((0, _path().join)(process.env.UMI_DIR, '.local'))) {
      console.log(_chalk().default.cyan('@local'));
    }
  });
};

exports.default = _default;