@tablation/crew 0.1.6 → 0.1.7
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 +17 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2793,6 +2793,12 @@ function gitOk(cwd, args) {
|
|
|
2793
2793
|
return null;
|
|
2794
2794
|
}
|
|
2795
2795
|
}
|
|
2796
|
+
function commitDate(cwd, sha) {
|
|
2797
|
+
const out = gitOk(cwd, ["show", "-s", "--format=%cI", sha]);
|
|
2798
|
+
if (!out) return null;
|
|
2799
|
+
const t = new Date(out);
|
|
2800
|
+
return Number.isNaN(t.getTime()) ? null : t.toISOString();
|
|
2801
|
+
}
|
|
2796
2802
|
var currentBranch = (cwd) => git(cwd, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
2797
2803
|
var headSha = (cwd) => git(cwd, ["rev-parse", "HEAD"]);
|
|
2798
2804
|
function status(cwd) {
|
|
@@ -4980,7 +4986,10 @@ function planStamp(cwd, tickets, contract, fromSha, toSha, merged = /* @__PURE__
|
|
|
4980
4986
|
return null;
|
|
4981
4987
|
}).filter((p) => p !== null);
|
|
4982
4988
|
}
|
|
4983
|
-
|
|
4989
|
+
function mergedAtFor(cwd, sha, fallback) {
|
|
4990
|
+
return cwd && commitDate(cwd, sha) || fallback;
|
|
4991
|
+
}
|
|
4992
|
+
async function applyStamp(tracker, plan, version, contract, emit, dryRun, cwd) {
|
|
4984
4993
|
let stamped = 0;
|
|
4985
4994
|
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
4986
4995
|
for (const { ticket, sha } of plan) {
|
|
@@ -5000,10 +5009,9 @@ async function applyStamp(tracker, plan, version, contract, emit, dryRun) {
|
|
|
5000
5009
|
...version ? { released_version: version } : {},
|
|
5001
5010
|
// Written here rather than only on the external path (below): a
|
|
5002
5011
|
// ticket's record should mean the same thing regardless of which
|
|
5003
|
-
// release mode closed it (ISSUE-218). `merged_at` is
|
|
5004
|
-
//
|
|
5005
|
-
|
|
5006
|
-
...sha ? { commit_sha: sha, merged_at: at } : {}
|
|
5012
|
+
// release mode closed it (ISSUE-218). `merged_at` is the commit's own
|
|
5013
|
+
// date, not the stamp time (which trails the deploy in ci_* modes).
|
|
5014
|
+
...sha ? { commit_sha: sha, merged_at: mergedAtFor(cwd, sha, at) } : {}
|
|
5007
5015
|
});
|
|
5008
5016
|
emit.emit(`stamped ${contract.statuses.deployed}${version ? ` (${version})` : ""}${shaNote}`, {
|
|
5009
5017
|
ticket: ticket.issue_id
|
|
@@ -5015,7 +5023,7 @@ async function applyStamp(tracker, plan, version, contract, emit, dryRun) {
|
|
|
5015
5023
|
}
|
|
5016
5024
|
return stamped;
|
|
5017
5025
|
}
|
|
5018
|
-
async function applyExternalClosures(tracker, closures, contract, emit, dryRun) {
|
|
5026
|
+
async function applyExternalClosures(tracker, closures, contract, emit, dryRun, cwd) {
|
|
5019
5027
|
if (!closures?.length) return 0;
|
|
5020
5028
|
let stamped = 0;
|
|
5021
5029
|
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5030,7 +5038,7 @@ async function applyExternalClosures(tracker, closures, contract, emit, dryRun)
|
|
|
5030
5038
|
try {
|
|
5031
5039
|
await tracker.updateTicket(ticket.id, {
|
|
5032
5040
|
commit_sha: closure.mergedAt,
|
|
5033
|
-
merged_at: at,
|
|
5041
|
+
merged_at: mergedAtFor(cwd, closure.mergedAt, at),
|
|
5034
5042
|
...confirmed ? { status: contract.statuses.deployed, released_at: at, ...version ? { released_version: version } : {} } : {}
|
|
5035
5043
|
});
|
|
5036
5044
|
emit.emit(`stamped commit_sha (${closure.mergedAt.slice(0, 8)})${shippedNote}`, { ticket: ticket.issue_id });
|
|
@@ -8822,12 +8830,12 @@ ${changed2.map((c) => ` - ${c}
|
|
|
8822
8830
|
outcome.decision.head,
|
|
8823
8831
|
new Map(outcome.merged.map((m) => [m.ticket.issue_id, m.sha]))
|
|
8824
8832
|
);
|
|
8825
|
-
if (plan.length) await applyStamp(tracker, plan, outcome.version, tracker.contract, remit, dryRun);
|
|
8833
|
+
if (plan.length) await applyStamp(tracker, plan, outcome.version, tracker.contract, remit, dryRun, target.dir);
|
|
8826
8834
|
} else if (outcome.stopped) {
|
|
8827
8835
|
remit.emit(`nothing stamped \u2014 ${outcome.stopped}`);
|
|
8828
8836
|
}
|
|
8829
8837
|
if (outcome.externalClosures?.length) {
|
|
8830
|
-
await applyExternalClosures(tracker, outcome.externalClosures, tracker.contract, remit, dryRun);
|
|
8838
|
+
await applyExternalClosures(tracker, outcome.externalClosures, tracker.contract, remit, dryRun, target.dir);
|
|
8831
8839
|
}
|
|
8832
8840
|
const news = describeRelease(outcome, scope);
|
|
8833
8841
|
if (news) {
|
package/package.json
CHANGED