login/node_modules/package-lock/src/index.js
Amruta Kawade 45b10ffd19
Adding node_modules for dependabot (#67)
* Bump lodash from 4.17.15 to 4.17.19 (#52)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com>

* Bump @actions/core from 1.1.3 to 1.2.6 (#60)

Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.1.3 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com>

* updating node_nodules

* updated package-lock

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-12 14:58:40 +05:30

50 lines
1.3 KiB
JavaScript

const { compose } = require('asyncc')
const {
findPackages,
buildTree,
writeJsonSync,
readPackageJsonSync
} = require('./utils')
const {
genPackageLock,
genPackageJson
} = require('./generate')
/**
* @param {object} options
* @param {string} [options.resolve] - url to replace for all resolved package uris
* @param {boolean} [options.lock=true] - write new `package-lock.json` file
* @param {boolean} [options.package=false] - if `true` force appending `optionalDependencies` in `package.json`
* @param {function} cb - `(err, tree) => {}`
*/
function proc (options, cb) {
options = Object.assign({
lock: true,
package: false
}, options)
const dirname = options.dirname || process.cwd()
compose(
(nul, cb) => findPackages(dirname, cb),
(pckgfiles, cb) => buildTree(pckgfiles, dirname, cb)
)(null, (err, tree) => {
if (err) {
cb(err)
return
}
const pckg = readPackageJsonSync(dirname)
const newLock = genPackageLock(tree, pckg, options)
const newPckg = genPackageJson(tree, pckg)
if (options.lock) {
const file = options.shrink ? 'npm-shrinkwrap.json' : 'package-lock.json'
writeJsonSync(file, newLock)
}
if (options.package || !pckg) {
writeJsonSync('package.json', newPckg)
}
cb && cb(null, newLock)
})
}
module.exports = proc