@dbx-tools/path 0.3.28 → 0.3.30
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 +3 -3
- package/src/ignore.ts +10 -24
package/package.json
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"chokidar": "^4.0.3",
|
|
15
15
|
"glob": "^13.0.6",
|
|
16
16
|
"minimatch": "^10.2.5",
|
|
17
|
-
"@dbx-tools/core": "0.3.
|
|
18
|
-
"@dbx-tools/shared-core": "0.3.
|
|
17
|
+
"@dbx-tools/core": "0.3.30",
|
|
18
|
+
"@dbx-tools/shared-core": "0.3.30"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.ts",
|
|
21
21
|
"license": "UNLICENSED",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
|
-
"version": "0.3.
|
|
25
|
+
"version": "0.3.30",
|
|
26
26
|
"types": "index.ts",
|
|
27
27
|
"type": "module",
|
|
28
28
|
"exports": {
|
package/src/ignore.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* @module
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { project } from "@dbx-tools/core";
|
|
20
20
|
import { functionModule, object, type Sequence } from "@dbx-tools/shared-core";
|
|
21
21
|
import { PathMatcher, PathMatchPredicate, toPathMatcher } from "./match";
|
|
22
22
|
import { directoryNamePattern, fileExtensionPattern } from "./pattern";
|
|
@@ -47,34 +47,20 @@ export type IgnorePatternOptions = {
|
|
|
47
47
|
lock?: boolean | "auto";
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
/** Host of the public npm registry; anything else is treated as private. */
|
|
51
|
+
const PUBLIC_NPM_REGISTRY_HOST = "registry.npmjs.org";
|
|
52
|
+
|
|
50
53
|
/**
|
|
51
54
|
* Memoized probe for {@link IgnorePatternOptions.lock} `"auto"`.
|
|
52
55
|
*
|
|
53
|
-
*
|
|
54
|
-
* returns `true` when
|
|
56
|
+
* Resolves the active registry through `@dbx-tools/core`'s
|
|
57
|
+
* {@link project.npmRegistry} and returns `true` when it is not the public npm
|
|
58
|
+
* registry - a lockfile produced against a private mirror pins URLs that other
|
|
59
|
+
* machines cannot reach, so it should not be committed.
|
|
55
60
|
*/
|
|
56
61
|
const lockIgnoreMatchersAutoEnabled = functionModule.memoize(() => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const result = exec.spawnSync(command, ["config", "get", "registry"], {
|
|
60
|
-
stdout: "capture",
|
|
61
|
-
stderr: "ignore",
|
|
62
|
-
stdin: "ignore",
|
|
63
|
-
});
|
|
64
|
-
if (result.exitCode !== 0) continue;
|
|
65
|
-
const output = result.stdout;
|
|
66
|
-
if (output && output.includes("://")) {
|
|
67
|
-
const url = new URL(output);
|
|
68
|
-
if (url.protocol && url.hostname) {
|
|
69
|
-
registryUrl = url;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (registryUrl && registryUrl.hostname !== "registry.npmjs.org") {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
return false;
|
|
62
|
+
const registry = project.npmRegistry();
|
|
63
|
+
return registry !== undefined && registry.hostname !== PUBLIC_NPM_REGISTRY_HOST;
|
|
78
64
|
});
|
|
79
65
|
|
|
80
66
|
/** Resolves whether the lockfile ignore group is enabled for the given options. */
|