[add] implement vulnerability checking and advisory fetching, enhance repo processing, and add utility functions
This commit is contained in:
198
test_src/build-package.cjs
Normal file
198
test_src/build-package.cjs
Normal file
@@ -0,0 +1,198 @@
|
||||
const {writeFile} = require('fs/promises');
|
||||
|
||||
const libs = `glob-parent
|
||||
is-glob
|
||||
mime-types
|
||||
doctrine
|
||||
define-property
|
||||
jsonfile
|
||||
optionator
|
||||
http-errors
|
||||
type-check
|
||||
levn
|
||||
is-extendable
|
||||
esquery
|
||||
on-finished
|
||||
error-ex
|
||||
finalhandler
|
||||
content-disposition
|
||||
terser
|
||||
proxy-addr
|
||||
prop-types
|
||||
has-values
|
||||
has-value
|
||||
url-parse
|
||||
simple-swizzle
|
||||
compressible
|
||||
global-modules
|
||||
thenify
|
||||
mz
|
||||
clone-deep
|
||||
shallow-clone
|
||||
prettier-linter-helpers
|
||||
cors
|
||||
fd-slicer
|
||||
object.pick
|
||||
language-tags
|
||||
union-value
|
||||
object-copy
|
||||
static-extend
|
||||
memory-fs
|
||||
pinkie-promise
|
||||
hash.js
|
||||
pretty-error
|
||||
renderkid
|
||||
wbuf
|
||||
browserify-zlib
|
||||
hmac-drbg
|
||||
des.js
|
||||
dom-converter
|
||||
expand-tilde
|
||||
homedir-polyfill
|
||||
zip-stream
|
||||
crc32-stream
|
||||
one-time
|
||||
resolve-dir
|
||||
yargs-unparser
|
||||
warning
|
||||
bplist-parser
|
||||
for-own
|
||||
md5
|
||||
is-relative
|
||||
is-absolute
|
||||
is-unc-path
|
||||
redis-parser
|
||||
recursive-readdir
|
||||
path-root
|
||||
lazy-cache
|
||||
css-to-react-native
|
||||
parse-filepath
|
||||
request-progress
|
||||
jest-junit
|
||||
postcss-initial
|
||||
unixify
|
||||
cookie-parser
|
||||
saslprep
|
||||
window-size
|
||||
cookies
|
||||
keygrip
|
||||
contains-path
|
||||
fined
|
||||
object.defaults
|
||||
is-color-stop
|
||||
gonzales-pe
|
||||
bufferutil
|
||||
make-iterator
|
||||
glob-base
|
||||
uid-safe
|
||||
fancy-log
|
||||
object.map
|
||||
object.omit
|
||||
find-babel-config
|
||||
utf-8-validate
|
||||
mquery
|
||||
xlsx
|
||||
json-to-pretty-yaml
|
||||
easy-table
|
||||
named-placeholders
|
||||
is-dotfile
|
||||
parse-glob
|
||||
plugin-error
|
||||
is-equal-shallow
|
||||
original
|
||||
detective-typescript
|
||||
detective-es6
|
||||
json2mq
|
||||
create-error-class
|
||||
detective-cjs
|
||||
to-through
|
||||
resolve-options
|
||||
ansi-gray
|
||||
bcrypt
|
||||
mixin-object
|
||||
optimize-css-assets-webpack-plugin
|
||||
ordered-read-streams
|
||||
sync-fetch
|
||||
to-absolute-glob
|
||||
glogg
|
||||
unique-stream
|
||||
align-text
|
||||
gulplog
|
||||
blob
|
||||
center-align
|
||||
right-align
|
||||
wkx
|
||||
chai-as-promised
|
||||
json-pointer
|
||||
has-glob
|
||||
promptly
|
||||
hot-shots
|
||||
semver-greatest-satisfied-range
|
||||
each-props
|
||||
is2
|
||||
levenary
|
||||
airbnb-prop-types
|
||||
remove-bom-stream
|
||||
remove-bom-buffer
|
||||
dotenv-defaults
|
||||
rework
|
||||
vizion
|
||||
array-sort
|
||||
default-compare
|
||||
pad-right
|
||||
passport-local
|
||||
console.table
|
||||
cli-tableau
|
||||
condense-newlines
|
||||
requireg
|
||||
object.reduce
|
||||
properties-reader
|
||||
array-initial
|
||||
default-resolution
|
||||
collection-map
|
||||
ansi-red
|
||||
broccoli-merge-trees
|
||||
eslint-plugin-react-native
|
||||
is-valid-path
|
||||
strip-hex-prefix
|
||||
uglify-es
|
||||
ansi-cyan
|
||||
method-override
|
||||
readline2
|
||||
number-allocator
|
||||
has-gulplog
|
||||
ethjs-util
|
||||
unescape
|
||||
validate.io-integer
|
||||
stream-parser
|
||||
compute-gcd
|
||||
validate.io-integer-array
|
||||
compute-lcm
|
||||
set-getter
|
||||
passport-oauth2
|
||||
i18n-iso-countries
|
||||
sha1
|
||||
json-diff
|
||||
dreamopt
|
||||
highlight-es
|
||||
basic-auth-connect
|
||||
glob2base
|
||||
third-party-capital
|
||||
new-date
|
||||
webrtc-adapter
|
||||
xhr-request-promise
|
||||
contentful-resolve-response
|
||||
jest-sonar-reporter
|
||||
parse-author
|
||||
amd-name-resolver
|
||||
mocha-multi-reporters
|
||||
eslint-plugin-filenames
|
||||
apache-crypt`;
|
||||
const libsArray = libs.split('\n').map(e => e.trim());
|
||||
|
||||
const newPackageJson = {
|
||||
dependencies: Object.fromEntries(libsArray.map(lib => [lib, "latest"])),
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(newPackageJson, null, 2));
|
||||
writeFile('vulncheck.package.json', JSON.stringify(newPackageJson, null, 2));
|
45
test_src/check_diff.cjs
Normal file
45
test_src/check_diff.cjs
Normal file
@@ -0,0 +1,45 @@
|
||||
// diff the two csv files, and perform a left subtract and right subtract.
|
||||
const fsp = require('fs/promises')
|
||||
|
||||
async function main(){
|
||||
const file1 = 'success.txt';
|
||||
const file2String = `mime-types
|
||||
http-errors
|
||||
source-map-support
|
||||
compressible
|
||||
global-modules
|
||||
thenify
|
||||
mz
|
||||
memory-fs
|
||||
pinkie-promise
|
||||
pretty-error
|
||||
renderkid
|
||||
hpack.js
|
||||
wbuf
|
||||
expand-tilde
|
||||
homedir-polyfill
|
||||
basic-auth
|
||||
for-own
|
||||
is-unc-path
|
||||
recursive-readdir
|
||||
path-root
|
||||
cookies
|
||||
bufferutil
|
||||
utf-8-validate
|
||||
easy-table
|
||||
is-dotfile`;
|
||||
const file1String = await fsp.readFile(file1, 'utf8');
|
||||
const f1Elements = file1String.split('\n').filter(Boolean);
|
||||
const f2Elements = file2String.split('\n').filter(Boolean);
|
||||
const leftSubtract = f1Elements.filter(x => !f2Elements.includes(x));
|
||||
// const rightSubtract = f2Elements.filter(x => !f1Elements.includes(x));
|
||||
console.log('Left Subtract:f1, not in f2');
|
||||
const leftSubtractString = leftSubtract.join('\n')
|
||||
await fsp.writeFile('left_subtract.txt', leftSubtractString, 'utf8');
|
||||
// console.log('Right Subtract: done, but not in main list', rightSubtract);
|
||||
}
|
||||
|
||||
|
||||
main().catch(err => {
|
||||
console.error('Error:', err);
|
||||
});
|
Reference in New Issue
Block a user