Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dbux/common-node

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dbux/common-node - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4-dev.1

src/util/memUtil.js

6

package.json
{
"name": "@dbux/common-node",
"version": "0.6.3",
"version": "0.6.4-dev.1",
"description": "",

@@ -12,3 +12,3 @@ "module": "src/index.js",

"dependencies": {
"@dbux/common": "^0.6.3",
"@dbux/common": "^0.6.4-dev.1",
"adm-zip": "^0.5.9",

@@ -30,3 +30,3 @@ "colors": "^1.4.0",

"_moduleAliases": {},
"gitHead": "92dd244aa0d1c7b4dd230b2d538be1db0383b7c2"
"gitHead": "68ae661ec58644650c06aa807748d1551d4b2cc1"
}
import sh from 'shelljs';
import fs from 'fs';
import path from 'path';
import commonAncestorPath from 'common-ancestor-path';
import { homedir } from 'os';
import _commonAncestorPath from 'common-ancestor-path';
import EmptyObject from '@dbux/common/src/util/EmptyObject';

@@ -71,17 +72,2 @@

export function parseNodeModuleName(fpath) {
fpath = pathNormalized(fpath);
const matchResult = fpath.match(/(?<=node_modules[/])(?!node_modules)(?<packageName>[^/]+)(?=[/](?!node_modules)(?<name2>[^/]+).*?)/);
let { packageName, name2 } = matchResult?.groups || EmptyObject;
if (!packageName) {
return null;
}
if (packageName.startsWith('@') && name2) {
// only a prefix
packageName += '/' + name2;
// console.warn('module match:', packageName, name2);
}
return packageName || null;
}
export function getPathRelativeToCommonAncestor(fpath, ...otherPaths) {

@@ -100,3 +86,6 @@ const common = getCommonAncestorPath(fpath, ...otherPaths);

export function getCommonAncestorPath(...paths) {
return commonAncestorPath(...paths);
// NOTE: the library requires OS-specific separators
paths = paths.map(p => path.resolve(p));
const result = _commonAncestorPath(...paths);
return pathNormalized(result);
}

@@ -108,1 +97,9 @@

}
export function renderPath(fpath) {
const home = homedir();
if (fpath.startsWith(home)) {
fpath = '~' + fpath.substring(home.length);
}
return fpath;
}
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