@wll8/sync-package

1.0.0 • Public • Published

Dynamically install dependencies

use

const { initPackge } = require(`sync-package`)

new Promise(async () => {
  const pkg = await initPackge(`lodash`, {
    mainPath: __dirname,
  })
  console.log(`pkg`, pkg.set)
})

parameter

/**
 * @param {string} pkg The dependencies to be installed. It is actually the same as the parameter after npm i
 * @param {object} param1 configuration
 * @param {boolean} param1.getRequire Whether to require after the installation is complete
 * @param {boolean} param1.requireName The name used when require. The default is automatic resolution. When using url to install, the program does not know the real name, and it needs to be specified at this time
 * @param {object} param1.env Environment variables during installation
 * @param {string} param1.mainPath what directory to install
 */
initPackge(pkg, param1)

License

MIT

Copyright (c) 2017-present, xw

Readme

Keywords

none

Package Sidebar

Install

npm i @wll8/sync-package

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

9.07 kB

Total Files

9

Last publish

Collaborators

  • wll8