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

@ms-cloudpack/path-utilities

Package Overview
Dependencies
Maintainers
2
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/path-utilities - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

5

lib/findPackageRoot.d.ts
/**
* Given an absolute folder path into a package, traverse up the paths
* until the root has been found (containing the package.json file.)
* until the root has been found (containing the package.json file).
* Returns undefined if no package root is found after traversing to the filesystem root.
*/
export declare function findPackageRoot(currentPath: string): string;
export declare function findPackageRoot(currentPath: string): string | undefined;

9

lib/findPackageRoot.js

@@ -5,6 +5,11 @@ import fs from 'fs';

* Given an absolute folder path into a package, traverse up the paths
* until the root has been found (containing the package.json file.)
* until the root has been found (containing the package.json file).
* Returns undefined if no package root is found after traversing to the filesystem root.
*/
export function findPackageRoot(currentPath) {
while (currentPath && !fs.existsSync(path.join(currentPath, 'package.json'))) {
const root = path.parse(currentPath).root;
while (!fs.existsSync(path.join(currentPath, 'package.json'))) {
if (currentPath === root) {
return undefined;
}
currentPath = path.join(currentPath, '..');

@@ -11,0 +16,0 @@ }

{
"name": "@ms-cloudpack/path-utilities",
"version": "2.0.2",
"version": "2.1.0",
"description": "Utilities for resolving paths between source/intermediate/output locations in Cloudpack.",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

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