PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/alt/alt-nodejs18/root/usr/lib/node_modules/npm/lib/utils/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/alt/alt-nodejs18/root/usr/lib/node_modules/npm/lib/utils/reify-finish.js

const reifyOutput = require('./reify-output.js')
const ini = require('ini')
const { writeFile } = require('fs/promises')
const { resolve } = require('path')

const reifyFinish = async (npm, arb) => {
  await saveBuiltinConfig(npm, arb)
  reifyOutput(npm, arb)
}

const saveBuiltinConfig = async (npm, arb) => {
  const { options: { global }, actualTree } = arb
  if (!global) {
    return
  }

  // if we are using a builtin config, and just installed npm as
  // a top-level global package, we have to preserve that config.
  const npmNode = actualTree.inventory.get('node_modules/npm')
  if (!npmNode) {
    return
  }

  const builtinConf = npm.config.data.get('builtin')
  if (builtinConf.loadError) {
    return
  }

  const content = ini.stringify(builtinConf.raw).trim() + '\n'
  await writeFile(resolve(npmNode.path, 'npmrc'), content)
}

module.exports = reifyFinish