@joshski/dust 0.1.80 → 0.1.81
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/bucket/repository-git.d.ts +2 -0
- package/dist/bucket/repository.d.ts +1 -0
- package/dist/dust.js +25 -11
- package/package.json +1 -1
|
@@ -11,10 +11,12 @@ import type { CommandDependencies } from '../cli/types';
|
|
|
11
11
|
export declare function getRepoPath(repoName: string, reposDir: string): string;
|
|
12
12
|
/**
|
|
13
13
|
* Clone a repository to a temporary directory.
|
|
14
|
+
* Tries HTTPS first, falls back to SSH if available and HTTPS fails.
|
|
14
15
|
*/
|
|
15
16
|
export declare function cloneRepository(repository: {
|
|
16
17
|
name: string;
|
|
17
18
|
gitUrl: string;
|
|
19
|
+
gitSshUrl?: string;
|
|
18
20
|
}, targetPath: string, spawn: typeof nodeSpawn, context: CommandDependencies['context']): Promise<boolean>;
|
|
19
21
|
/**
|
|
20
22
|
* Remove a repository directory.
|
package/dist/dust.js
CHANGED
|
@@ -318,7 +318,7 @@ async function loadSettings(cwd, fileSystem) {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
// lib/version.ts
|
|
321
|
-
var DUST_VERSION = "0.1.
|
|
321
|
+
var DUST_VERSION = "0.1.81";
|
|
322
322
|
|
|
323
323
|
// lib/session.ts
|
|
324
324
|
var DUST_UNATTENDED = "DUST_UNATTENDED";
|
|
@@ -2481,9 +2481,9 @@ function getRepoPath(repoName, reposDir) {
|
|
|
2481
2481
|
const safeName = repoName.replace(/[^a-zA-Z0-9-_/]/g, "-");
|
|
2482
2482
|
return join7(reposDir, safeName);
|
|
2483
2483
|
}
|
|
2484
|
-
|
|
2484
|
+
function cloneWithUrl(url, targetPath, spawn) {
|
|
2485
2485
|
return new Promise((resolve) => {
|
|
2486
|
-
const proc = spawn("git", ["clone",
|
|
2486
|
+
const proc = spawn("git", ["clone", url, targetPath], {
|
|
2487
2487
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2488
2488
|
env: {
|
|
2489
2489
|
...process.env,
|
|
@@ -2496,19 +2496,30 @@ async function cloneRepository(repository, targetPath, spawn, context) {
|
|
|
2496
2496
|
stderr += data.toString();
|
|
2497
2497
|
});
|
|
2498
2498
|
proc.on("close", (code) => {
|
|
2499
|
-
|
|
2500
|
-
resolve(true);
|
|
2501
|
-
} else {
|
|
2502
|
-
context.stderr(`Failed to clone ${repository.name}: ${stderr.trim()}`);
|
|
2503
|
-
resolve(false);
|
|
2504
|
-
}
|
|
2499
|
+
resolve({ success: code === 0, stderr: stderr.trim() });
|
|
2505
2500
|
});
|
|
2506
2501
|
proc.on("error", (error) => {
|
|
2507
|
-
|
|
2508
|
-
resolve(false);
|
|
2502
|
+
resolve({ success: false, stderr: error.message });
|
|
2509
2503
|
});
|
|
2510
2504
|
});
|
|
2511
2505
|
}
|
|
2506
|
+
async function cloneRepository(repository, targetPath, spawn, context) {
|
|
2507
|
+
const httpsResult = await cloneWithUrl(repository.gitUrl, targetPath, spawn);
|
|
2508
|
+
if (httpsResult.success) {
|
|
2509
|
+
return true;
|
|
2510
|
+
}
|
|
2511
|
+
if (repository.gitSshUrl) {
|
|
2512
|
+
context.stderr(`HTTPS clone failed for ${repository.name}, trying SSH: ${httpsResult.stderr}`);
|
|
2513
|
+
const sshResult = await cloneWithUrl(repository.gitSshUrl, targetPath, spawn);
|
|
2514
|
+
if (sshResult.success) {
|
|
2515
|
+
return true;
|
|
2516
|
+
}
|
|
2517
|
+
context.stderr(`Failed to clone ${repository.name} via SSH: ${sshResult.stderr}`);
|
|
2518
|
+
return false;
|
|
2519
|
+
}
|
|
2520
|
+
context.stderr(`Failed to clone ${repository.name}: ${httpsResult.stderr}`);
|
|
2521
|
+
return false;
|
|
2522
|
+
}
|
|
2512
2523
|
async function removeRepository(path, spawn, context) {
|
|
2513
2524
|
return new Promise((resolve) => {
|
|
2514
2525
|
const proc = spawn("rm", ["-rf", path], {
|
|
@@ -3693,6 +3704,9 @@ function parseServerMessage(data) {
|
|
|
3693
3704
|
url: repo.url,
|
|
3694
3705
|
hasTask: repo.hasTask
|
|
3695
3706
|
};
|
|
3707
|
+
if (typeof repo.gitSshUrl === "string") {
|
|
3708
|
+
item.gitSshUrl = repo.gitSshUrl;
|
|
3709
|
+
}
|
|
3696
3710
|
if (typeof repo.agentProvider === "string") {
|
|
3697
3711
|
item.agentProvider = repo.agentProvider;
|
|
3698
3712
|
}
|