%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/node_modules/npm/lib/exec/
Upload File :
Create Path :
Current File : //usr/lib/node_modules/npm/lib/exec/get-workspace-location-msg.js

const chalk = require('chalk')
const readPackageJson = require('read-package-json-fast')

const nocolor = {
  dim: s => s,
  green: s => s,
}

const getLocationMsg = async ({ color, path }) => {
  const colorize = color ? chalk : nocolor
  const { _id } =
    await readPackageJson(`${path}/package.json`)
      .catch(() => ({}))

  const workspaceMsg = _id
    ? ` in workspace ${colorize.green(_id)}`
    : ` in a ${colorize.green('new')} workspace`
  const locationMsg = ` at location:\n${
    colorize.dim(path)
  }`

  return `${workspaceMsg}${locationMsg}`
}

module.exports = getLocationMsg

Zerion Mini Shell 1.0