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

@metamask/action-utils

Package Overview
Dependencies
Maintainers
9
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/action-utils - npm Package Compare versions

Comparing version 0.0.2 to 1.0.0

CHANGELOG.md

3

dist/package-utils.d.ts

@@ -90,4 +90,5 @@ export declare enum ManifestDependencyFieldNames {

* @param rootDir - The monorepo root directory.
* @param recursive - Whether to search recursively.
* @returns The location of each workspace directory relative to the root directory
*/
export declare function getWorkspaceLocations(workspaces: string[], rootDir: string): Promise<string[]>;
export declare function getWorkspaceLocations(workspaces: string[], rootDir: string, recursive?: boolean, prefix?: string): Promise<string[]>;

@@ -170,9 +170,32 @@ "use strict";

* @param rootDir - The monorepo root directory.
* @param recursive - Whether to search recursively.
* @returns The location of each workspace directory relative to the root directory
*/
async function getWorkspaceLocations(workspaces, rootDir) {
const resolvedWorkspaces = await Promise.all(workspaces.map((pattern) => glob(pattern, { cwd: rootDir })));
return resolvedWorkspaces.flat();
async function getWorkspaceLocations(workspaces, rootDir, recursive = false, prefix = '') {
const resolvedWorkspaces = await workspaces.reduce(async (promise, pattern) => {
const array = await promise;
const matches = (await glob(pattern, { cwd: rootDir })).map((match) => path_1.default.join(prefix, match));
return [...array, ...matches];
}, Promise.resolve([]));
if (recursive) {
// This reads all the package JSON files in each workspace, checks if they are a monorepo, and
// recursively calls `getWorkspaceLocations` if they are.
const resolvedSubWorkspaces = await resolvedWorkspaces.reduce(async (promise, workspacePath) => {
const array = await promise;
const rawManifest = await getPackageManifest(workspacePath);
if (ManifestFieldNames.Workspaces in rawManifest) {
const manifest = validatePackageManifestVersion(rawManifest, workspacePath);
const monorepoManifest = validateMonorepoPackageManifest(manifest, workspacePath);
return [
...array,
...(await getWorkspaceLocations(monorepoManifest[ManifestFieldNames.Workspaces], workspacePath, recursive, workspacePath)),
];
}
return array;
}, Promise.resolve(resolvedWorkspaces));
return resolvedSubWorkspaces;
}
return resolvedWorkspaces;
}
exports.getWorkspaceLocations = getWorkspaceLocations;
//# sourceMappingURL=package-utils.js.map
{
"name": "@metamask/action-utils",
"version": "0.0.2",
"version": "1.0.0",
"description": "Utilities for MetaMask's GitHub Actions.",

@@ -18,2 +18,6 @@ "publishConfig": {

"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/action-utils.git"
},
"scripts": {

@@ -38,6 +42,6 @@ "setup": "yarn install && yarn allow-scripts",

"@lavamoat/allow-scripts": "^1.0.5",
"@metamask/eslint-config": "^6.0.0",
"@metamask/eslint-config-jest": "^6.0.0",
"@metamask/eslint-config-nodejs": "^6.0.0",
"@metamask/eslint-config-typescript": "^6.0.0",
"@metamask/eslint-config": "^7.0.1",
"@metamask/eslint-config-jest": "^7.0.0",
"@metamask/eslint-config-nodejs": "^7.0.1",
"@metamask/eslint-config-typescript": "^7.0.1",
"@types/glob": "^7.1.3",

@@ -44,0 +48,0 @@ "@types/jest": "^26.0.13",

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