Skip to content

Commit

Permalink
chore: upgrade dependencies (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
lirantal committed Aug 1, 2023
1 parent 4e5ecaa commit 217f67d
Show file tree
Hide file tree
Showing 18 changed files with 13,735 additions and 8,826 deletions.
22,400 changes: 13,654 additions & 8,746 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
"packages/*"
],
"devDependencies": {
"@commitlint/cli": "8.0.0",
"@commitlint/config-conventional": "8.0.0",
"commitizen": "3.1.1",
"cz-conventional-changelog": "2.1.0",
"husky": "2.4.0",
"lint-staged": "^8.1.0"
"@commitlint/cli": "17.6.7",
"@commitlint/config-conventional": "17.6.7",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"husky": "8.0.3",
"lint-staged": "^13.2.3",
"node-notifier": "^10.0.1"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -58,6 +59,6 @@
"dependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"turbo": "^1.10.7"
"turbo": "^1.10.12"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('ParseLockfile Yarn', () => {
}).toThrowError('Unable to parse yarn lockfile ""')
})
it('providing garbled content for lockfileText throws an error', () => {
const parser = new ParseLockfile({lockfileText: `# yarn lockfile v1`, lockfileType: 'yarn'})
const parser = new ParseLockfile({lockfileText: '# yarn lockfile v1', lockfileType: 'yarn'})
expect(() => {
parser.parseSync()
}).toThrowError('Unable to parse yarn lockfile ""')
Expand Down
8 changes: 4 additions & 4 deletions packages/lockfile-lint-api/__tests__/validators.host.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Validator: Host', () => {
type: 'error',
errors: [
{
message: `detected invalid host(s) for package: @babel/code-frame\n expected: registry.npmjs.org\n actual: registry.yarnpkg.com\n`,
message: 'detected invalid host(s) for package: @babel/code-frame\n expected: registry.npmjs.org\n actual: registry.yarnpkg.com\n',
package: '@babel/code-frame'
}
]
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('Validator: Host', () => {
const validator = new ValidatorHost({packages: mockedPackages})
expect(() => {
validator.validate(null)
}).toThrowError(`validate method requires an array`)
}).toThrowError('validate method requires an array')
})

