Socket
Socket
Sign inDemoInstall

synp

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

synp - npm Package Compare versions

Comparing version 1.9.5 to 1.9.6

.github/workflows/ci.yaml

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [1.9.6](https://github.com/imsnif/synp/compare/v1.9.5...v1.9.6) (2021-02-12)
### Performance Improvements
* tech release ([1d2512c](https://github.com/imsnif/synp/commit/1d2512ca3de5ffe96d0b8ff4c63efc220c6bc202))
## [1.9.5](https://github.com/imsnif/synp/compare/v1.9.4...v1.9.5) (2020-12-13)

@@ -2,0 +9,0 @@

7

cli/run.js

@@ -14,6 +14,7 @@ #!/usr/bin/env node

try {
const { sourceFile, withWorkspace } = program
const options = program.opts()
const { sourceFile, withWorkspace } = options
const sourceFileName = sourceFile && sourceFile.split(path.sep).pop()
validateArgs(program, sourceFileName)
validatePath(program)
validateArgs(options, sourceFileName)
validatePath(options)

@@ -20,0 +21,0 @@ const convert = sourceFileName === 'yarn.lock'

@@ -8,7 +8,7 @@ 'use strict'

? Object.keys(dependencies || {}).reduce((deps, depName) => {
if (optionalDependencies[depName]) return deps
const entry = dependencies[depName]
deps[depName] = entry
return deps
}, {})
if (optionalDependencies[depName]) return deps
const entry = dependencies[depName]
deps[depName] = entry
return deps
}, {})
: dependencies || {}

@@ -15,0 +15,0 @@ const devDeps = name === packageLock.name ? devDependencies : {}

@@ -34,37 +34,37 @@ 'use strict'

? Object.keys(_tree).reduce((tree, name) => {
const entry = _tree[name]
const isWorkspacePkg = /^file:/.test(entry.version)
const _name = join(prefix, isWorkspacePkg ? entry.version.slice(5) : `node_modules${sep}${name}`)
const pkgJsonPath = join(packageDir, _name, 'package.json')
const pkgJson = read(pkgJsonPath)
const requires = entry.requires
const deps = (requires && Object.keys(requires).length > 0) ? requires : undefined
const pkg = {
[_name]: {
version: isWorkspacePkg ? pkgJson.version : entry.version,
resolved: isWorkspacePkg ? undefined : entry.resolved,
integrity: entry.integrity,
license: pkgJson.license,
dependencies: deps,
dev: entry.dev,
engines: pkgJson.engines,
bin: pkgJson.bin
}
}
const link = isWorkspacePkg
? {
[`node_modules${sep}${name}`]: {
resolved: _name,
link: true
const entry = _tree[name]
const isWorkspacePkg = /^file:/.test(entry.version)
const _name = join(prefix, isWorkspacePkg ? entry.version.slice(5) : `node_modules${sep}${name}`)
const pkgJsonPath = join(packageDir, _name, 'package.json')
const pkgJson = read(pkgJsonPath)
const requires = entry.requires
const deps = (requires && Object.keys(requires).length > 0) ? requires : undefined
const pkg = {
[_name]: {
version: isWorkspacePkg ? pkgJson.version : entry.version,
resolved: isWorkspacePkg ? undefined : entry.resolved,
integrity: entry.integrity,
license: pkgJson.license,
dependencies: deps,
dev: entry.dev,
engines: pkgJson.engines,
bin: pkgJson.bin
}
}
: undefined
const link = isWorkspacePkg
? {
[`node_modules${sep}${name}`]: {
resolved: _name,
link: true
}
}
: undefined
return {
...tree,
...flattenDeps(entry.dependencies, `${_name}${sep}`),
...pkg,
...link
}
}, {})
return {
...tree,
...flattenDeps(entry.dependencies, `${_name}${sep}`),
...pkg,
...link
}
}, {})
: undefined

@@ -71,0 +71,0 @@

{
"name": "synp",
"version": "1.9.5",
"version": "1.9.6",
"description": "Convert yarn.lock to package-lock.json and vice versa",

@@ -19,12 +19,11 @@ "keywords": [

"scripts": {
"test": "standard && npm run test:unit",
"test": "yarn test:lint && yarn cover:unit && yarn test:integration && yarn test:deps",
"test:lint": "standard",
"test:unit": "tape ./test/*.spec.js",
"test:integration": "cli/synp.js -s yarn.lock",
"test:depcheck": "npx depcheck --ignores \"@semantic-release/*\"",
"test:integration": "cli/synp.js -s yarn.lock && rimraf package-lock.json",
"test:depcheck": "npx depcheck --ignores @semantic-release/*,semantic-release",
"test:depaudit": "npx yarn-audit-fix",
"test:deps": "yarn test:depcheck && yarn test:depaudit",
"coverage": "nyc --reporter=lcov npm test",
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"release": "semantic-release",
"postupdate": "yarn && yarn test:deps && yarn test"
"cover:unit": "nyc --reporter=lcov --reporter=text yarn test:unit",
"postupdate": "yarn && yarn test"
},

@@ -41,7 +40,7 @@ "author": "Aram Drevekenin <grimsniffer@gmail.com>",

"colors": "^1.4.0",
"commander": "^6.1.0",
"commander": "^7.0.0",
"eol": "^0.9.1",
"lodash": "4.17.20",
"nmtree": "^1.0.6",
"semver": "^7.3.2",
"semver": "^7.3.4",
"sort-object-keys": "^1.1.3"

@@ -52,11 +51,11 @@ },

"@semantic-release/git": "^9.0.0",
"@semantic-release/github": "^7.1.1",
"@semantic-release/npm": "^7.0.6",
"coveralls": "^3.1.0",
"@semantic-release/github": "^7.2.0",
"@semantic-release/npm": "^7.0.10",
"nyc": "15.1.0",
"semantic-release": "^17.1.2",
"sinon": "^9.1.0",
"standard": "^14.3.4",
"tape": "^5.0.1"
"semantic-release": "^17.3.8",
"sinon": "^9.2.4",
"standard": "^16.0.3",
"tape": "^5.1.1",
"rimraf": "^3.0.2"
}
}

@@ -59,2 +59,2 @@ [![Build Status](https://travis-ci.org/imsnif/synp.svg?branch=master)](https://travis-ci.org/imsnif/synp) [![Coverage Status](https://coveralls.io/repos/github/imsnif/synp/badge.svg?branch=master)](https://coveralls.io/github/imsnif/synp?branch=master) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

### License
MIT
[MIT](./LICENSE.md)

@@ -8,2 +8,3 @@ 'use strict'

const { yarnToNpm, npmToYarn } = require('../')
const fixtures = require('path').resolve(__dirname, 'fixtures')
const {

@@ -18,3 +19,3 @@ findNonSha1Hashes,

try {
const path = `${__dirname}/fixtures/single-root-dep`
const path = `${fixtures}/single-root-dep`
const yarnLock = fs.readFileSync(`${path}/yarn.lock`, 'utf-8')

@@ -41,3 +42,3 @@ const packageLock = fs.readFileSync(`${path}/package-lock.json`, 'utf-8')

t.plan(1)
const path = `${__dirname}/fixtures/multiple-level-deps`
const path = `${fixtures}/multiple-level-deps`
const yarnLock = fs.readFileSync(`${path}/yarn.lock`, 'utf-8')

@@ -74,3 +75,3 @@ const packageLock = fs.readFileSync(`${path}/package-lock.json`, 'utf-8')

t.plan(1)
const path = `${__dirname}/fixtures/multiple-level-deps`
const path = `${fixtures}/multiple-level-deps`
const packageLock = fs.readFileSync(`${path}/package-lock.json`, 'utf-8')

@@ -108,3 +109,3 @@ const res = yarnToNpm(path).replace(

t.plan(1)
const path = `${__dirname}/fixtures/deps-with-scopes`
const path = `${fixtures}/deps-with-scopes`
const yarnLock = fs.readFileSync(`${path}/yarn.lock`, 'utf-8')

@@ -142,3 +143,3 @@ const packageLock = fs.readFileSync(`${path}/package-lock.json`, 'utf-8')

t.plan(1)
const path = `${__dirname}/fixtures/deps-with-scopes`
const path = `${fixtures}/deps-with-scopes`
const packageLock = fs.readFileSync(`${path}/package-lock.json`, 'utf-8')

@@ -173,3 +174,3 @@ const res = yarnToNpm(path).replace(

t.plan(1)
const path = `${__dirname}/fixtures/bundled-deps-npm`
const path = `${fixtures}/bundled-deps-npm`
const yarnLock = fs.readFileSync(`${path}/.yarn-lock-snapshot`, 'utf-8')

@@ -191,3 +192,3 @@ const res = npmToYarn(path)

t.plan(1)
const path = `${__dirname}/fixtures/bundled-deps-yarn`
const path = `${fixtures}/bundled-deps-yarn`
const packageLock = fs.readFileSync(

@@ -212,3 +213,3 @@ `${path}/.package-lock-snapshot.json`,

t.plan(1)
const path = `${__dirname}/fixtures/github-dep-yarn`
const path = `${fixtures}/github-dep-yarn`
const packageLock = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -230,3 +231,3 @@ const res = yarnToNpm(path)

t.plan(1)
const path = `${__dirname}/fixtures/yarn-crlf`
const path = `${fixtures}/yarn-crlf`
const packageLock = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -248,3 +249,3 @@ const res = yarnToNpm(path)

t.plan(1)
const path = `${__dirname}/fixtures/single-dep-corrupted-version`
const path = `${fixtures}/single-dep-corrupted-version`
const yarnLock = fs.readFileSync(`${path}/.yarn-lock-snapshot`, 'utf-8')

@@ -268,3 +269,3 @@ const res = npmToYarn(path)

try {
const path = `${__dirname}/fixtures/foo`
const path = `${fixtures}/foo`
t.throws(

@@ -289,3 +290,3 @@ () => npmToYarn(path),

try {
const path = `${__dirname}/fixtures/no-package-json`
const path = `${fixtures}/no-package-json`
t.throws(

@@ -310,3 +311,3 @@ () => npmToYarn(path),

try {
const path = `${__dirname}/fixtures/no-source-files`
const path = `${fixtures}/no-source-files`
t.throws(

@@ -331,3 +332,3 @@ () => npmToYarn(path),

try {
const path = `${__dirname}/fixtures/yarn-workspace`
const path = `${fixtures}/yarn-workspace`
const warning = 'Workspace (npm lockfile v2) support is experimental. Pass `--with-workspaces` flag to enable and cross your fingers. Good luck!'

@@ -359,3 +360,3 @@

t.plan(1)
const path = `${__dirname}/fixtures/integrity-is-absent`
const path = `${fixtures}/integrity-is-absent`
const yarnLockSnap = fs.readFileSync(`${path}/.yarn-lock-snapshot`, 'utf-8')

@@ -378,3 +379,3 @@ const yarnLock = npmToYarn(path)

t.plan(2)
const path = `${__dirname}/fixtures/integrity-mix`
const path = `${fixtures}/integrity-mix`
const packageLockSnap = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -408,3 +409,3 @@ const yarnLockSnap = fs.readFileSync(`${path}/.yarn-lock-snapshot`, 'utf-8')

t.plan(1)
const path = `${__dirname}/fixtures/tarball-deps`
const path = `${fixtures}/tarball-deps`
const packageLock = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -426,3 +427,3 @@ const res = yarnToNpm(path)

t.plan(1)
const path = `${__dirname}/fixtures/git-deps`
const path = `${fixtures}/git-deps`
const packageLock = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -444,3 +445,3 @@ const res = yarnToNpm(path)

t.plan(1)
const path = `${__dirname}/fixtures/file-deps-yarn`
const path = `${fixtures}/file-deps-yarn`
const packageLock = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -462,3 +463,3 @@ const res = yarnToNpm(path)

t.plan(1)
const path = `${__dirname}/fixtures/file-deps-npm`
const path = `${fixtures}/file-deps-npm`
const yarnLock = fs.readFileSync(`${path}/.yarn-lock-snapshot`, 'utf-8')

@@ -480,3 +481,3 @@ const res = npmToYarn(path)

t.plan(2)
const path = `${__dirname}/fixtures/yarn-workspace`
const path = `${fixtures}/yarn-workspace`
const packageLockSnap = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -510,3 +511,3 @@ const yarnLockSnap = fs.readFileSync(`${path}/.yarn-lock-snapshot`, 'utf-8')

t.plan(2)
const path = `${__dirname}/fixtures/yarn-workspace-with-cross-refs`
const path = `${fixtures}/yarn-workspace-with-cross-refs`
const packageLockSnap = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -542,3 +543,3 @@ const yarnLockSnap = fs.readFileSync(`${path}/.yarn-lock-snapshot`, 'utf-8')

t.plan(2)
const path = `${__dirname}/fixtures/composite-pkg-version`
const path = `${fixtures}/composite-pkg-version`
const packageLockSnap = fs.readFileSync(`${path}/.package-lock-snapshot.json`, 'utf-8')

@@ -545,0 +546,0 @@ const yarnLockSnap = fs.readFileSync(`${path}/.yarn-lock-snapshot`, 'utf-8')

@@ -42,7 +42,11 @@ 'use strict'

return {
sourceFile,
outputHelp: sinon.spy(),
force
opts () {
return {
sourceFile,
force
}
},
outputHelp: sinon.spy()
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc