gitfleet 1.0.2 ā 1.1.1
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/bin/gitfleet.js +3 -3
- package/commands/init.js +2 -2
- package/commands/scan.js +6 -4
- package/core/config.js +11 -30
- package/package.json +2 -2
package/bin/gitfleet.js
CHANGED
|
@@ -21,9 +21,9 @@ program
|
|
|
21
21
|
|
|
22
22
|
program
|
|
23
23
|
.command("init")
|
|
24
|
-
.option("--scan", "Scan
|
|
25
|
-
.action(
|
|
26
|
-
|
|
24
|
+
.option("--scan", "Scan repositories")
|
|
25
|
+
.action(init);
|
|
26
|
+
|
|
27
27
|
program
|
|
28
28
|
.command("add <path>")
|
|
29
29
|
.description("Add repository to fleet")
|
package/commands/init.js
CHANGED
|
@@ -3,7 +3,7 @@ const path = require("path");
|
|
|
3
3
|
|
|
4
4
|
const scan = require("./scan");
|
|
5
5
|
|
|
6
|
-
function init(
|
|
6
|
+
function init(options) {
|
|
7
7
|
|
|
8
8
|
const dir = path.join(process.cwd(), ".gitfleet");
|
|
9
9
|
|
|
@@ -22,7 +22,7 @@ function init(args = []) {
|
|
|
22
22
|
|
|
23
23
|
console.log("ā GitFleet workspace initialized");
|
|
24
24
|
|
|
25
|
-
if (
|
|
25
|
+
if (options.scan) {
|
|
26
26
|
console.log("\nš Scanning for git repositories...\n");
|
|
27
27
|
scan(process.cwd());
|
|
28
28
|
}
|
package/commands/scan.js
CHANGED
|
@@ -12,14 +12,16 @@ function findRepos(dir, repos = []) {
|
|
|
12
12
|
const fullPath = path.join(dir, item.name);
|
|
13
13
|
|
|
14
14
|
if (item.name === ".git") {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
repos.push(dir);
|
|
16
|
+
continue;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
if (
|
|
19
|
+
if (
|
|
20
|
+
item.isDirectory() &&
|
|
21
|
+
!["node_modules", ".git", ".gitfleet"].includes(item.name)
|
|
22
|
+
) {
|
|
20
23
|
findRepos(fullPath, repos);
|
|
21
24
|
}
|
|
22
|
-
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
return repos;
|
package/core/config.js
CHANGED
|
@@ -1,45 +1,26 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const os = require("os");
|
|
4
3
|
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
while (dir !== path.dirname(dir)) {
|
|
9
|
-
const configDir = path.join(dir, ".gitfleet");
|
|
10
|
-
|
|
11
|
-
if (fs.existsSync(configDir)) {
|
|
12
|
-
return path.join(configDir, "config.json");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
dir = path.dirname(dir);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function globalConfigPath() {
|
|
22
|
-
return path.join(os.homedir(), ".gitfleet", "config.json");
|
|
4
|
+
function getConfigPath() {
|
|
5
|
+
return path.join(process.cwd(), ".gitfleet", "config.json");
|
|
23
6
|
}
|
|
24
7
|
|
|
25
8
|
function loadConfig() {
|
|
26
|
-
const
|
|
9
|
+
const configPath = getConfigPath();
|
|
27
10
|
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
11
|
+
if (!fs.existsSync(configPath)) {
|
|
12
|
+
return { repos: [] };
|
|
30
13
|
}
|
|
31
14
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (fs.existsSync(global)) {
|
|
35
|
-
return JSON.parse(fs.readFileSync(global));
|
|
36
|
-
}
|
|
15
|
+
return JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
16
|
+
}
|
|
37
17
|
|
|
38
|
-
|
|
18
|
+
function saveConfig(config) {
|
|
19
|
+
const configPath = getConfigPath();
|
|
20
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
39
21
|
}
|
|
40
22
|
|
|
41
23
|
module.exports = {
|
|
42
24
|
loadConfig,
|
|
43
|
-
|
|
44
|
-
globalConfigPath
|
|
25
|
+
saveConfig
|
|
45
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitfleet",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"chalk": "^5.6.2",
|
|
17
17
|
"commander": "^14.0.3",
|
|
18
18
|
"ora": "^9.3.0",
|
|
19
|
-
"p-limit": "^
|
|
19
|
+
"p-limit": "^3.1.0"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
22
|
"gitfleet": "./bin/gitfleet.js"
|