@pnpm/workspace.projects-reader 1101.0.18 → 1101.0.20
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/CHANGELOG.md +21 -0
- package/lib/findPackages.d.ts +7 -0
- package/lib/findPackages.js +56 -0
- package/lib/index.d.ts +20 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @pnpm/find-workspace-packages
|
|
2
2
|
|
|
3
|
+
## 1101.0.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- @pnpm/cli.utils@1101.0.20
|
|
9
|
+
- @pnpm/types@1101.7.0
|
|
10
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.21
|
|
11
|
+
|
|
12
|
+
## 1101.0.19
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Republished every package: the tarballs published by the v11.13.1 through v11.16.0 releases were missing most of their compiled files due to a packing bug [#13164](https://github.com/pnpm/pnpm/issues/13164).
|
|
17
|
+
|
|
18
|
+
- Updated dependencies:
|
|
19
|
+
- @pnpm/cli.utils@1101.0.19
|
|
20
|
+
- @pnpm/constants@1100.0.1
|
|
21
|
+
- @pnpm/types@1101.6.0
|
|
22
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.20
|
|
23
|
+
|
|
3
24
|
## 1101.0.18
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import util from 'node:util';
|
|
4
|
+
import { lexCompare } from '@pnpm/util.lex-comparator';
|
|
5
|
+
import { readExactProjectManifest } from '@pnpm/workspace.project-manifest-reader';
|
|
6
|
+
import pFilter from 'p-filter';
|
|
7
|
+
import { glob } from 'tinyglobby';
|
|
8
|
+
const DEFAULT_IGNORE = [
|
|
9
|
+
'**/node_modules/**',
|
|
10
|
+
'**/bower_components/**',
|
|
11
|
+
'**/test/**',
|
|
12
|
+
'**/tests/**',
|
|
13
|
+
];
|
|
14
|
+
export async function findPackages(root, opts) {
|
|
15
|
+
opts = opts ?? {};
|
|
16
|
+
const globOpts = { ...opts, cwd: root, expandDirectories: false };
|
|
17
|
+
globOpts.ignore = opts.ignore ?? DEFAULT_IGNORE;
|
|
18
|
+
const patterns = normalizePatterns(opts.patterns ?? ['.', '**']);
|
|
19
|
+
delete globOpts.patterns;
|
|
20
|
+
const paths = await glob(patterns, globOpts);
|
|
21
|
+
if (opts.includeRoot) {
|
|
22
|
+
// Always include the workspace root (https://github.com/pnpm/pnpm/issues/1986)
|
|
23
|
+
paths.push(...(await glob(normalizePatterns(['.']), globOpts)));
|
|
24
|
+
}
|
|
25
|
+
return pFilter(
|
|
26
|
+
// `Array.from()` doesn't create an intermediate instance,
|
|
27
|
+
// unlike `array.map()`
|
|
28
|
+
Array.from(
|
|
29
|
+
// Remove duplicate paths using `Set`
|
|
30
|
+
new Set(paths
|
|
31
|
+
.map(manifestPath => path.join(root, manifestPath))
|
|
32
|
+
.sort((path1, path2) => lexCompare(path.dirname(path1), path.dirname(path2)))), async (manifestPath) => {
|
|
33
|
+
try {
|
|
34
|
+
const rootDir = path.dirname(manifestPath);
|
|
35
|
+
return {
|
|
36
|
+
rootDir,
|
|
37
|
+
rootDirRealPath: await fs.realpath(rootDir),
|
|
38
|
+
...await readExactProjectManifest(manifestPath),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
if (util.types.isNativeError(err) && 'code' in err && err.code === 'ENOENT') {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
}), Boolean);
|
|
48
|
+
}
|
|
49
|
+
function normalizePatterns(patterns) {
|
|
50
|
+
const normalizedPatterns = [];
|
|
51
|
+
for (const pattern of patterns) {
|
|
52
|
+
normalizedPatterns.push(pattern.replace(/\/?$/, '/package.{json,yaml,json5}'));
|
|
53
|
+
}
|
|
54
|
+
return normalizedPatterns;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=findPackages.js.map
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Project, SupportedArchitectures } from '@pnpm/types';
|
|
2
|
+
export { findPackages, type FindPackagesOptions } from './findPackages.js';
|
|
3
|
+
export type { Project };
|
|
4
|
+
export interface FindWorkspaceProjectsOpts {
|
|
5
|
+
/**
|
|
6
|
+
* An array of globs for the packages included in the workspace.
|
|
7
|
+
*
|
|
8
|
+
* In most cases, callers should read the pnpm-workspace.yml and pass the
|
|
9
|
+
* "packages" field.
|
|
10
|
+
*/
|
|
11
|
+
patterns?: string[];
|
|
12
|
+
engineStrict?: boolean;
|
|
13
|
+
nodeVersion?: string;
|
|
14
|
+
sharedWorkspaceLockfile?: boolean;
|
|
15
|
+
supportedArchitectures?: SupportedArchitectures;
|
|
16
|
+
}
|
|
17
|
+
export declare function findWorkspaceProjects(workspaceRoot: string, opts?: FindWorkspaceProjectsOpts): Promise<Project[]>;
|
|
18
|
+
export declare function findWorkspaceProjectsNoCheck(workspaceRoot: string, opts?: {
|
|
19
|
+
patterns?: string[];
|
|
20
|
+
}): Promise<Project[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/workspace.projects-reader",
|
|
3
|
-
"version": "1101.0.
|
|
3
|
+
"version": "1101.0.20",
|
|
4
4
|
"description": "Finds packages inside a workspace",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"!*.map"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@pnpm/cli.utils": "1101.0.
|
|
31
|
-
"@pnpm/constants": "1100.0.
|
|
32
|
-
"@pnpm/types": "1101.
|
|
30
|
+
"@pnpm/cli.utils": "1101.0.20",
|
|
31
|
+
"@pnpm/constants": "1100.0.1",
|
|
32
|
+
"@pnpm/types": "1101.7.0",
|
|
33
33
|
"@pnpm/util.lex-comparator": "^4.0.1",
|
|
34
|
-
"@pnpm/workspace.project-manifest-reader": "1100.0.
|
|
34
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.21",
|
|
35
35
|
"p-filter": "^4.1.0",
|
|
36
|
-
"tinyglobby": "^0.2.
|
|
36
|
+
"tinyglobby": "^0.2.17"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@pnpm/logger": "^1100.0.0"
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@jest/globals": "30.4.1",
|
|
43
43
|
"@pnpm/logger": "1100.0.0",
|
|
44
|
-
"@pnpm/workspace.projects-reader": "1101.0.
|
|
45
|
-
"@pnpm/workspace.workspace-manifest-reader": "1100.1.
|
|
44
|
+
"@pnpm/workspace.projects-reader": "1101.0.20",
|
|
45
|
+
"@pnpm/workspace.workspace-manifest-reader": "1100.1.3"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=22.13"
|