0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

refactor: restructure Utils import (#1041)

This commit is contained in:
Varij Kapil 2018-10-03 21:44:59 +02:00 committed by Juan Picado @jotadeveloper
parent 385a791237
commit d17c31d725
3 changed files with 6 additions and 6 deletions

View file

@ -9,7 +9,7 @@ import VError from 'verror';
import chalk from 'chalk';
import express from 'express';
import * as Utils from '../../lib/utils';
import { combineBaseUrl, getWebProtocol } from '../../lib/utils';
import Search from '../../lib/search';
import { HEADERS, HTTP_STATUS, WEB_TITLE } from '../../lib/constants';
@ -60,7 +60,7 @@ module.exports = function(config, auth, storage) {
});
router.get('/', function(req, res) {
const base = Utils.combineBaseUrl(Utils.getWebProtocol(req.get(HEADERS.FORWARDED_PROTO), req.protocol), req.get('host'), config.url_prefix);
const base = combineBaseUrl(getWebProtocol(req.get(HEADERS.FORWARDED_PROTO), req.protocol), req.get('host'), config.url_prefix);
let webPage = template
.replace(/ToReplaceByVerdaccio/g, base)

View file

@ -12,6 +12,7 @@ import chalk from 'chalk';
import {startVerdaccio, listenDefaultCallback} from './bootstrap';
import findConfigFile from './config-path';
import {verdaccioUpdateBanner} from './update-banner';
import { parseConfigFile } from './utils';
if (process.getuid && process.getuid() === 0) {
global.console.warn(chalk.bgYellow('Verdaccio doesn\'t need superuser privileges. Don\'t run it under root.'));
@ -30,7 +31,6 @@ const logger = require('./logger');
logger.setup(); // default setup
const commander = require('commander');
const Utils = require('./utils');
const pkginfo = require('pkginfo')(module); // eslint-disable-line no-unused-vars
const pkgVersion = module.exports.version;
const pkgName = module.exports.name;
@ -60,7 +60,7 @@ const cliListener = commander.listen;
try {
configPathLocation = findConfigFile(commander.config);
verdaccioConfiguration = Utils.parseConfigFile(configPathLocation);
verdaccioConfiguration = parseConfigFile(configPathLocation);
process.title = verdaccioConfiguration.web && verdaccioConfiguration.web.title || 'verdaccio';
if (!verdaccioConfiguration.self_path) {

View file

@ -1,13 +1,13 @@
/**
* @prettier
*/
import { isObject } from './utils';
const cluster = require('cluster');
const Logger = require('bunyan');
const Error = require('http-errors');
const Stream = require('stream');
const chalk = require('chalk');
const Utils = require('./utils');
const pkgJSON = require('../../package.json');
const _ = require('lodash');
const { format } = require('date-fns');
@ -195,7 +195,7 @@ function fillInMsgTemplate(msg, obj, colors) {
let _ref = name.split('.');
for (let _i = 0; _i < _ref.length; _i++) {
let id = _ref[_i];
if (Utils.isObject(str) || Array.isArray(str)) {
if (isObject(str) || Array.isArray(str)) {
str = str[id];
} else {
str = undefined;