it('validator should allow for git-based URLs', () => {
Expand All @@ -159,7 +159,7 @@ describe('Validator: Host', () => {
type: 'error',
errors: [
{
message: `detected invalid host(s) for package: @babel/code-frame\n expected: registry.npmjs.org,github.com\n actual: registry.yarnpkg.com\n`,
message: 'detected invalid host(s) for package: @babel/code-frame\n expected: registry.npmjs.org,github.com\n actual: registry.yarnpkg.com\n',
package: '@babel/code-frame'
}
]
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('Validator: Host', () => {
type: 'error',
errors: [
{
message: `detected invalid host(s) for package: @babel/code-frame\n expected: registry.npmjs.org\n actual: \n`,
message: 'detected invalid host(s) for package: @babel/code-frame\n expected: registry.npmjs.org\n actual: \n',
package: '@babel/code-frame'
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Validator: Integrity', () => {
type: 'error',
errors: [
{
message: `detected invalid integrity hash type for package: bolt11\n expected: sha512\n actual: sha1-1ZNEUixLxGSmWnMKxpUAf9tm3Yg=\n`,
message: 'detected invalid integrity hash type for package: bolt11\n expected: sha512\n actual: sha1-1ZNEUixLxGSmWnMKxpUAf9tm3Yg=\n',
package: 'bolt11'
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Validator: Protocol', () => {
}
}
const validator = new ValidatorScheme({packages: mockedPackages})
expect(() => validator.validate()).toThrow(`validate method requires an array`)
expect(() => validator.validate()).toThrow('validate method requires an array')
})

it('validator should fail if finding a non-https resource', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/lockfile-lint-api/__tests__/validators.url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Validator: Url', () => {
type: 'error',
errors: [
{
message: `detected invalid url(s) for package: bolt11\n expected: https://registry.npmjs.org\n actual: https://github.com/LN-Zap/bolt11#0492874ea9ced4ab49bf0f59a62368687f147247\n`,
message: 'detected invalid url(s) for package: bolt11\n expected: https://registry.npmjs.org\n actual: https://github.com/LN-Zap/bolt11#0492874ea9ced4ab49bf0f59a62368687f147247\n',
package: 'bolt11'
}
]
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Validator: Url', () => {
const validator = new ValidatorUrl({packages: mockedPackages})
expect(() => {
validator.validate(null)
}).toThrowError(`validate method requires an array`)
}).toThrowError('validate method requires an array')
})

it('validator should not fail even if one of the packages has no `resolved` field', () => {
Expand Down
28 changes: 14 additions & 14 deletions packages/lockfile-lint-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,29 @@
"directory": "packages/lockfile-lint-api"
},
"dependencies": {
"@yarnpkg/parsers": "^3.0.0-rc.32",
"@yarnpkg/parsers": "^3.0.0-rc.48.1",
"debug": "^4.3.4",
"object-hash": "^3.0.0"
},
"devDependencies": {
"babel-eslint": "^10.0.1",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"docco": "^0.8.0",
"docco": "^0.9.1",
"doxdox": "3.0.0",
"eslint": "^5.10.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.1.2",
"eslint-plugin-node": "9.1.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-standard": "^4.0.0",
"jest": "24.8.0",
"open-cli": "^5.0.0",
"prettier-standard": "9.1.1"
"eslint": "^8.46.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-security": "^1.7.1",
"eslint-plugin-standard": "^4.1.0",
"jest": "29.6.2",
"open-cli": "^7.2.0",
"prettier-standard": "16.4.1"
},
"jest": {
"testEnvironment": "node",
Expand Down
26 changes: 13 additions & 13 deletions packages/lockfile-lint-api/src/ParseLockfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const {
* Checks if a sample object is a valid dependency structure
* @return boolean
*/
function checkSampleContent (lockfile, isYarnBerry) {
function checkSampleContent(lockfile, isYarnBerry) {
if (Object.entries(lockfile).length < (isYarnBerry ? 2 : 1)) {
return false
}
Expand All @@ -31,15 +31,15 @@ function checkSampleContent (lockfile, isYarnBerry) {
sampleKey.match(/.*@.*/) &&
sampleValue &&
typeof sampleValue === 'object' &&
sampleValue.hasOwnProperty('version') &&
(sampleValue.hasOwnProperty('resolved') || sampleValue.hasOwnProperty('resolution'))
Object.hasOwn(sampleValue, 'version') &&
(Object.hasOwn(sampleValue, 'resolved') || Object.hasOwn(sampleValue, 'resolution'))
)
}
/**
* @param {string|Buffer} lockfileBuffer - the lockfile contents
* @return {{ type: string, object: any }}
*/
function yarnParseAndVerify (lockfileBuffer) {
function yarnParseAndVerify(lockfileBuffer) {
const lockfile = yarnParseSyml(lockfileBuffer.toString())
const isYarnBerry = typeof lockfile.__metadata === 'object'
const hasSensibleContent =
Expand Down Expand Up @@ -76,7 +76,7 @@ class ParseLockfile {
* @param {string} options.lockfileType - the package manager type
* for lockfile
*/
constructor (options) {
constructor(options) {
if (!options || typeof options !== 'object') {
throw new ParsingError(NO_OPTIONS)
}
Expand All @@ -94,15 +94,15 @@ class ParseLockfile {
* Checks if lockfile type option was provided
* @return boolean
*/
isLockfileTypeGiven () {
isLockfileTypeGiven() {
return typeof this.options.lockfileType === 'string' && this.options.lockfileType
}

/**
* Synchronously parses a lockfile
* @return {object} parsed file
*/
parseSync () {
parseSync() {
const lockfileParser = this.resolvePkgMgrForLockfile()
if (!lockfileParser) {
if (this.isLockfileTypeGiven()) {
Expand All @@ -127,7 +127,7 @@ class ParseLockfile {
return lockfileParser.call(this, file)
}

resolvePkgMgrForLockfile () {
resolvePkgMgrForLockfile() {
const lockfileResolversByPackageManager = {
npm: this.parseNpmLockfile,
npmjs: this.parseNpmLockfile,
Expand All @@ -147,7 +147,7 @@ class ParseLockfile {
return resolver
}

resolvePkgMgrByFilename () {
resolvePkgMgrByFilename() {
const lockfileResolverByFilename = {
'package-lock.json': this.parseNpmLockfile,
'yarn.lock': this.parseYarnLockfile
Expand All @@ -159,7 +159,7 @@ class ParseLockfile {
return lockfileResolverByFilename[baseFilename]
}

parseYarnLockfile (lockfileBuffer) {
parseYarnLockfile(lockfileBuffer) {
let parsedFile
try {
parsedFile = yarnParseAndVerify(lockfileBuffer)
Expand All @@ -169,7 +169,7 @@ class ParseLockfile {
return parsedFile
}

parseNpmLockfile (lockfileBuffer) {
parseNpmLockfile(lockfileBuffer) {
let flattenedDepTree
try {
const packageJsonParsed = JSON.parse(lockfileBuffer)
Expand Down Expand Up @@ -201,7 +201,7 @@ class ParseLockfile {
}
}

_flattenNpmDepsTree (npmDepsTree, npmDepMap = {}) {
_flattenNpmDepsTree(npmDepsTree, npmDepMap = {}) {
for (const [depName, depMetadata] of Object.entries(npmDepsTree)) {
// only evaluate dependency metadata if it's an object with actual metadata
// @TODO potentially, this entry can be just a dependency name and version
Expand Down Expand Up @@ -248,7 +248,7 @@ class ParseLockfile {
return npmDepMap
}

extractedPackageName (packageName) {
extractedPackageName(packageName) {
const parts = packageName.split('/')
const lastIndex = parts.lastIndexOf('node_modules')

Expand Down
4 changes: 2 additions & 2 deletions packages/lockfile-lint-api/src/validators/ValidateHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = class ValidateHost {
throw new Error('validate method requires an array')
}

let validationResult = {
const validationResult = {
type: 'success',
errors: []
}
Expand Down Expand Up @@ -51,7 +51,7 @@ module.exports = class ValidateHost {
const isPassing = allowedHosts.includes(packageResolvedURL.host)
if (!isPassing) {
if (!packageResolvedURL.host && options && options.emptyHostname) {
this.debug(`detected empty hostname but allowing because emptyHostname is not false`)
this.debug('detected empty hostname but allowing because emptyHostname is not false')
} else {
validationResult.errors.push({
message: `detected invalid host(s) for package: ${packageName}\n expected: ${allowedHosts}\n actual: ${
Expand Down
2 changes: 1 addition & 1 deletion packages/lockfile-lint-api/src/validators/ValidateHttps.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = class ValidateHttps {
}

validate () {
let validationResult = {
const validationResult = {
type: 'success',
errors: []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = class ValidateIntegrity {
}

validate () {
let validationResult = {
const validationResult = {
type: 'success',
errors: []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = class ValidatePackageNames {
}

validate (packageNameAliases) {
let validationResult = {
const validationResult = {
type: 'success',
errors: []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = class ValidateProtocol {
throw new Error('validate method requires an array')
}

let validationResult = {
const validationResult = {
type: 'success',
errors: []
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lockfile-lint-api/src/validators/ValidateUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = class ValidateUrl {
throw new Error('validate method requires an array')
}

let validationResult = {
const validationResult = {
type: 'success',
errors: []
}
Expand Down
20 changes: 10 additions & 10 deletions packages/lockfile-lint/bin/lockfile-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ try {
process.exit(1)

Check warning on line 36 in packages/lockfile-lint/bin/lockfile-lint.js

View workflow job for this annotation

GitHub Actions / Node v16.x ((ubuntu-latest))

Don't use process.exit(); throw an error instead

Check warning on line 36 in packages/lockfile-lint/bin/lockfile-lint.js

View workflow job for this annotation

GitHub Actions / Node v18.x ((ubuntu-latest))

Don't use process.exit(); throw an error instead
}

const isPrettyFormat = config['format'] === 'pretty'
const isPrettyFormat = config.format === 'pretty'

let validators = []
const validators = []
const supportedValidators = new Map([
['allowed-hosts', 'validateHosts'],
['validate-https', 'validateHttps'],
Expand Down Expand Up @@ -79,8 +79,8 @@ for (const [commandArgument, commandValue] of Object.entries(config)) {
let result
try {
result = main.runValidators({
path: config['path'],
type: config['type'],
path: config.path,
type: config.type,
validators
})
} catch (errorPayload) {
Expand All @@ -104,38 +104,38 @@ if (validatorFailures !== 0) {
success('No issues detected')
}

function success (message) {
function success(message) {
const m = [
isPrettyFormat ? GREEN : '',
isPrettyFormat ? symbols.success : '',
message,
'\n',
isPrettyFormat ? RESET : ''
].filter(e => !!e)
].filter((e) => !!e)

console.info(m.join(' '))
}

function warn (message) {
function warn(message) {
const m = [
isPrettyFormat ? YELLOW : '',
isPrettyFormat ? symbols.info : '',
message,
'\n',
isPrettyFormat ? RESET : ''
].filter(e => !!e)
].filter((e) => !!e)

console.error(m.join(' '))
}

function error (message) {
function error(message) {
const m = [
isPrettyFormat ? RED : '',
isPrettyFormat ? symbols.error : '',
message,
'\n',
isPrettyFormat ? RESET : ''
].filter(e => !!e)
].filter((e) => !!e)

console.error(m.join(' '))
}
Loading

0 comments on commit 217f67d

Please sign in to comment.