🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

git-stack-cli

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-stack-cli - npm Package Compare versions

Comparing version
2.9.8
to
2.9.9
+1
-1
package.json
{
"name": "git-stack-cli",
"version": "2.9.8",
"version": "2.9.9",
"description": "",

@@ -5,0 +5,0 @@ "author": "magus",

@@ -95,2 +95,6 @@ import path from "node:path";

// write latest.json containing latest version
const latest_json = JSON.stringify({ version });
await file.write_text(path.join("latest.json"), latest_json);
// commit homebrew repo changes

@@ -97,0 +101,0 @@ process.chdir(HOMEBREW_DIR);

@@ -164,16 +164,28 @@ import * as React from "react";

const local_version = process.env.CLI_VERSION;
const latest_version = await get_latest_version();
const is_brew_bun_standalone = get_is_brew_bun_standalone();
const timeout_ms = is_finite_value(props.timeoutMs) ? props.timeoutMs : 2 * 1000;
const timeout = get_timeout_fn(timeout_ms, "AutoUpdate timeout");
const latest_version = await timeout(get_latest_version(is_brew_bun_standalone));
patch({ local_version, latest_version, is_brew_bun_standalone });
}
async function get_latest_version() {
const timeout_ms = is_finite_value(props.timeoutMs) ? props.timeoutMs : 2 * 1000;
const timeout = get_timeout_fn(timeout_ms, "AutoUpdate timeout");
const npm_json = await timeout(fetch_json(`https://registry.npmjs.org/${props.name}`));
const maybe_version = npm_json?.["dist-tags"]?.latest;
if (typeof maybe_version === "string") {
return maybe_version;
async function get_latest_version(is_brew_bun_standalone: boolean) {
if (is_brew_bun_standalone) {
// prettier-ignore
const brew_json = await fetch_json("https://raw.githubusercontent.com/magus/homebrew-git-stack/refs/heads/master/latest.json");
const maybe_version = brew_json.version;
if (typeof maybe_version === "string") {
return maybe_version;
}
throw new Error("Unable to retrieve latest version from brew");
} else {
const npm_json = await fetch_json(`https://registry.npmjs.org/${props.name}`);
const maybe_version = npm_json?.["dist-tags"]?.latest;
if (typeof maybe_version === "string") {
return maybe_version;
}
throw new Error("Unable to retrieve latest version from npm");
}
throw new Error("Unable to retrieve latest version from npm");
}

@@ -180,0 +192,0 @@

@@ -31,2 +31,3 @@ import * as React from "react";

const sync_github = state.sync_github;
const labels = argv.label ?? [];

@@ -144,3 +145,3 @@ invariant(branch_name, "branch_name must exist");

// update PR body for all pr groups (not just push_group_list)
const update_pr_body_tasks = [];
const update_pr_tasks = [];
for (let i = 0; i < all_pr_groups.length; i++) {

@@ -151,7 +152,7 @@ const group = all_pr_groups[i];

const task = update_pr_body({ group, selected_url, pr_url_list });
update_pr_body_tasks.push(task);
const task = update_pr({ group, selected_url, pr_url_list, labels });
update_pr_tasks.push(task);
}
await Promise.all(update_pr_body_tasks);
await Promise.all(update_pr_tasks);

@@ -268,2 +269,3 @@ actions.unregister_abort_handler();

draft: argv.draft,
labels,
});

@@ -280,6 +282,7 @@

async function update_pr_body(args: {
async function update_pr(args: {
group: CommitMetadataGroup;
selected_url: string;
pr_url_list: Array<string>;
labels: Array<string>;
}) {

@@ -300,13 +303,26 @@ const { group, selected_url, pr_url_list } = args;

if (update_body === body) {
actions.debug(`Skipping body update ${debug_meta}`);
} else {
actions.debug(`Update body ${debug_meta}`);
const body_changed = update_body !== body;
const needs_labels = args.labels.length > 0;
await github.pr_edit({
branch: group.id,
base: group.base,
body: update_body,
});
if (!body_changed && !needs_labels) {
actions.debug(`Skipping update ${debug_meta}`);
return;
}
actions.debug(`Update PR ${debug_meta}`);
const edit_args: Parameters<typeof github.pr_edit>[0] = {
branch: group.id,
base: group.base,
};
if (body_changed) {
edit_args.body = update_body;
}
if (needs_labels) {
edit_args.add_labels = args.labels;
}
await github.pr_edit(edit_args);
}

@@ -313,0 +329,0 @@

@@ -21,3 +21,3 @@ import yargs from "yargs";

const parsed = await builder
const parsed = builder
.scriptName("git stack")

@@ -126,2 +126,20 @@ .usage("Usage: git stack [command] [options]")

"label": {
type: "array",
alias: ["labels"],
coerce: (label_input: Array<string | number>) => label_input.map((v) => String(v)),
description: [
// force line break
"Apply labels to all PRs in the stack (repeatable)",
"Example: --label backend --label needs-review",
].join("\n"),
},
"draft": {
type: "boolean",
alias: ["d"],
default: false,
description: "Open all PRs as drafts",
},
"verify": {

@@ -147,15 +165,2 @@ type: "boolean",

"draft": {
type: "boolean",
alias: ["d"],
default: false,
description: "Open all PRs as drafts",
},
"revise-sign": {
type: "boolean",
default: true,
description: "Disable GPG signing for git revise with --no-revise-sign",
},
"template": {

@@ -170,2 +175,8 @@ type: "boolean",

},
"revise-sign": {
type: "boolean",
default: true,
description: "Disable GPG signing for git revise with --no-revise-sign",
},
} satisfies YargsOptions;

@@ -172,0 +183,0 @@

export function get_timeout_fn(ms: number, message: string) {
return function timeout<T>(promise: Promise<T>) {
return async function timeout<T>(promise: Promise<T>) {
let id: ReturnType<typeof setTimeout>;

@@ -4,0 +4,0 @@

@@ -124,2 +124,3 @@ import * as React from "react";

draft: boolean;
labels?: Array<string>;
};

@@ -151,2 +152,9 @@

if (args.labels && args.labels.length > 0) {
for (const label of args.labels) {
if (!label) continue;
command_parts.push(`--label="${safe_quote(label)}"`);
}
}
const cli_result = await cli(command_parts);

@@ -166,5 +174,8 @@

body?: string;
add_labels?: Array<string>;
};
export async function pr_edit(args: EditPullRequestArgs) {
// https://cli.github.com/manual/gh_pr_edit
// const state = Store.getState();

@@ -174,3 +185,3 @@ // const actions = state.actions;

if (!args.base && !args.body) {
if (!args.base && !args.body && !(args.add_labels && args.add_labels.length > 0)) {
return;

@@ -193,2 +204,9 @@ }

if (args.add_labels && args.add_labels.length > 0) {
for (const label of args.add_labels) {
if (!label) continue;
command_parts.push(`--add-label="${safe_quote(label)}"`);
}
}
const cli_result = await cli(command_parts);

@@ -195,0 +213,0 @@

Sorry, the diff of this file is too big to display