git0 0.3.35 → 0.3.36
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/cli.js +40 -34
- package/dist/cli.js.map +7 -7
- package/package.json +1 -1
- package/src/fm.js +22 -6
- package/src/github-api.ts +18 -4
- package/src/ide.ts +3 -3
- package/src/install.ts +2 -3
- package/src/utils.ts +12 -2
- package/test/cli.test.ts +51 -0
- package/test/download-package.test.ts +153 -0
- package/test/exec.test.ts +38 -0
- package/test/fm.test.ts +990 -0
- package/test/github-api-http.test.ts +159 -0
- package/test/helpers/fake-shell.ts +47 -0
- package/test/ide.test.ts +114 -0
- package/test/install.test.ts +132 -0
package/dist/cli.js
CHANGED
|
@@ -27511,6 +27511,13 @@ function parseTarget(query) {
|
|
|
27511
27511
|
subPathType: parsed.filepathtype || ""
|
|
27512
27512
|
};
|
|
27513
27513
|
}
|
|
27514
|
+
function toReleaseList(response) {
|
|
27515
|
+
if (Array.isArray(response))
|
|
27516
|
+
return response;
|
|
27517
|
+
if (Array.isArray(response?.data))
|
|
27518
|
+
return response.data;
|
|
27519
|
+
return [];
|
|
27520
|
+
}
|
|
27514
27521
|
|
|
27515
27522
|
class GithubAPI {
|
|
27516
27523
|
static DEFAULT_RESULTS_PER_PAGE = 10;
|
|
@@ -27557,7 +27564,7 @@ class GithubAPI {
|
|
|
27557
27564
|
if (!getReleaseInfo)
|
|
27558
27565
|
return response.items;
|
|
27559
27566
|
return Promise.all(response.items.map(async (repo) => {
|
|
27560
|
-
const releases = await this.callGithub(`/repos/${repo.owner.login}/${repo.name}/releases`);
|
|
27567
|
+
const releases = toReleaseList(await this.callGithub(`/repos/${repo.owner.login}/${repo.name}/releases`));
|
|
27561
27568
|
const platform = getCurrentPlatform();
|
|
27562
27569
|
return {
|
|
27563
27570
|
...repo,
|
|
@@ -27591,20 +27598,45 @@ class GithubAPI {
|
|
|
27591
27598
|
return getCurrentPlatform();
|
|
27592
27599
|
}
|
|
27593
27600
|
async getReleases(owner, repo) {
|
|
27594
|
-
const releases = await this.callGithub(`/repos/${owner}/${repo}/releases`);
|
|
27601
|
+
const releases = toReleaseList(await this.callGithub(`/repos/${owner}/${repo}/releases`));
|
|
27595
27602
|
return categorizeReleasesByPlatform(releases);
|
|
27596
27603
|
}
|
|
27597
27604
|
async getCompatibleReleases(owner, repo) {
|
|
27598
|
-
const releases = await this.callGithub(`/repos/${owner}/${repo}/releases`);
|
|
27605
|
+
const releases = toReleaseList(await this.callGithub(`/repos/${owner}/${repo}/releases`));
|
|
27599
27606
|
return filterReleasesByPlatform(releases, getCurrentPlatform());
|
|
27600
27607
|
}
|
|
27601
27608
|
}
|
|
27602
27609
|
var github_api_default = GithubAPI;
|
|
27603
27610
|
|
|
27604
27611
|
// src/ide.ts
|
|
27605
|
-
import { execSync, spawn as spawn2 } from "child_process";
|
|
27606
27612
|
import fs3 from "fs";
|
|
27607
27613
|
import path3 from "path";
|
|
27614
|
+
|
|
27615
|
+
// src/utils.ts
|
|
27616
|
+
import { execSync, spawn as spawn2 } from "child_process";
|
|
27617
|
+
var shell = { execSync, spawn: spawn2 };
|
|
27618
|
+
var logoPrinted = false;
|
|
27619
|
+
function printLogo() {
|
|
27620
|
+
if (logoPrinted)
|
|
27621
|
+
return;
|
|
27622
|
+
logoPrinted = true;
|
|
27623
|
+
console.log(source_default.cyan(` ___
|
|
27624
|
+
__ _(_)‾|_ / _ \\
|
|
27625
|
+
/ _ | | __| | | |
|
|
27626
|
+
| (_| | | |_| |_| |
|
|
27627
|
+
\\__, |_|\\__|\\___/
|
|
27628
|
+
|___/`));
|
|
27629
|
+
}
|
|
27630
|
+
function exec(cmd, showError = false) {
|
|
27631
|
+
try {
|
|
27632
|
+
shell.execSync(cmd, { stdio: "inherit" });
|
|
27633
|
+
} catch {
|
|
27634
|
+
if (showError)
|
|
27635
|
+
console.error(source_default.red(`❌ Failed: ${cmd}`));
|
|
27636
|
+
}
|
|
27637
|
+
}
|
|
27638
|
+
|
|
27639
|
+
// src/ide.ts
|
|
27608
27640
|
var SUPPORTED_IDES = [
|
|
27609
27641
|
{ name: "Antigravity", cmd: "antigravity" },
|
|
27610
27642
|
{ name: "Cursor", cmd: "cursor" },
|
|
@@ -27618,7 +27650,7 @@ function getInstalledIde() {
|
|
|
27618
27650
|
const probe = process.platform === "win32" ? (cmd) => `where ${cmd}` : (cmd) => `command -v ${cmd}`;
|
|
27619
27651
|
for (const ide of SUPPORTED_IDES) {
|
|
27620
27652
|
try {
|
|
27621
|
-
execSync(probe(ide.cmd), { stdio: "ignore" });
|
|
27653
|
+
shell.execSync(probe(ide.cmd), { stdio: "ignore" });
|
|
27622
27654
|
return ide;
|
|
27623
27655
|
} catch {
|
|
27624
27656
|
continue;
|
|
@@ -27639,7 +27671,7 @@ function findEntryDocument(dir = ".") {
|
|
|
27639
27671
|
return candidates.find((p2) => fs3.existsSync(p2)) ?? null;
|
|
27640
27672
|
}
|
|
27641
27673
|
function spawnDetached(ide, args) {
|
|
27642
|
-
|
|
27674
|
+
shell.spawn(ide.cmd, args, {
|
|
27643
27675
|
detached: true,
|
|
27644
27676
|
stdio: "ignore",
|
|
27645
27677
|
shell: process.platform === "win32"
|
|
@@ -27663,36 +27695,10 @@ function openInIDE(targetDir) {
|
|
|
27663
27695
|
}
|
|
27664
27696
|
|
|
27665
27697
|
// src/install.ts
|
|
27666
|
-
import { execSync as execSync3 } from "child_process";
|
|
27667
27698
|
import fs4 from "fs";
|
|
27668
|
-
|
|
27669
|
-
// src/utils.ts
|
|
27670
|
-
import { execSync as execSync2 } from "child_process";
|
|
27671
|
-
var logoPrinted = false;
|
|
27672
|
-
function printLogo() {
|
|
27673
|
-
if (logoPrinted)
|
|
27674
|
-
return;
|
|
27675
|
-
logoPrinted = true;
|
|
27676
|
-
console.log(source_default.cyan(` ___
|
|
27677
|
-
__ _(_)‾|_ / _ \\
|
|
27678
|
-
/ _ | | __| | | |
|
|
27679
|
-
| (_| | | |_| |_| |
|
|
27680
|
-
\\__, |_|\\__|\\___/
|
|
27681
|
-
|___/`));
|
|
27682
|
-
}
|
|
27683
|
-
function exec(cmd, showError = false) {
|
|
27684
|
-
try {
|
|
27685
|
-
execSync2(cmd, { stdio: "inherit" });
|
|
27686
|
-
} catch {
|
|
27687
|
-
if (showError)
|
|
27688
|
-
console.error(source_default.red(`❌ Failed: ${cmd}`));
|
|
27689
|
-
}
|
|
27690
|
-
}
|
|
27691
|
-
|
|
27692
|
-
// src/install.ts
|
|
27693
27699
|
function bunAvailable() {
|
|
27694
27700
|
try {
|
|
27695
|
-
|
|
27701
|
+
shell.execSync(process.platform === "win32" ? "where bun" : "command -v bun", { stdio: "ignore" });
|
|
27696
27702
|
return true;
|
|
27697
27703
|
} catch {
|
|
27698
27704
|
return false;
|
|
@@ -28018,5 +28024,5 @@ main().catch((error) => {
|
|
|
28018
28024
|
process.exit(1);
|
|
28019
28025
|
});
|
|
28020
28026
|
|
|
28021
|
-
//# debugId=
|
|
28027
|
+
//# debugId=27EF4299FE24EFE164756E2164756E21
|
|
28022
28028
|
//# sourceMappingURL=cli.js.map
|