@pnpm/workspace.filter-packages-from-dir 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
4
+ Copyright (c) 2016-2024 Zoltan Kochan and other contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @pnpm/workspace.filter-packages-from-dir
2
+
3
+ > Filters packages in a directory
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@pnpm/workspace.filter-packages-from-dir.svg)](https://www.npmjs.com/package/@pnpm/workspace.filter-packages-from-dir)
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pnpm add @pnpm/workspace.filter-packages-from-dir
11
+ ```
12
+
13
+ ## License
14
+
15
+ MIT
package/lib/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { type SupportedArchitectures } from '@pnpm/types';
2
+ import { type PackageSelector, type ReadProjectsResult } from '@pnpm/filter-workspace-packages';
3
+ export declare function filterPackagesFromDir(workspaceDir: string, pkgSelectors: PackageSelector[], opts?: {
4
+ engineStrict?: boolean;
5
+ linkWorkspacePackages?: boolean;
6
+ changedFilesIgnorePattern?: string[];
7
+ supportedArchitectures?: SupportedArchitectures;
8
+ }): Promise<ReadProjectsResult>;
package/lib/index.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterPackagesFromDir = void 0;
4
+ const workspace_find_packages_1 = require("@pnpm/workspace.find-packages");
5
+ const workspace_read_manifest_1 = require("@pnpm/workspace.read-manifest");
6
+ const filter_workspace_packages_1 = require("@pnpm/filter-workspace-packages");
7
+ async function filterPackagesFromDir(workspaceDir, pkgSelectors, opts) {
8
+ const workspaceManifest = await (0, workspace_read_manifest_1.readWorkspaceManifest)(workspaceDir);
9
+ const allProjects = await (0, workspace_find_packages_1.findWorkspacePackages)(workspaceDir, {
10
+ patterns: workspaceManifest?.packages,
11
+ engineStrict: opts?.engineStrict,
12
+ supportedArchitectures: opts?.supportedArchitectures ?? {
13
+ os: ['current'],
14
+ cpu: ['current'],
15
+ libc: ['current'],
16
+ },
17
+ });
18
+ const { allProjectsGraph, selectedProjectsGraph } = await (0, filter_workspace_packages_1.filterPkgsBySelectorObjects)(allProjects, pkgSelectors, {
19
+ linkWorkspacePackages: opts?.linkWorkspacePackages,
20
+ workspaceDir,
21
+ changedFilesIgnorePattern: opts?.changedFilesIgnorePattern,
22
+ });
23
+ return { allProjects, allProjectsGraph, selectedProjectsGraph };
24
+ }
25
+ exports.filterPackagesFromDir = filterPackagesFromDir;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,2EAAqE;AACrE,2EAAqE;AACrE,+EAA4H;AAErH,KAAK,UAAU,qBAAqB,CACzC,YAAoB,EACpB,YAA+B,EAC/B,IAKC;IAED,MAAM,iBAAiB,GAAG,MAAM,IAAA,+CAAqB,EAAC,YAAY,CAAC,CAAA;IACnE,MAAM,WAAW,GAAG,MAAM,IAAA,+CAAqB,EAAC,YAAY,EAAE;QAC5D,QAAQ,EAAE,iBAAiB,EAAE,QAAQ;QACrC,YAAY,EAAE,IAAI,EAAE,YAAY;QAChC,sBAAsB,EAAE,IAAI,EAAE,sBAAsB,IAAI;YACtD,EAAE,EAAE,CAAC,SAAS,CAAC;YACf,GAAG,EAAE,CAAC,SAAS,CAAC;YAChB,IAAI,EAAE,CAAC,SAAS,CAAC;SAClB;KACF,CAAC,CAAA;IACF,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,GAAG,MAAM,IAAA,uDAA2B,EACnF,WAAW,EACX,YAAY,EACZ;QACE,qBAAqB,EAAE,IAAI,EAAE,qBAAqB;QAClD,YAAY;QACZ,yBAAyB,EAAE,IAAI,EAAE,yBAAyB;KAC3D,CACF,CAAA;IACD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,CAAA;AACjE,CAAC;AA9BD,sDA8BC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@pnpm/workspace.filter-packages-from-dir",
3
+ "version": "1.0.0",
4
+ "description": "Filters packages in a directory",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "!*.map"
10
+ ],
11
+ "engines": {
12
+ "node": ">=18.12"
13
+ },
14
+ "repository": "https://github.com/pnpm/pnpm/blob/main/workspace/filter-packages-from-dir",
15
+ "keywords": [
16
+ "pnpm9",
17
+ "pnpm"
18
+ ],
19
+ "license": "MIT",
20
+ "bugs": {
21
+ "url": "https://github.com/pnpm/pnpm/issues"
22
+ },
23
+ "homepage": "https://github.com/pnpm/pnpm/blob/main/workspace/filter-packages-from-dir#readme",
24
+ "dependencies": {
25
+ "@pnpm/filter-workspace-packages": "9.0.0",
26
+ "@pnpm/workspace.find-packages": "3.0.0",
27
+ "@pnpm/workspace.read-manifest": "2.1.0"
28
+ },
29
+ "devDependencies": {
30
+ "@pnpm/types": "10.1.1",
31
+ "@pnpm/workspace.filter-packages-from-dir": "1.0.0"
32
+ },
33
+ "funding": "https://opencollective.com/pnpm",
34
+ "exports": {
35
+ ".": "./lib/index.js"
36
+ },
37
+ "scripts": {
38
+ "lint": "eslint \"src/**/*.ts\"",
39
+ "test": "pnpm run compile",
40
+ "compile": "tsc --build && pnpm run lint --fix"
41
+ }
42
+ }