@tama-create/sf-tools 1.4.0-dev.15 → 1.4.0-dev.17

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.
@@ -229,7 +229,7 @@ export function statusLines(input, paint) {
229
229
  if (st.next === "none" || i < nidx)
230
230
  return paint.green(`✓ ${t}`);
231
231
  if (i === nidx)
232
- return paint.boldCyan(st.pr !== "" ? `▸ ${t} (PR #${st.pr} 発行中)` : `▸ ${t} (次のPR)`);
232
+ return paint.boldCyan(st.pr !== "" ? `▸ ${t} (PR #${st.pr} 発行中)` : nidx === 0 ? `▸ ${t} (次のPR・このコミットは未リリース)` : `▸ ${t} (次のPR)`);
233
233
  return paint.dim(`× ${t}`);
234
234
  })
235
235
  .join(` ${paint.dim("⇒")} `);
package/dist/core/pr.js CHANGED
@@ -178,6 +178,11 @@ export async function runPr(args, box, deps, ask) {
178
178
  box.output.err(` ✗ ${t}`);
179
179
  }
180
180
  box.output.err("");
181
+ // 次の PR 先の理由: 印は「このコミット」に付くため、新しいコミットを積むと、前のコミットが出済みでも、最初の段階から出し直しになる
182
+ if (!plan.skipped && plan.next !== "none" && plan.prOpen === "" && plan.tiers[0] === plan.next) {
183
+ const short = head !== null && head.code === 0 ? ` ${head.stdout.trim().slice(0, 7)}` : "";
184
+ log("INFO", `この先端のコミット${short}は、まだ ${plan.next} に出ていません(新しいコミットを積むと、前のコミットが出済みでも、${plan.tiers.join(" → ")} の順に、最初の段階から出します)。`);
185
+ }
181
186
  if (plan.skipped) {
182
187
  log("INFO", "ターゲットファイル(deploy-target.txt・remove-target.txt)に対象がないため、出すものがありません。");
183
188
  return EXIT.ok;
@@ -13,6 +13,8 @@ const BRANCH_LIST_FILE = "sf-tools/config/branches.txt";
13
13
  /** 表示用の判定(--quick)が、直近に取得した時刻(ミリ秒)と手元のブランチを残すファイル(git 管理外)。60 秒以内なら、git fetch を省く */
14
14
  const FETCH_STAMP = "./sf-tools/logs/last-fetch.txt";
15
15
  const FETCH_FRESH_MS = 60_000;
16
+ /** 表示用の判定で、git・gh の 1 回の呼び出しに許す時間(ミリ秒) */
17
+ const QUICK_CALL_MS = 45_000;
16
18
  /** 起動でき、終了コードが 0 だったか(起動できなかったときは null) */
17
19
  function succeeded(r) {
18
20
  return r !== null && r.code === 0;
@@ -130,8 +132,10 @@ export async function runPromoteCheck(args, box, deps) {
130
132
  const worktrees = [];
131
133
  try {
132
134
  log("HEADER", "一方通行のリリースを確かめます (sf-promote-check)");
133
- const git = async (...a) => box.run("git", a);
134
- const gh = async (...a) => box.run("gh", a);
135
+ // 表示用(--quick)は、固まらないよう、1 回の呼び出しに時間の上限を付ける(超えたら判断できない扱い)
136
+ const limit = quick ? { timeoutMs: QUICK_CALL_MS } : undefined;
137
+ const git = async (...a) => box.run("git", a, limit);
138
+ const gh = async (...a) => box.run("gh", a, limit);
135
139
  const must = async (r, why) => {
136
140
  let got;
137
141
  try {
@@ -20,6 +20,8 @@ export function comparable(text) {
20
20
  .replace(/(前回の結果。更新中…)/g, "(前回の結果)")
21
21
  .replace(/ {2}(更新中…)/g, "");
22
22
  }
23
+ /** 「更新中」の表示(Branch の行) */
24
+ const UPDATING = /更新中…/;
23
25
  const LINE = "──────────────────────────────────────────────────";
24
26
  const readOrNull = (box, path) => {
25
27
  try {
@@ -72,6 +74,8 @@ export async function runLauncher(args, box, deps) {
72
74
  };
73
75
  /** 最後に描いた内容(comparable)。変わらないときは、タイマーによる描き直しを省く */
74
76
  let lastDrawn = "";
77
+ /** 最後に描いた内容(色つき)。「更新中」が画面に残っているかを見る */
78
+ let lastRaw = "";
75
79
  /** onlyIfChanged: 描く内容が前回と同じなら、何も出さない(判定は動かす)。描いたかどうかを返す */
76
80
  const draw = async (onlyIfChanged = false) => {
77
81
  const st = await box.run("git", ["status", "--porcelain=v2", "--branch"]).catch(() => null);
@@ -149,10 +153,13 @@ export async function runLauncher(args, box, deps) {
149
153
  block.push(` ${paint.cyan(`[${i + 1}]`)} ${paint.bold(item.label.padEnd(11))} ${paint.dim(item.description)}`);
150
154
  });
151
155
  block.push(paint.dim(` ${LINE}`));
152
- const same = comparable(block.join("\n"));
153
- if (onlyIfChanged && same === lastDrawn)
154
- return false; // 画面が変わらないのに、メニューを流さない
156
+ const raw = block.join("\n");
157
+ const same = comparable(raw);
158
+ // 画面が変わらないのに、メニューを流さない。ただし、画面に「更新中」が残っているときは、消すために描き直す(残すと、終わったあとも更新中に見える)
159
+ if (onlyIfChanged && same === lastDrawn && (raw === lastRaw || UPDATING.test(raw) || !UPDATING.test(lastRaw)))
160
+ return false;
155
161
  lastDrawn = same;
162
+ lastRaw = raw;
156
163
  for (const l of block)
157
164
  err(l);
158
165
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tama-create/sf-tools",
3
- "version": "1.4.0-dev.15",
3
+ "version": "1.4.0-dev.17",
4
4
  "description": "Salesforce 開発の環境構築と毎日の作業を自動化する(TypeScript 版・開発中)",
5
5
  "license": "Unlicense",
6
6
  "repository": {