@rsdoctor/utils 1.1.1 → 1.1.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.
|
@@ -28,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var global_config_exports = {};
|
|
30
30
|
__export(global_config_exports, {
|
|
31
|
-
findRepoRoot: () => findRepoRoot,
|
|
32
31
|
getMcpConfigPath: () => getMcpConfigPath,
|
|
33
32
|
writeMcpPort: () => writeMcpPort
|
|
34
33
|
});
|
|
@@ -36,26 +35,6 @@ module.exports = __toCommonJS(global_config_exports);
|
|
|
36
35
|
var import_fs = __toESM(require("fs"));
|
|
37
36
|
var import_path = __toESM(require("path"));
|
|
38
37
|
var import_os = __toESM(require("os"));
|
|
39
|
-
function findRepoRoot(startPath) {
|
|
40
|
-
let dir = import_path.default.resolve(startPath ?? process.cwd());
|
|
41
|
-
while (dir !== import_path.default.dirname(dir)) {
|
|
42
|
-
if (import_fs.default.existsSync(import_path.default.join(dir, "lerna.json")))
|
|
43
|
-
return dir;
|
|
44
|
-
if (import_fs.default.existsSync(import_path.default.join(dir, "pnpm-workspace.yaml")))
|
|
45
|
-
return dir;
|
|
46
|
-
const pkgPath = import_path.default.join(dir, "package.json");
|
|
47
|
-
if (import_fs.default.existsSync(pkgPath)) {
|
|
48
|
-
const pkg = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf8"));
|
|
49
|
-
if (pkg.workspaces)
|
|
50
|
-
return dir;
|
|
51
|
-
}
|
|
52
|
-
if (import_fs.default.existsSync(import_path.default.join(dir, "yarn.lock")) || import_fs.default.existsSync(import_path.default.join(dir, "pnpm-lock.yaml")) || import_fs.default.existsSync(import_path.default.join(dir, "package-lock.json"))) {
|
|
53
|
-
return dir;
|
|
54
|
-
}
|
|
55
|
-
dir = import_path.default.dirname(dir);
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
38
|
function writeMcpPort(port, builderName) {
|
|
60
39
|
const homeDir = import_os.default.homedir();
|
|
61
40
|
const rsdoctorDir = import_path.default.join(homeDir, ".cache/rsdoctor");
|
|
@@ -84,7 +63,6 @@ function getMcpConfigPath() {
|
|
|
84
63
|
}
|
|
85
64
|
// Annotate the CommonJS export names for ESM import in node:
|
|
86
65
|
0 && (module.exports = {
|
|
87
|
-
findRepoRoot,
|
|
88
66
|
getMcpConfigPath,
|
|
89
67
|
writeMcpPort
|
|
90
68
|
});
|
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import os from "os";
|
|
4
|
-
function findRepoRoot(startPath) {
|
|
5
|
-
let dir = path.resolve(startPath ?? process.cwd());
|
|
6
|
-
while (dir !== path.dirname(dir)) {
|
|
7
|
-
if (fs.existsSync(path.join(dir, "lerna.json")))
|
|
8
|
-
return dir;
|
|
9
|
-
if (fs.existsSync(path.join(dir, "pnpm-workspace.yaml")))
|
|
10
|
-
return dir;
|
|
11
|
-
const pkgPath = path.join(dir, "package.json");
|
|
12
|
-
if (fs.existsSync(pkgPath)) {
|
|
13
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
14
|
-
if (pkg.workspaces)
|
|
15
|
-
return dir;
|
|
16
|
-
}
|
|
17
|
-
if (fs.existsSync(path.join(dir, "yarn.lock")) || fs.existsSync(path.join(dir, "pnpm-lock.yaml")) || fs.existsSync(path.join(dir, "package-lock.json"))) {
|
|
18
|
-
return dir;
|
|
19
|
-
}
|
|
20
|
-
dir = path.dirname(dir);
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
4
|
function writeMcpPort(port, builderName) {
|
|
25
5
|
const homeDir = os.homedir();
|
|
26
6
|
const rsdoctorDir = path.join(homeDir, ".cache/rsdoctor");
|
|
@@ -48,7 +28,6 @@ function getMcpConfigPath() {
|
|
|
48
28
|
return mcpPortFilePath;
|
|
49
29
|
}
|
|
50
30
|
export {
|
|
51
|
-
findRepoRoot,
|
|
52
31
|
getMcpConfigPath,
|
|
53
32
|
writeMcpPort
|
|
54
33
|
};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the root directory of a monorepo or single repository
|
|
3
|
-
* @param {string} startPath - The starting path (usually a subpackage or any folder)
|
|
4
|
-
* @returns {string|null} The root directory path, or null if not found
|
|
5
|
-
*/
|
|
6
|
-
export declare function findRepoRoot(startPath?: string): string | null;
|
|
7
1
|
/**
|
|
8
2
|
* @description Writes the builder port information to mcp.json.
|
|
9
3
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-config.d.ts","sourceRoot":"","sources":["../../../src/common/global-config.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"global-config.d.ts","sourceRoot":"","sources":["../../../src/common/global-config.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,QAwB9D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,WAK/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"lines-and-columns": "2.0.4",
|
|
84
84
|
"rslog": "^1.2.3",
|
|
85
85
|
"strip-ansi": "^6.0.1",
|
|
86
|
-
"@rsdoctor/types": "1.1.
|
|
86
|
+
"@rsdoctor/types": "1.1.2"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@types/babel__code-frame": "7.0.6",
|