git-viewer 3.0.0 → 4.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/dist/server.js +19 -5
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -8803,13 +8803,27 @@ function staticFiles(root, options = {}) {
|
|
|
8803
8803
|
// server.ts
|
|
8804
8804
|
var import_diff2html = __toESM(require_diff2html(), 1);
|
|
8805
8805
|
var exec = promisify(execCallback);
|
|
8806
|
-
var
|
|
8807
|
-
if (!fs2.existsSync(
|
|
8808
|
-
console.error(`Error: Directory does not exist: ${
|
|
8806
|
+
var startDir = process.argv[2] ? path3.resolve(process.argv[2]) : process.cwd();
|
|
8807
|
+
if (!fs2.existsSync(startDir)) {
|
|
8808
|
+
console.error(`Error: Directory does not exist: ${startDir}`);
|
|
8809
8809
|
process.exit(1);
|
|
8810
8810
|
}
|
|
8811
|
-
|
|
8812
|
-
|
|
8811
|
+
function findGitRoot(dir) {
|
|
8812
|
+
let current = dir;
|
|
8813
|
+
while (true) {
|
|
8814
|
+
if (fs2.existsSync(path3.join(current, ".git"))) {
|
|
8815
|
+
return current;
|
|
8816
|
+
}
|
|
8817
|
+
let parent = path3.dirname(current);
|
|
8818
|
+
if (parent === current) {
|
|
8819
|
+
return null;
|
|
8820
|
+
}
|
|
8821
|
+
current = parent;
|
|
8822
|
+
}
|
|
8823
|
+
}
|
|
8824
|
+
var repoDir = findGitRoot(startDir);
|
|
8825
|
+
if (!repoDir) {
|
|
8826
|
+
console.error(`Error: Not a git repository (or any parent): ${startDir}`);
|
|
8813
8827
|
process.exit(1);
|
|
8814
8828
|
}
|
|
8815
8829
|
async function git(args) {
|