mirror of
https://github.com/azure/login.git
synced 2026-03-15 09:20:56 -04:00
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>
This commit is contained in:
68
node_modules/package-lock/README.md
generated
vendored
Normal file
68
node_modules/package-lock/README.md
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# package-lock
|
||||
|
||||
> (Re-)Build package-lock.json or npm-shrinkwrap.json file from node_modules folder
|
||||
|
||||
## `npm@5` Creating `package-lock.json`
|
||||
|
||||
Copying `node_modules` folders and trying to install additional packages leads to
|
||||
a complete removal of all copied packages with `npm@>=5.0`.
|
||||
|
||||
A `package.json` file would solve this issue but nonetheless you would need to
|
||||
create one with all it's dependencies.
|
||||
|
||||
Running `package-lock` on the folder which contains `node_modules` creates the
|
||||
missing `package-lock.json` file and in case the `package.json` is missing, it
|
||||
will be created as well. With this you are now save to install additional
|
||||
packages with `npm i ...`
|
||||
|
||||
## `npm@4`, `npm@3` Creating `npm-shrinkwrap.json`
|
||||
|
||||
For `npm@<=4.x` you can also use this package to create a `npm-shrinkwrap.json`
|
||||
file for fixing you dependencies. For me running `npm shrink` is mostly a mess
|
||||
as there is always an `extraneous` dependency showing up (especially after a dedup).
|
||||
|
||||
1. Make a fresh install with
|
||||
```
|
||||
rimraf node_modules npm-shrinkwrap.json
|
||||
npm i --production
|
||||
```
|
||||
2. Now create the `npm-shrinkwrap.json` file with
|
||||
```
|
||||
package-lock -s
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Requires [nodejs](http://nodejs.org/).
|
||||
|
||||
```sh
|
||||
$ npm install -g package-lock
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
$ package-lock
|
||||
```
|
||||
```
|
||||
Usage: package-lock [options]
|
||||
|
||||
Options:
|
||||
|
||||
-p, --package force appending found packages to `optionalDependencies` in package.json
|
||||
-r, --resolve <string> replace resolved repository
|
||||
-s, --shrink write `npm-shrinkwrap.json` instead of `package-lock.json`
|
||||
-h, --help output usage information
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Tests
|
||||
|
||||
```sh
|
||||
$ npm test
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Unlicense http://unlicense.org
|
||||
24
node_modules/package-lock/UNLICENSE
generated
vendored
Normal file
24
node_modules/package-lock/UNLICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
16
node_modules/package-lock/bin/package-lock.js
generated
vendored
Normal file
16
node_modules/package-lock/bin/package-lock.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const proc = require('..')
|
||||
const cmd = require('commander')
|
||||
|
||||
cmd
|
||||
.option('-p, --package', 'force appending found packages to `optionalDependencies` in package.json')
|
||||
.option('-r, --resolve <string>', 'replace resolved repository')
|
||||
.option('-s, --shrink', 'write `npm-shrinkwrap.json` instead of `package-lock.json`')
|
||||
.parse(process.argv)
|
||||
|
||||
proc(cmd, (err) => {
|
||||
if (err) {
|
||||
console.error('' + err)
|
||||
}
|
||||
})
|
||||
89
node_modules/package-lock/package.json
generated
vendored
Normal file
89
node_modules/package-lock/package.json
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"package-lock@1.0.3",
|
||||
"E:\\Repos\\GHActions\\login"
|
||||
]
|
||||
],
|
||||
"_from": "package-lock@1.0.3",
|
||||
"_id": "package-lock@1.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-rEiz3fs0M8jyH1OtWE3TP7MdtWJnsE69qEOipZ4CDF3KoN3XY5mcDucXugTli6Lqig9rhQ/6ST2atxjU2/aIFQ==",
|
||||
"_location": "/package-lock",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "package-lock@1.0.3",
|
||||
"name": "package-lock",
|
||||
"escapedName": "package-lock",
|
||||
"rawSpec": "1.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/package-lock/-/package-lock-1.0.3.tgz",
|
||||
"_spec": "1.0.3",
|
||||
"_where": "E:\\Repos\\GHActions\\login",
|
||||
"author": {
|
||||
"name": "commenthol",
|
||||
"email": "commenthol@gmail.com"
|
||||
},
|
||||
"bin": {
|
||||
"package-lock": "bin/package-lock.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/commenthol/package-lock/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"asyncc": "^2.0.4",
|
||||
"commander": "^5.0.0",
|
||||
"glob": "^7.1.6",
|
||||
"lodash": "^4.17.15",
|
||||
"traverse": "^0.6.6"
|
||||
},
|
||||
"description": "(Re-)Build package-lock.json or npm-shrinkwrap.json file from node_modules folder",
|
||||
"devDependencies": {
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-standard": "^14.1.1",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"mocha": "^7.1.1",
|
||||
"shelljs": "^0.8.3"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"standard"
|
||||
]
|
||||
},
|
||||
"homepage": "https://github.com/commenthol/package-lock#readme",
|
||||
"keywords": [
|
||||
"json",
|
||||
"lock",
|
||||
"npm",
|
||||
"package",
|
||||
"regenerate",
|
||||
"shrinkwrap"
|
||||
],
|
||||
"license": "Unlicense",
|
||||
"main": "src/index.js",
|
||||
"name": "package-lock",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/commenthol/package-lock.git"
|
||||
},
|
||||
"scripts": {
|
||||
"all": "npm run lint && npm test",
|
||||
"lint": "eslint --fix '**/*.js'",
|
||||
"prepublishOnly": "npm run all",
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
||||
102
node_modules/package-lock/src/generate.js
generated
vendored
Normal file
102
node_modules/package-lock/src/generate.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
const _ = require('lodash')
|
||||
const { DEPS } = require('./utils')
|
||||
|
||||
const PRIVATE = '@private/private'
|
||||
|
||||
function toPackageName (name) {
|
||||
return name.replace(/^@/, '').replace(/[/]/g, '-')
|
||||
}
|
||||
|
||||
function genPackageLock (tree, pckg, options) {
|
||||
pckg = Object.assign({ name: PRIVATE, version: '1.0.0' }, pckg)
|
||||
options = options || {}
|
||||
|
||||
const convert = (o, level, opts) => {
|
||||
level++
|
||||
const t = {}
|
||||
if (o.version) {
|
||||
t.version = o.version
|
||||
}
|
||||
if (o._resolved) {
|
||||
if (options.resolve) {
|
||||
const pn = toPackageName(o.name)
|
||||
t.resolved = `${options.resolve}/${pn}/-/${pn}-${o.version}.tgz`
|
||||
} else {
|
||||
t.resolved = o._resolved
|
||||
}
|
||||
}
|
||||
if (o._integrity) {
|
||||
t.integrity = o._integrity
|
||||
}
|
||||
/* === t.dev disabled as we would need the full tree from a package.json
|
||||
if (o.name) {
|
||||
if (level === 2) {
|
||||
if (pckg && pckg.dependencies) {
|
||||
if (typeof pckg.dependencies[o.name] === 'undefined') {
|
||||
t.dev = true
|
||||
}
|
||||
} else {
|
||||
t.dev = true
|
||||
}
|
||||
if (t.dev) opts.dev = true
|
||||
} else if (opts.dev) {
|
||||
t.dev = true
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (o[DEPS]) {
|
||||
t.requires = {}
|
||||
Object.keys(o[DEPS]).sort().forEach((k) => {
|
||||
const { name, version } = o[DEPS][k]
|
||||
if (k === name) {
|
||||
t.requires[name] = version
|
||||
}
|
||||
})
|
||||
Object.keys(o[DEPS]).sort().forEach((k) => {
|
||||
if (o[DEPS][k][DEPS]) {
|
||||
if (!t.dependencies) t.dependencies = {}
|
||||
t.dependencies[k] = convert(o[DEPS][k], level, opts)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Object.keys(o).sort().forEach((k) => {
|
||||
if (k === o[k].name) {
|
||||
t[k] = convert(o[k], level, opts)
|
||||
}
|
||||
})
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
const obj = {
|
||||
name: pckg.name,
|
||||
version: pckg.version,
|
||||
lockfileVersion: 1,
|
||||
requires: true,
|
||||
dependencies: convert(tree, 0, {})
|
||||
}
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
function genPackageJson (tree, pckg) {
|
||||
pckg = Object.assign({ name: PRIVATE, version: '1.0.0' }, pckg)
|
||||
|
||||
Object.keys(tree).forEach((name) => {
|
||||
const hasDep = _.get(pckg, ['dependencies', name]) ||
|
||||
_.get(pckg, ['devDependencies', name])
|
||||
const version = _.get(tree, [name, 'version'])
|
||||
if (!hasDep && version) {
|
||||
if (!pckg.optionalDependencies) pckg.optionalDependencies = {}
|
||||
pckg.optionalDependencies[name] = `^${version}`
|
||||
}
|
||||
})
|
||||
|
||||
return pckg
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
toPackageName,
|
||||
genPackageLock,
|
||||
genPackageJson
|
||||
}
|
||||
50
node_modules/package-lock/src/index.js
generated
vendored
Normal file
50
node_modules/package-lock/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
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
|
||||
170
node_modules/package-lock/src/utils.js
generated
vendored
Normal file
170
node_modules/package-lock/src/utils.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
const _ = require('lodash')
|
||||
const fs = require('fs')
|
||||
const { relative, resolve, sep } = require('path')
|
||||
const glob = require('glob')
|
||||
const traverse = require('traverse')
|
||||
const { eachLimit } = require('asyncc')
|
||||
|
||||
const DEPS = '__deps'
|
||||
|
||||
function nodeModulesDir (dirname, isRelative) {
|
||||
let path = resolve(dirname, 'node_modules')
|
||||
if (isRelative) {
|
||||
path = relative(process.cwd(), path)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
function readJson (filename, cb) {
|
||||
fs.readFile(filename, 'utf8', (err, data) => {
|
||||
let obj = null
|
||||
if (!err && data) {
|
||||
try {
|
||||
obj = JSON.parse(data)
|
||||
} catch (e) {
|
||||
err = e
|
||||
}
|
||||
}
|
||||
cb(err, obj)
|
||||
})
|
||||
}
|
||||
|
||||
function writeJson (filename, obj, cb) {
|
||||
fs.writeFile(filename, JSON.stringify(obj, null, 2) + '\n', 'utf8', cb)
|
||||
}
|
||||
|
||||
function writeJsonSync (filename, obj) {
|
||||
return fs.writeFileSync(filename, JSON.stringify(obj, null, 2) + '\n', 'utf8')
|
||||
}
|
||||
|
||||
function readPackageJsonSync (dirname) {
|
||||
const file = resolve(dirname, 'package.json')
|
||||
try {
|
||||
const stats = fs.statSync(file)
|
||||
if (stats && stats.isFile()) {
|
||||
const str = fs.readFileSync(file, 'utf8')
|
||||
return JSON.parse(str)
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function findPackages (dirname, cb) {
|
||||
const modules = nodeModulesDir(dirname)
|
||||
glob(`${modules}/**/package.json`, cb)
|
||||
}
|
||||
|
||||
function extract (path, cb) {
|
||||
readJson(path, (err, pckg) => {
|
||||
let obj = null
|
||||
if (!err && pckg) {
|
||||
obj = Object.assign(
|
||||
_.pick(pckg, ['name', 'version', '_id', '_integrity', '_resolved', '_shasum', '_spec']),
|
||||
{ path }
|
||||
)
|
||||
if (!obj._id) {
|
||||
obj._id = `${obj.name}@${obj.version}`
|
||||
}
|
||||
if (!obj._spec) {
|
||||
obj._spec = `${obj.name}@^${obj.version}`
|
||||
}
|
||||
}
|
||||
cb(err, obj)
|
||||
})
|
||||
}
|
||||
|
||||
function packagePath (path) {
|
||||
const splt = path.split(sep)
|
||||
splt.pop() // strip-off package.json
|
||||
const arr = []
|
||||
let tmp = []
|
||||
|
||||
const pushToArr = () => {
|
||||
const scoped = /^@/.test(tmp[0])
|
||||
if (
|
||||
(tmp.length > 1 && !scoped) ||
|
||||
(tmp.length > 2 && scoped)
|
||||
) {
|
||||
tmp = []
|
||||
}
|
||||
if (tmp.length) {
|
||||
arr.push(tmp.join('/'))
|
||||
}
|
||||
tmp = []
|
||||
}
|
||||
|
||||
while (splt.length) {
|
||||
const curr = splt.shift()
|
||||
if (curr === 'node_modules') {
|
||||
pushToArr()
|
||||
} else {
|
||||
tmp.push(curr)
|
||||
}
|
||||
}
|
||||
pushToArr()
|
||||
return arr
|
||||
}
|
||||
|
||||
function _sanitizeTree (tree) {
|
||||
return traverse(tree).map(function () {
|
||||
// remove empty DEPS: {}
|
||||
if (this.key === DEPS && !Object.keys(this.node).length) {
|
||||
this.delete()
|
||||
}
|
||||
// remove nodes where name from path does not match package name
|
||||
if (this.key === 'name' && this.parent.key !== this.node) {
|
||||
this.parent.delete()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function buildTree (pckgfiles, dirname, cb) {
|
||||
const tree = {}
|
||||
|
||||
const add = (path, info) => {
|
||||
let tmp = tree
|
||||
let last = {}
|
||||
path.forEach((p) => {
|
||||
if (!tmp[p]) {
|
||||
tmp[p] = {}
|
||||
tmp[p][DEPS] = {}
|
||||
}
|
||||
last = tmp[p]
|
||||
tmp = tmp[p][DEPS]
|
||||
})
|
||||
Object.assign(last, info)
|
||||
}
|
||||
|
||||
eachLimit(25,
|
||||
pckgfiles,
|
||||
(path, cb) => {
|
||||
extract(path, (err, data) => {
|
||||
const modules = packagePath(relative(dirname, path))
|
||||
add(modules, data)
|
||||
cb(err)
|
||||
})
|
||||
},
|
||||
(err) => {
|
||||
if (err) {
|
||||
cb(err)
|
||||
} else {
|
||||
cb(null, _sanitizeTree(tree))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
DEPS,
|
||||
nodeModulesDir,
|
||||
readJson,
|
||||
writeJson,
|
||||
writeJsonSync,
|
||||
readPackageJsonSync,
|
||||
findPackages,
|
||||
extract,
|
||||
packagePath,
|
||||
_sanitizeTree,
|
||||
buildTree
|
||||
}
|
||||
Reference in New Issue
Block a user