enablement-build-manifest 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/workspace.mjs +10 -5
- package/tests/workspace.test.mjs +7 -2
package/package.json
CHANGED
package/src/workspace.mjs
CHANGED
|
@@ -28,15 +28,20 @@ export function parseWorkspacePatterns(content) {
|
|
|
28
28
|
return patterns;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
// Extract unique
|
|
31
|
+
// Extract unique literal directory prefixes from workspace glob patterns,
|
|
32
|
+
// keeping every leading path segment up to (but not including) the first
|
|
33
|
+
// segment that contains a glob character.
|
|
32
34
|
// e.g. ['packages/*', 'apps/**'] → ['packages', 'apps']
|
|
35
|
+
// e.g. ['ux/apps/*', 'ux/components/*'] → ['ux/apps', 'ux/components']
|
|
33
36
|
export function extractDirsFromPatterns(patterns) {
|
|
34
37
|
const dirs = new Set();
|
|
35
38
|
for (const pattern of patterns) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.trim();
|
|
39
|
+
const literalSegments = [];
|
|
40
|
+
for (const segment of pattern.split("/")) {
|
|
41
|
+
if (/[*?[\]{}]/.test(segment)) break;
|
|
42
|
+
literalSegments.push(segment.trim());
|
|
43
|
+
}
|
|
44
|
+
const dir = literalSegments.join("/").trim();
|
|
40
45
|
if (dir) dirs.add(dir);
|
|
41
46
|
}
|
|
42
47
|
return [...dirs];
|
package/tests/workspace.test.mjs
CHANGED
|
@@ -68,8 +68,13 @@ describe('extractDirsFromPatterns', () => {
|
|
|
68
68
|
expect(extractDirsFromPatterns(['*'])).toEqual([]);
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
it('
|
|
72
|
-
expect(extractDirsFromPatterns(['components/ui/**'])).toEqual(['components']);
|
|
71
|
+
it('preserves the full literal prefix for a deep glob', () => {
|
|
72
|
+
expect(extractDirsFromPatterns(['components/ui/**'])).toEqual(['components/ui']);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('preserves nested literal prefixes and dedupes per full prefix', () => {
|
|
76
|
+
const result = extractDirsFromPatterns(['ux/apps/*', 'ux/components/*', 'ux/apps/**']);
|
|
77
|
+
expect(result).toEqual(['ux/apps', 'ux/components']);
|
|
73
78
|
});
|
|
74
79
|
});
|
|
75
80
|
|