|
1 |
| -import { glob } from 'glob'; |
| 1 | +import { resolve } from 'path'; |
| 2 | +import { getWorkspaceLocations } from '@metamask/action-utils'; |
2 | 3 | import { WriteStreamLike } from './fs';
|
3 | 4 | import {
|
4 | 5 | Package,
|
5 | 6 | readMonorepoRootPackage,
|
6 | 7 | readMonorepoWorkspacePackage,
|
7 | 8 | } from './package';
|
8 |
| -import { PackageManifestFieldNames } from './package-manifest'; |
9 | 9 | import { getRepositoryHttpsUrl, getTagNames } from './repo';
|
10 | 10 | import { SemVer } from './semver';
|
| 11 | +import { PackageManifestFieldNames } from './package-manifest'; |
11 | 12 |
|
12 | 13 | /**
|
13 | 14 | * The release version of the root package of a monorepo extracted from its
|
@@ -90,24 +91,17 @@ export async function readProject(
|
90 | 91 | rootPackage.validatedManifest.version,
|
91 | 92 | );
|
92 | 93 |
|
93 |
| - const workspaceDirectories = ( |
94 |
| - await Promise.all( |
95 |
| - rootPackage.validatedManifest[PackageManifestFieldNames.Workspaces].map( |
96 |
| - async (workspacePattern) => { |
97 |
| - return await glob(workspacePattern, { |
98 |
| - cwd: projectDirectoryPath, |
99 |
| - absolute: true, |
100 |
| - }); |
101 |
| - }, |
102 |
| - ), |
103 |
| - ) |
104 |
| - ).flat(); |
| 94 | + const workspaceDirectories = await getWorkspaceLocations( |
| 95 | + rootPackage.validatedManifest[PackageManifestFieldNames.Workspaces], |
| 96 | + projectDirectoryPath, |
| 97 | + true, |
| 98 | + ); |
105 | 99 |
|
106 | 100 | const workspacePackages = (
|
107 | 101 | await Promise.all(
|
108 | 102 | workspaceDirectories.map(async (directory) => {
|
109 | 103 | return await readMonorepoWorkspacePackage({
|
110 |
| - packageDirectoryPath: directory, |
| 104 | + packageDirectoryPath: resolve(projectDirectoryPath, directory), |
111 | 105 | rootPackageName: rootPackage.validatedManifest.name,
|
112 | 106 | rootPackageVersion: rootPackage.validatedManifest.version,
|
113 | 107 | projectDirectoryPath,
|
|
0 commit comments