@dbx-tools/path 0.1.18 → 0.1.19
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/README.md +8 -8
- package/package.json +3 -3
- package/src/find.ts +2 -2
- package/src/ignore.ts +2 -2
- package/src/match.ts +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @dbx-tools/
|
|
1
|
+
# @dbx-tools/path
|
|
2
2
|
|
|
3
3
|
Node filesystem path toolkit for discovery, matching, ignoring, scanning, and
|
|
4
4
|
watching.
|
|
@@ -19,7 +19,7 @@ Key features:
|
|
|
19
19
|
## Find Files
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
import { find, ignore } from "@dbx-tools/
|
|
22
|
+
import { find, ignore } from "@dbx-tools/path";
|
|
23
23
|
|
|
24
24
|
const files = find
|
|
25
25
|
.findFiles(["workspaces/**/src/**/*.ts"], {
|
|
@@ -38,7 +38,7 @@ should agree with package discovery, barrel generation, or cleanup logic.
|
|
|
38
38
|
## Compile Matchers
|
|
39
39
|
|
|
40
40
|
```ts
|
|
41
|
-
import { match } from "@dbx-tools/
|
|
41
|
+
import { match } from "@dbx-tools/path";
|
|
42
42
|
|
|
43
43
|
const isTest = match.toPathMatcher("**/*.test.ts");
|
|
44
44
|
if (isTest("workspaces/shared/model/test/classify.test.ts")) {
|
|
@@ -53,7 +53,7 @@ tests.
|
|
|
53
53
|
## Reuse Ignore Rules
|
|
54
54
|
|
|
55
55
|
```ts
|
|
56
|
-
import { ignore } from "@dbx-tools/
|
|
56
|
+
import { ignore } from "@dbx-tools/path";
|
|
57
57
|
|
|
58
58
|
const matcher = ignore.ignorePathMatcher({
|
|
59
59
|
generated: true,
|
|
@@ -68,7 +68,7 @@ generated files, build output, VCS metadata, and package-manager output.
|
|
|
68
68
|
## Scan Workspace Packages
|
|
69
69
|
|
|
70
70
|
```ts
|
|
71
|
-
import { scan } from "@dbx-tools/
|
|
71
|
+
import { scan } from "@dbx-tools/path";
|
|
72
72
|
|
|
73
73
|
const options: scan.FileScanOptions = {
|
|
74
74
|
roots: ["workspaces", "example-workspaces"],
|
|
@@ -83,7 +83,7 @@ like synthesis does.
|
|
|
83
83
|
## Watch Files
|
|
84
84
|
|
|
85
85
|
```ts
|
|
86
|
-
import { watch } from "@dbx-tools/
|
|
86
|
+
import { watch } from "@dbx-tools/path";
|
|
87
87
|
|
|
88
88
|
const watcher = watch.watchFiles(["workspaces/**/src/**/*.ts"], {
|
|
89
89
|
ignoreInitial: true,
|
|
@@ -98,7 +98,7 @@ used by the rest of the repo tooling.
|
|
|
98
98
|
## Build Patterns
|
|
99
99
|
|
|
100
100
|
```ts
|
|
101
|
-
import { pattern } from "@dbx-tools/
|
|
101
|
+
import { pattern } from "@dbx-tools/path";
|
|
102
102
|
|
|
103
103
|
const nodeModulesPattern = pattern.directoryNamePattern("node_modules");
|
|
104
104
|
const tsPattern = pattern.fileExtensionPattern("ts");
|
|
@@ -116,4 +116,4 @@ Pattern helpers keep generated glob fragments escaped and consistent.
|
|
|
116
116
|
- `pattern` - escaped directory-name and extension glob fragments.
|
|
117
117
|
|
|
118
118
|
The projen engine uses this package in
|
|
119
|
-
[`@dbx-tools/projen`](
|
|
119
|
+
[`@dbx-tools/projen`](../../../projen).
|
package/package.json
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"chokidar": "^4.0.3",
|
|
15
15
|
"glob": "^10.5.0",
|
|
16
16
|
"minimatch": "^10.2.5",
|
|
17
|
-
"@dbx-tools/core": "0.1.
|
|
18
|
-
"@dbx-tools/shared-core": "0.1.
|
|
17
|
+
"@dbx-tools/core": "0.1.19",
|
|
18
|
+
"@dbx-tools/shared-core": "0.1.19"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.ts",
|
|
21
21
|
"license": "UNLICENSED",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
|
-
"version": "0.1.
|
|
25
|
+
"version": "0.1.19",
|
|
26
26
|
"types": "index.ts",
|
|
27
27
|
"type": "module",
|
|
28
28
|
"exports": {
|
package/src/find.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { object, type Sequence } from "@dbx-tools/shared-core";
|
|
2
2
|
import { globIterateSync, IgnoreLike, type GlobOptionsWithFileTypesUnset } from "glob";
|
|
3
3
|
import { ignorePathMatcher } from "./ignore";
|
|
4
4
|
import { PathMatcher, PathMatchInput, pathMatchTests, toPathMatcher } from "./match";
|
|
@@ -23,7 +23,7 @@ export interface FileFindOptions
|
|
|
23
23
|
* {@link watchFiles} feeds through its matchers.
|
|
24
24
|
*/
|
|
25
25
|
export function findFiles(pattern: string | string[], options?: FileFindOptions): Sequence<string> {
|
|
26
|
-
return
|
|
26
|
+
return object.sequence(globIterateSync(pattern, toGlobOptions(options)));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function toGlobOptions(options: FileFindOptions | undefined): GlobOptionsWithFileTypesUnset {
|
package/src/ignore.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { exec } from "@dbx-tools/core";
|
|
15
|
-
import { functionModule,
|
|
15
|
+
import { functionModule, object, type Sequence } from "@dbx-tools/shared-core";
|
|
16
16
|
import { PathMatcher, PathMatchPredicate, toPathMatcher } from "./match";
|
|
17
17
|
import { directoryNamePattern, fileExtensionPattern } from "./pattern";
|
|
18
18
|
|
|
@@ -171,7 +171,7 @@ function ignoreMatchPredicates(
|
|
|
171
171
|
* @param options - Group toggles; omitted flags default to enabled.
|
|
172
172
|
*/
|
|
173
173
|
export function ignorePatterns(options?: IgnorePatternOptions): Sequence<string> {
|
|
174
|
-
return
|
|
174
|
+
return object.sequence(ignoreMatchPredicates(options)).flatMap(Object.keys).distinct();
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
/**
|
package/src/match.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
-
|
|
10
|
+
object,
|
|
11
11
|
predicate,
|
|
12
12
|
type Predicate,
|
|
13
13
|
type PredicateFunction,
|
|
@@ -39,7 +39,7 @@ function toTest(pattern: PathMatchInput): PathMatchPredicate {
|
|
|
39
39
|
export function pathMatchTests(
|
|
40
40
|
...inputs: readonly (PathMatchInput | null | undefined)[]
|
|
41
41
|
): readonly PathMatchPredicate[] {
|
|
42
|
-
return
|
|
42
|
+
return object.sequence(inputs).nonNull().map(toTest).toArray();
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|