staklink 0.3.13 → 0.3.15
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/proxy-server.cjs +36 -4
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
package/dist/proxy-server.cjs
CHANGED
|
@@ -33608,6 +33608,33 @@ var Repo = class {
|
|
|
33608
33608
|
`git checkout -f $(git remote show origin | sed -n '/HEAD branch/s/.*: //p')`
|
|
33609
33609
|
);
|
|
33610
33610
|
}
|
|
33611
|
+
async branchExists(branch) {
|
|
33612
|
+
try {
|
|
33613
|
+
const localCheck = await this.execCommand(`git show-ref --verify --quiet refs/heads/${branch}`).catch(() => null);
|
|
33614
|
+
if (localCheck !== null) {
|
|
33615
|
+
return true;
|
|
33616
|
+
}
|
|
33617
|
+
const remoteCheck = await this.execCommand(`git ls-remote --heads origin ${branch}`).catch(() => "");
|
|
33618
|
+
return remoteCheck.trim().length > 0;
|
|
33619
|
+
} catch (e) {
|
|
33620
|
+
return false;
|
|
33621
|
+
}
|
|
33622
|
+
}
|
|
33623
|
+
async generateUniqueBranchName(baseBranchName) {
|
|
33624
|
+
let branchName = baseBranchName;
|
|
33625
|
+
while (await this.branchExists(branchName)) {
|
|
33626
|
+
const parts = branchName.split("-");
|
|
33627
|
+
const lastPart = parts[parts.length - 1];
|
|
33628
|
+
const num = parseInt(lastPart, 10);
|
|
33629
|
+
if (!isNaN(num) && lastPart === num.toString()) {
|
|
33630
|
+
parts[parts.length - 1] = (num + 1).toString();
|
|
33631
|
+
branchName = parts.join("-");
|
|
33632
|
+
} else {
|
|
33633
|
+
branchName = `${branchName}-2`;
|
|
33634
|
+
}
|
|
33635
|
+
}
|
|
33636
|
+
return branchName;
|
|
33637
|
+
}
|
|
33611
33638
|
async checkoutNew(branch) {
|
|
33612
33639
|
return this.execCommand(`git checkout -b ${branch}`);
|
|
33613
33640
|
}
|
|
@@ -33901,7 +33928,7 @@ var SSEManager = class {
|
|
|
33901
33928
|
var sseManager = new SSEManager();
|
|
33902
33929
|
|
|
33903
33930
|
// src/proxy/version.ts
|
|
33904
|
-
var VERSION = "0.3.
|
|
33931
|
+
var VERSION = "0.3.15";
|
|
33905
33932
|
|
|
33906
33933
|
// node_modules/uuid/dist/esm/stringify.js
|
|
33907
33934
|
var byteToHex = [];
|
|
@@ -80311,11 +80338,16 @@ async function startProxyServer() {
|
|
|
80311
80338
|
const isOnMain = await repo.isOnMainBranch();
|
|
80312
80339
|
const isOnBaseBranch = await repo.isOnBranch(r.base_branch);
|
|
80313
80340
|
if (isOnMain || isOnBaseBranch) {
|
|
80314
|
-
|
|
80315
|
-
|
|
80341
|
+
const uniqueBranchName = await repo.generateUniqueBranchName(r.branch_name);
|
|
80342
|
+
if (uniqueBranchName !== r.branch_name) {
|
|
80343
|
+
console.log(`=> Branch ${r.branch_name} exists, using ${uniqueBranchName} instead`);
|
|
80344
|
+
}
|
|
80345
|
+
console.log(`=> CHECKOUT to new branch: ${uniqueBranchName}`);
|
|
80346
|
+
await repo.checkoutNew(uniqueBranchName);
|
|
80316
80347
|
}
|
|
80317
80348
|
await repo.addAll();
|
|
80318
|
-
|
|
80349
|
+
const currentBranch = (await repo.printCurrentBranch()).trim();
|
|
80350
|
+
console.log(`=> COMMIT to ${r.url} on branch: ${currentBranch}`);
|
|
80319
80351
|
await repo.commitWithCredentials(r.commit_name, code.git_credentials);
|
|
80320
80352
|
}
|
|
80321
80353
|
console.log(`=> PUSH to ${r.url}`);
|
package/dist/staklink-cli.cjs
CHANGED
|
@@ -10905,7 +10905,7 @@ var glob = Object.assign(glob_, {
|
|
|
10905
10905
|
glob.glob = glob;
|
|
10906
10906
|
|
|
10907
10907
|
// src/proxy/version.ts
|
|
10908
|
-
var VERSION = "0.3.
|
|
10908
|
+
var VERSION = "0.3.15";
|
|
10909
10909
|
|
|
10910
10910
|
// src/cli.ts
|
|
10911
10911
|
var STAKLINK_PROXY = "staklink-proxy";
|