putitoutthere 0.3.11 → 0.3.13
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.d.ts.map +1 -1
- package/dist/cli.js +25 -21
- package/dist/cli.js.map +1 -1
- package/dist/emit-release-outputs.d.ts +22 -0
- package/dist/emit-release-outputs.d.ts.map +1 -0
- package/dist/emit-release-outputs.js +35 -0
- package/dist/emit-release-outputs.js.map +1 -0
- package/dist/handlers/crates.d.ts +12 -14
- package/dist/handlers/crates.d.ts.map +1 -1
- package/dist/handlers/crates.js +43 -50
- package/dist/handlers/crates.js.map +1 -1
- package/dist/handlers/pypi.d.ts +12 -9
- package/dist/handlers/pypi.d.ts.map +1 -1
- package/dist/handlers/pypi.js +20 -18
- package/dist/handlers/pypi.js.map +1 -1
- package/dist/publish-progress.d.ts +25 -0
- package/dist/publish-progress.d.ts.map +1 -0
- package/dist/publish-progress.js +33 -0
- package/dist/publish-progress.js.map +1 -0
- package/dist/publish.d.ts +4 -1
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +37 -3
- package/dist/publish.js.map +1 -1
- package/dist/reconcile.d.ts +17 -6
- package/dist/reconcile.d.ts.map +1 -1
- package/dist/reconcile.js +31 -11
- package/dist/reconcile.js.map +1 -1
- package/dist/replace-cargo-version.d.ts +35 -0
- package/dist/replace-cargo-version.d.ts.map +1 -0
- package/dist/replace-cargo-version.js +71 -0
- package/dist/replace-cargo-version.js.map +1 -0
- package/dist/repo-relative-paths.d.ts +27 -0
- package/dist/repo-relative-paths.d.ts.map +1 -0
- package/dist/repo-relative-paths.js +40 -0
- package/dist/repo-relative-paths.js.map +1 -0
- package/dist/types.d.ts +26 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/write-resolved-cargo-version.js +1 -1
- package/dist/write-resolved-cargo-version.js.map +1 -1
- package/package.json +1 -1
package/dist/handlers/pypi.js
CHANGED
|
@@ -18,21 +18,24 @@
|
|
|
18
18
|
* `pypa/gh-action-pypi-publish` from the consumer's own workflow
|
|
19
19
|
* context (where both `repository` and `job_workflow_ref` align with
|
|
20
20
|
* the consumer's repo + their TP registration). The reusable workflow
|
|
21
|
-
* still emits the matrix
|
|
22
|
-
*
|
|
21
|
+
* still emits the matrix and builds artifacts; the upload moves, and
|
|
22
|
+
* with it the package's git tag (#623) — a tag records what shipped, so
|
|
23
|
+
* it belongs to the job that actually ships it.
|
|
23
24
|
*
|
|
24
25
|
* The handler therefore:
|
|
25
26
|
* - `isPublished`: unchanged. Public PyPI HEAD; no auth needed.
|
|
26
27
|
* - `writeVersion`: unchanged. Rewrites `[project].version` in-place
|
|
27
28
|
* or logs a SETUPTOOLS_SCM hint for dynamic-version projects.
|
|
28
|
-
* - `publish`: NO upload. Returns `{ status: '
|
|
29
|
-
* `publish.ts`
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* - `publish`: NO upload. Returns `{ status: 'delegated' }`, which
|
|
30
|
+
* `publish.ts` deliberately does NOT tag (#623). The upload runs in
|
|
31
|
+
* the caller's `pypi-publish` job via `pypa/gh-action-pypi-publish`;
|
|
32
|
+
* the tag is cut afterwards, from that same job, once PyPI confirms
|
|
33
|
+
* the version is live. Reporting `published` here used to cut the tag
|
|
34
|
+
* at the moment of delegation, so any later failure in the run — a
|
|
35
|
+
* different registry, a different package — left a tag on the remote
|
|
36
|
+
* naming a distribution nobody had uploaded.
|
|
34
37
|
*
|
|
35
|
-
* Issue #17. Plan: §6.4, §12.2, §12.3, §13.1, §14.5, §16.1.
|
|
38
|
+
* Issue #17, #623. Plan: §6.4, §12.2, §12.3, §13.1, §14.5, §16.1.
|
|
36
39
|
*/
|
|
37
40
|
import { readFile } from 'node:fs/promises';
|
|
38
41
|
import { join } from 'node:path';
|
|
@@ -128,20 +131,19 @@ async function publishImpl(pkg, version, ctx) {
|
|
|
128
131
|
return { status: 'already-published' };
|
|
129
132
|
}
|
|
130
133
|
// No upload from here. The engine's role for PyPI is plan + build +
|
|
131
|
-
// version-rewrite
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
// know there's work to do.
|
|
134
|
+
// version-rewrite — the actual `pypa/gh-action-pypi-publish` call
|
|
135
|
+
// lives in the caller's `pypi-publish` job, where the OIDC claims
|
|
136
|
+
// align with their TP registration. `delegated` is what tells
|
|
137
|
+
// `publish.ts` to hold the tag (#623): nothing is on PyPI yet, and a
|
|
138
|
+
// tag cut here would outlive a run that never reached the upload.
|
|
137
139
|
ctx.log.info([
|
|
138
140
|
`pypi: ${pkg.name}@${version} delegated to caller-side upload step.`,
|
|
139
|
-
' The
|
|
140
|
-
'
|
|
141
|
+
' The upload runs in your `pypi-publish` job via `pypa/gh-action-pypi-publish`;',
|
|
142
|
+
' the git tag is cut there too, after PyPI confirms the version is live.',
|
|
141
143
|
' See README → "Publishing to PyPI" for the recipe.',
|
|
142
144
|
].join('\n'));
|
|
143
145
|
return {
|
|
144
|
-
status: '
|
|
146
|
+
status: 'delegated',
|
|
145
147
|
url: `${REGISTRY}/project/${pypiNameFor(pkg)}/${version}/`,
|
|
146
148
|
};
|
|
147
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pypi.js","sourceRoot":"","sources":["../../src/handlers/pypi.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pypi.js","sourceRoot":"","sources":["../../src/handlers/pypi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO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AAM;IACZ,WAAW,EAAE,eAAe;IAC5B,aAAa,EAAE,iBAAiB;IAChC,YAAY,EAAE,gBAAgB;IAC9B,YAAY,EAAE,gBAAgB;IAC9B,OAAO,EAAE,WAAW;CACrB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carry a failed publish run's partial progress out through the thrown
|
|
3
|
+
* error (#623).
|
|
4
|
+
*
|
|
5
|
+
* `publish()` walks packages in dependency order and throws on the first
|
|
6
|
+
* handler failure, which loses what the packages before it did. That
|
|
7
|
+
* matters for one caller-visible fact: a PyPI package whose upload was
|
|
8
|
+
* `delegated` to a caller-side job needs to be announced on
|
|
9
|
+
* `$GITHUB_OUTPUT` even when a *later*, unrelated package fails — that
|
|
10
|
+
* announcement is what lets the caller's upload job gate on "PyPI's own
|
|
11
|
+
* path succeeded" rather than on whole-job success. Without it, a missing
|
|
12
|
+
* npm scope silently skips the PyPI upload.
|
|
13
|
+
*
|
|
14
|
+
* Attached at the publish boundary and read by the CLI, mirroring the
|
|
15
|
+
* `attachHandlerMeta` / `readHandlerMeta` pair in `types.ts` — an own
|
|
16
|
+
* property on the Error rather than a wrapper, so the handler's own error
|
|
17
|
+
* (its message, its `cause` chain, its attached metadata) reaches the CLI
|
|
18
|
+
* unchanged.
|
|
19
|
+
*/
|
|
20
|
+
import type { PublishOutput } from './publish.js';
|
|
21
|
+
/** Attach the packages processed so far and return the same Error. */
|
|
22
|
+
export declare function attachPublishProgress<E extends Error>(err: E, published: PublishOutput['published']): E;
|
|
23
|
+
/** Read attached progress; `[]` for non-Errors and unannotated Errors. */
|
|
24
|
+
export declare function readPublishProgress(value: unknown): PublishOutput['published'];
|
|
25
|
+
//# sourceMappingURL=publish-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-progress.d.ts","sourceRoot":"","sources":["../src/publish-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAMlD,sEAAsE;AACtE,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,KAAK,EACnD,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,GACpC,CAAC,CAGH;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC,CAG9E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carry a failed publish run's partial progress out through the thrown
|
|
3
|
+
* error (#623).
|
|
4
|
+
*
|
|
5
|
+
* `publish()` walks packages in dependency order and throws on the first
|
|
6
|
+
* handler failure, which loses what the packages before it did. That
|
|
7
|
+
* matters for one caller-visible fact: a PyPI package whose upload was
|
|
8
|
+
* `delegated` to a caller-side job needs to be announced on
|
|
9
|
+
* `$GITHUB_OUTPUT` even when a *later*, unrelated package fails — that
|
|
10
|
+
* announcement is what lets the caller's upload job gate on "PyPI's own
|
|
11
|
+
* path succeeded" rather than on whole-job success. Without it, a missing
|
|
12
|
+
* npm scope silently skips the PyPI upload.
|
|
13
|
+
*
|
|
14
|
+
* Attached at the publish boundary and read by the CLI, mirroring the
|
|
15
|
+
* `attachHandlerMeta` / `readHandlerMeta` pair in `types.ts` — an own
|
|
16
|
+
* property on the Error rather than a wrapper, so the handler's own error
|
|
17
|
+
* (its message, its `cause` chain, its attached metadata) reaches the CLI
|
|
18
|
+
* unchanged.
|
|
19
|
+
*/
|
|
20
|
+
const PROGRESS_KEY = '__piotPublishProgress';
|
|
21
|
+
/** Attach the packages processed so far and return the same Error. */
|
|
22
|
+
export function attachPublishProgress(err, published) {
|
|
23
|
+
err[PROGRESS_KEY] = published;
|
|
24
|
+
return err;
|
|
25
|
+
}
|
|
26
|
+
/** Read attached progress; `[]` for non-Errors and unannotated Errors. */
|
|
27
|
+
export function readPublishProgress(value) {
|
|
28
|
+
if (!(value instanceof Error)) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
return value[PROGRESS_KEY] ?? [];
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=publish-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-progress.js","sourceRoot":"","sources":["../src/publish-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAI7C,sEAAsE;AACtE,MAAM,UAAU,qBAAqB,CACnC,GAAM,EACN,SAAqC;IAEpC,GAAmB,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IAC/C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAAA,OAAO,EAAE,CAAC;IAAA,CAAC;IAC3C,OAAQ,KAAiB,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;AAChD,CAAC"}
|
package/dist/publish.d.ts
CHANGED
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
* targets.
|
|
9
9
|
* 4. For each package (in cascade / depends-on order):
|
|
10
10
|
* writeVersion → handler.publish → git tag + push.
|
|
11
|
-
*
|
|
11
|
+
* A handler that reports `delegated` (pypi, #623) uploaded nothing,
|
|
12
|
+
* so it is deliberately NOT tagged here — see the branch below.
|
|
13
|
+
* 5. On handler failure: verbose dump (#15); attach the partial
|
|
14
|
+
* progress to the error (#623); re-throw and stop.
|
|
12
15
|
*
|
|
13
16
|
* No-push tag model (§13.6): tag points at the merge commit; no bump
|
|
14
17
|
* commit is pushed to main.
|
package/dist/publish.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA6BH,OAAO,EAA6B,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAIzF,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,0BAA0B;IAC1B,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC;CACjD;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,SAAS,EAAE,KAAK,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,aAAa,CAAC;QACtB;;;;;WAKG;QACH,GAAG,EAAE,MAAM,CAAC;KACb,CAAC,CAAC;CACJ;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA8O1E"}
|
package/dist/publish.js
CHANGED
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
* targets.
|
|
9
9
|
* 4. For each package (in cascade / depends-on order):
|
|
10
10
|
* writeVersion → handler.publish → git tag + push.
|
|
11
|
-
*
|
|
11
|
+
* A handler that reports `delegated` (pypi, #623) uploaded nothing,
|
|
12
|
+
* so it is deliberately NOT tagged here — see the branch below.
|
|
13
|
+
* 5. On handler failure: verbose dump (#15); attach the partial
|
|
14
|
+
* progress to the error (#623); re-throw and stop.
|
|
12
15
|
*
|
|
13
16
|
* No-push tag model (§13.6): tag points at the merge commit; no bump
|
|
14
17
|
* commit is pushed to main.
|
|
@@ -26,6 +29,7 @@ import { headCommit } from './git.js';
|
|
|
26
29
|
import { handlerFor as defaultHandlerFor } from './handlers/index.js';
|
|
27
30
|
import { createLogger } from './log.js';
|
|
28
31
|
import { plan } from './plan.js';
|
|
32
|
+
import { attachPublishProgress } from './publish-progress.js';
|
|
29
33
|
import { ensureTag } from './ensure-tag.js';
|
|
30
34
|
import { formatTag } from './tag-template.js';
|
|
31
35
|
import { requireAuth, requireCargoShape, requireCratesMetadata, requirePackageJsonShape, requireProvenanceMetadata, requirePyprojectShape, requirePypiVersionSource, requireRepoPublic, requireRepoUrlMatch, } from './preflight.js';
|
|
@@ -142,6 +146,9 @@ export async function publish(opts) {
|
|
|
142
146
|
}
|
|
143
147
|
// 4. Publish each package in dep-graph order.
|
|
144
148
|
const published = [];
|
|
149
|
+
// Every manifest this run has rewritten, in publish order. See the
|
|
150
|
+
// `managedManifests.add` call below for why this spans the whole run.
|
|
151
|
+
const managedManifests = new Set();
|
|
145
152
|
const head = await headCommit({ cwd });
|
|
146
153
|
const order = publishOrder(config.packages, [...perPackage.keys()]);
|
|
147
154
|
for (const name of order) {
|
|
@@ -174,8 +181,20 @@ export async function publish(opts) {
|
|
|
174
181
|
await ensureTag(pkg.tag_format, name, version, head, { cwd }, log);
|
|
175
182
|
continue;
|
|
176
183
|
}
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
// #639: the crates handler's dirty-tree guard needs to know which
|
|
185
|
+
// manifests the bump landed in — for a crate that inherits its
|
|
186
|
+
// version that is the workspace root, outside the package directory.
|
|
187
|
+
//
|
|
188
|
+
// Accumulated across the whole run, not per package: two crates
|
|
189
|
+
// inheriting from the same root both bump that one file, so the root
|
|
190
|
+
// is still dirty from the first when the second publishes — and it is
|
|
191
|
+
// no more a stray edit then than it was then. The guard exists to
|
|
192
|
+
// catch files putitoutthere did NOT write.
|
|
193
|
+
for (const written of await handler.writeVersion(pkg, version, ctx)) {
|
|
194
|
+
managedManifests.add(written);
|
|
195
|
+
}
|
|
196
|
+
const publishCtx = { ...ctx, managedManifestPaths: [...managedManifests] };
|
|
197
|
+
const result = await withRetry(() => handler.publish(pkg, version, publishCtx));
|
|
179
198
|
published.push({
|
|
180
199
|
package: name,
|
|
181
200
|
version,
|
|
@@ -188,9 +207,24 @@ export async function publish(opts) {
|
|
|
188
207
|
// (`gh release create --generate-notes` after this step). The
|
|
189
208
|
// engine cuts the tag and stops.
|
|
190
209
|
}
|
|
210
|
+
else if (result.status === 'delegated') {
|
|
211
|
+
// #623: no tag. The handler did not upload — pypi's upload runs
|
|
212
|
+
// in the caller's `pypi-publish` job — so nothing is on the
|
|
213
|
+
// registry to record yet. Tagging here would survive a run that
|
|
214
|
+
// never reached the upload, and a tag naming a version that was
|
|
215
|
+
// never published is only removable by hand. The caller-side job
|
|
216
|
+
// cuts it once the registry confirms the version is live.
|
|
217
|
+
log.info(`publish: ${name}@${version} delegated; tag ${formatTag(pkg.tag_format, { name, version })} ` +
|
|
218
|
+
`is cut by the job that performs the upload, not here.`);
|
|
219
|
+
}
|
|
191
220
|
}
|
|
192
221
|
catch (err) {
|
|
193
222
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
223
|
+
// #623: carry what the earlier packages did out through the throw.
|
|
224
|
+
// A delegated PyPI upload announced by a run that later failed on
|
|
225
|
+
// an unrelated registry is exactly the fact the caller-side upload
|
|
226
|
+
// job needs; losing it is what let a missing npm scope skip PyPI.
|
|
227
|
+
attachPublishProgress(error, published);
|
|
194
228
|
// Phase 2 / Idea 9: handler-attached metadata (tool versions, etc.)
|
|
195
229
|
// rides through to the failure renderer.
|
|
196
230
|
const meta = readHandlerMeta(error);
|
package/dist/publish.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CA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O,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAAA,OAAO;QAAA,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,wEAAwE;QACxE,mEAAmE;QACnE,uEAAuE;QACvE,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtC,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;YAAA,KAAK,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAAA,KAAK,CAAC,CAAC,CAAC,CAAC;IAAA,CAAC;IACrC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/reconcile.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `putitoutthere reconcile` — backfill the missing git tag for every
|
|
3
|
-
* package
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* package whose live registry version has no tag. The on-demand
|
|
4
|
+
* companion to the publish-path auto-heal (#407): auto-heal only fires
|
|
5
|
+
* for a package already in a publish run, so a package whose globs never
|
|
6
|
+
* change again stays stuck forever; `reconcile` heals it without a
|
|
7
|
+
* release.
|
|
8
|
+
*
|
|
9
|
+
* The healable condition is stated in terms of the registry, not the
|
|
10
|
+
* drift label (#623): the version that IS live must have a tag. That
|
|
11
|
+
* covers `status`'s `published, untagged` (no tags at all) and the
|
|
12
|
+
* steady-state `version mismatch` a delegated PyPI upload leaves behind
|
|
13
|
+
* — the previous release is tagged, the version the caller-side
|
|
14
|
+
* `pypi-publish` job just uploaded is not. It is also why this is the
|
|
15
|
+
* command that job runs after uploading: the tag then follows registry
|
|
16
|
+
* truth rather than a step's exit code. A tag *ahead* of the registry
|
|
17
|
+
* (cut but not yet published) is a different drift class and is left
|
|
18
|
+
* alone — its registry version already carries its own, older tag.
|
|
8
19
|
*
|
|
9
20
|
* Thin reader, no parallel logic (design-commitments #7): `computeStatus`
|
|
10
21
|
* (#403) finds the drift, `resolveTagCommit` picks the commit, and
|
|
@@ -14,7 +25,7 @@
|
|
|
14
25
|
* `ensureTag` no-ops when the tag already exists, so a re-run does
|
|
15
26
|
* nothing.
|
|
16
27
|
*
|
|
17
|
-
* Issue #410, #403 slice 3.
|
|
28
|
+
* Issue #410, #403 slice 3, #623.
|
|
18
29
|
*/
|
|
19
30
|
import type { ReconcileOptions, ReconcileResult } from './reconcile-types.js';
|
|
20
31
|
export declare function reconcile(opts: ReconcileOptions): Promise<ReconcileResult>;
|
package/dist/reconcile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../src/reconcile.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../src/reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAWH,OAAO,KAAK,EAAmB,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE/F,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAkChF"}
|
package/dist/reconcile.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `putitoutthere reconcile` — backfill the missing git tag for every
|
|
3
|
-
* package
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* package whose live registry version has no tag. The on-demand
|
|
4
|
+
* companion to the publish-path auto-heal (#407): auto-heal only fires
|
|
5
|
+
* for a package already in a publish run, so a package whose globs never
|
|
6
|
+
* change again stays stuck forever; `reconcile` heals it without a
|
|
7
|
+
* release.
|
|
8
|
+
*
|
|
9
|
+
* The healable condition is stated in terms of the registry, not the
|
|
10
|
+
* drift label (#623): the version that IS live must have a tag. That
|
|
11
|
+
* covers `status`'s `published, untagged` (no tags at all) and the
|
|
12
|
+
* steady-state `version mismatch` a delegated PyPI upload leaves behind
|
|
13
|
+
* — the previous release is tagged, the version the caller-side
|
|
14
|
+
* `pypi-publish` job just uploaded is not. It is also why this is the
|
|
15
|
+
* command that job runs after uploading: the tag then follows registry
|
|
16
|
+
* truth rather than a step's exit code. A tag *ahead* of the registry
|
|
17
|
+
* (cut but not yet published) is a different drift class and is left
|
|
18
|
+
* alone — its registry version already carries its own, older tag.
|
|
8
19
|
*
|
|
9
20
|
* Thin reader, no parallel logic (design-commitments #7): `computeStatus`
|
|
10
21
|
* (#403) finds the drift, `resolveTagCommit` picks the commit, and
|
|
@@ -14,11 +25,12 @@
|
|
|
14
25
|
* `ensureTag` no-ops when the tag already exists, so a re-run does
|
|
15
26
|
* nothing.
|
|
16
27
|
*
|
|
17
|
-
* Issue #410, #403 slice 3.
|
|
28
|
+
* Issue #410, #403 slice 3, #623.
|
|
18
29
|
*/
|
|
19
30
|
import { join } from 'node:path';
|
|
20
31
|
import { loadConfig } from './config.js';
|
|
21
32
|
import { ensureTag } from './ensure-tag.js';
|
|
33
|
+
import { tagList } from './git.js';
|
|
22
34
|
import { createLogger } from './log.js';
|
|
23
35
|
import { resolveTagCommit } from './resolve-tag-commit.js';
|
|
24
36
|
import { computeStatus } from './status.js';
|
|
@@ -33,17 +45,25 @@ export async function reconcile(opts) {
|
|
|
33
45
|
const rows = await computeStatus({ cwd, configPath: cfgPath });
|
|
34
46
|
const actions = [];
|
|
35
47
|
for (const row of rows) {
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
|
|
48
|
+
// Nothing to back-fill without a live version to back-fill to:
|
|
49
|
+
// `unreleased` and `tagged, unpublished` name versions that are not
|
|
50
|
+
// on the registry, and an unreachable registry is not evidence of
|
|
51
|
+
// anything. A missing tag would not fix either.
|
|
52
|
+
if (row.registryUnreachable || row.registry === null) {
|
|
40
53
|
continue;
|
|
41
54
|
}
|
|
42
55
|
const pkg = byName.get(row.package);
|
|
43
56
|
const version = row.registry;
|
|
57
|
+
const tag = formatTag(pkg.tag_format, { name: pkg.name, version });
|
|
58
|
+
// Already tagged => nothing to do. This is what keeps the widened
|
|
59
|
+
// condition (#623) from re-tagging on every drift state: a package
|
|
60
|
+
// whose newest tag is *ahead* of the registry still has a tag for the
|
|
61
|
+
// registry's own version, so it lands here and is skipped.
|
|
62
|
+
if ((await tagList(tag, { cwd })).length > 0) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
44
65
|
const siblings = config.packages.filter((p) => p.name !== row.package);
|
|
45
66
|
const { commit, source } = await resolveTagCommit(version, siblings, { cwd });
|
|
46
|
-
const tag = formatTag(pkg.tag_format, { name: pkg.name, version });
|
|
47
67
|
if (!dryRun) {
|
|
48
68
|
await ensureTag(pkg.tag_format, pkg.name, version, commit, { cwd }, log);
|
|
49
69
|
}
|
package/dist/reconcile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconcile.js","sourceRoot":"","sources":["../src/reconcile.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"reconcile.js","sourceRoot":"","sources":["../src/reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,M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sEAAsE;QACtE,2DAA2D;QAC3D,IAAI,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAAA,SAAS;QAAA,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;QACvE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9E,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IACtG,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite the `version = "..."` assignment inside a manifest's `[package]`
|
|
3
|
+
* table, preserving everything else byte-for-byte.
|
|
4
|
+
*
|
|
5
|
+
* String surgery rather than a TOML round-trip, matching
|
|
6
|
+
* `replaceWorkspacePackageVersion` and `replaceDepVersionReq`: re-emitting
|
|
7
|
+
* parsed TOML discards the comments and formatting of a file the consumer
|
|
8
|
+
* owns.
|
|
9
|
+
*
|
|
10
|
+
* Lives in its own module rather than inside `handlers/crates.ts` so both
|
|
11
|
+
* the crates publish path and `writeResolvedCargoVersion` can reach it
|
|
12
|
+
* without an import cycle between the handler and the resolver it now
|
|
13
|
+
* delegates to. #639.
|
|
14
|
+
*
|
|
15
|
+
* **The match is bounded to the `[package]` table.** The original expression
|
|
16
|
+
*
|
|
17
|
+
* /(\[package\][\s\S]*?)(^\s*version\s*=\s*")([^"]*)(")/m
|
|
18
|
+
*
|
|
19
|
+
* was lazy and anchored only on the `[package]` *header*, so on a manifest
|
|
20
|
+
* with no literal `[package].version` — one that inherits via
|
|
21
|
+
* `version.workspace = true` — it walked past the table boundary and matched
|
|
22
|
+
* the next `version = "..."` in the file, typically a dependency's
|
|
23
|
+
* requirement in a section table. It then rewrote that requirement to the
|
|
24
|
+
* release version, naming a release of someone else's crate that does not
|
|
25
|
+
* exist, and reported success.
|
|
26
|
+
*
|
|
27
|
+
* Callers that need to handle inheritance go through
|
|
28
|
+
* `writeResolvedCargoVersion`, which detects it first and rewrites
|
|
29
|
+
* `[workspace.package].version` at the workspace root instead. This function
|
|
30
|
+
* stays literal-only on purpose; bounding the table means it now fails loud
|
|
31
|
+
* on a manifest it cannot legitimately rewrite instead of corrupting a
|
|
32
|
+
* neighbouring field.
|
|
33
|
+
*/
|
|
34
|
+
export declare function replaceCargoVersion(source: string, version: string): string;
|
|
35
|
+
//# sourceMappingURL=replace-cargo-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-cargo-version.d.ts","sourceRoot":"","sources":["../src/replace-cargo-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAuBH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAgB3E"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite the `version = "..."` assignment inside a manifest's `[package]`
|
|
3
|
+
* table, preserving everything else byte-for-byte.
|
|
4
|
+
*
|
|
5
|
+
* String surgery rather than a TOML round-trip, matching
|
|
6
|
+
* `replaceWorkspacePackageVersion` and `replaceDepVersionReq`: re-emitting
|
|
7
|
+
* parsed TOML discards the comments and formatting of a file the consumer
|
|
8
|
+
* owns.
|
|
9
|
+
*
|
|
10
|
+
* Lives in its own module rather than inside `handlers/crates.ts` so both
|
|
11
|
+
* the crates publish path and `writeResolvedCargoVersion` can reach it
|
|
12
|
+
* without an import cycle between the handler and the resolver it now
|
|
13
|
+
* delegates to. #639.
|
|
14
|
+
*
|
|
15
|
+
* **The match is bounded to the `[package]` table.** The original expression
|
|
16
|
+
*
|
|
17
|
+
* /(\[package\][\s\S]*?)(^\s*version\s*=\s*")([^"]*)(")/m
|
|
18
|
+
*
|
|
19
|
+
* was lazy and anchored only on the `[package]` *header*, so on a manifest
|
|
20
|
+
* with no literal `[package].version` — one that inherits via
|
|
21
|
+
* `version.workspace = true` — it walked past the table boundary and matched
|
|
22
|
+
* the next `version = "..."` in the file, typically a dependency's
|
|
23
|
+
* requirement in a section table. It then rewrote that requirement to the
|
|
24
|
+
* release version, naming a release of someone else's crate that does not
|
|
25
|
+
* exist, and reported success.
|
|
26
|
+
*
|
|
27
|
+
* Callers that need to handle inheritance go through
|
|
28
|
+
* `writeResolvedCargoVersion`, which detects it first and rewrites
|
|
29
|
+
* `[workspace.package].version` at the workspace root instead. This function
|
|
30
|
+
* stays literal-only on purpose; bounding the table means it now fails loud
|
|
31
|
+
* on a manifest it cannot legitimately rewrite instead of corrupting a
|
|
32
|
+
* neighbouring field.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* The `[package]` table's body: its header line, then every following line
|
|
36
|
+
* up to the next table header. Refusing any line that opens a table is what
|
|
37
|
+
* keeps the match inside the table — the same technique
|
|
38
|
+
* `replaceDepVersionReq` uses for `[dependencies.<key>]`.
|
|
39
|
+
*
|
|
40
|
+
* The `^` anchor matters: without it a `[package]` mentioned in a comment
|
|
41
|
+
* would start the match, and the body would then run from the comment to the
|
|
42
|
+
* real table header and stop there — empty.
|
|
43
|
+
*/
|
|
44
|
+
const PACKAGE_TABLE = /^\[package\][^\n]*\n((?:(?!\[)[^\n]*(?:\n|$))*)/m;
|
|
45
|
+
/**
|
|
46
|
+
* A literal `version = "..."` assignment on its own line. Anchored so a
|
|
47
|
+
* `version = "…"` inside a comment cannot be mistaken for the assignment,
|
|
48
|
+
* and tolerant of indentation and of spacing around the `=`.
|
|
49
|
+
*/
|
|
50
|
+
const VERSION_LINE = /^[ \t]*version[ \t]*=[ \t]*"([^"]*)"/m;
|
|
51
|
+
const NO_VERSION = 'Cargo.toml: no [package].version field found';
|
|
52
|
+
export function replaceCargoVersion(source, version) {
|
|
53
|
+
const table = PACKAGE_TABLE.exec(source);
|
|
54
|
+
if (table === null) {
|
|
55
|
+
throw new Error(NO_VERSION);
|
|
56
|
+
}
|
|
57
|
+
const body = table[1];
|
|
58
|
+
const line = VERSION_LINE.exec(body);
|
|
59
|
+
if (line === null) {
|
|
60
|
+
throw new Error(NO_VERSION);
|
|
61
|
+
}
|
|
62
|
+
const old = line[1];
|
|
63
|
+
// Offsets resolve against the original source: the table body starts after
|
|
64
|
+
// its header, and the value starts after this line's `version = "` prefix.
|
|
65
|
+
// Rewriting by offset rather than by `String.replace` keeps every other
|
|
66
|
+
// byte — comments, spacing, a same-valued `version` elsewhere — untouched.
|
|
67
|
+
const bodyStart = table.index + table[0].length - body.length;
|
|
68
|
+
const valueStart = bodyStart + line.index + line[0].length - old.length - 1;
|
|
69
|
+
return source.slice(0, valueStart) + version + source.slice(valueStart + old.length);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=replace-cargo-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-cargo-version.js","sourceRoot":"","sources":["../src/replace-cargo-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ative to the repository root, forward-slashed. #639.
|
|
4
|
+
*
|
|
5
|
+
* The crates pre-publish dirty-tree check compares engine-managed paths
|
|
6
|
+
* against porcelain output, and porcelain names every file relative to the
|
|
7
|
+
* repo root with forward slashes on every platform. Comparing an absolute,
|
|
8
|
+
* platform-separated path against that never matches, so the conversion has
|
|
9
|
+
* to happen first — and it happens for three different sets of paths (the
|
|
10
|
+
* manifests `writeVersion` wrote, the sibling package directories, the
|
|
11
|
+
* artifacts root), which is why it lives here rather than inline three times.
|
|
12
|
+
*
|
|
13
|
+
* Paths that do not sit under `cwd` are dropped rather than returned in
|
|
14
|
+
* `../…` form: porcelain can never name a file outside the repository, so
|
|
15
|
+
* such an entry could only ever fail to match, and keeping it would suggest
|
|
16
|
+
* to a reader that it might match something.
|
|
17
|
+
*/
|
|
18
|
+
/** Windows separators to the forward slashes git and this repo speak in. */
|
|
19
|
+
export declare function toPosixPath(p: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* `paths` as repo-relative, forward-slashed strings, dropping any that
|
|
22
|
+
* resolve to `cwd` itself or to somewhere outside it. `undefined` means "no
|
|
23
|
+
* paths" and yields an empty list, so callers holding an optional field can
|
|
24
|
+
* pass it straight through.
|
|
25
|
+
*/
|
|
26
|
+
export declare function repoRelativePaths(cwd: string, paths: readonly string[] | undefined): string[];
|
|
27
|
+
//# sourceMappingURL=repo-relative-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-relative-paths.d.ts","sourceRoot":"","sources":["../src/repo-relative-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACnC,MAAM,EAAE,CAQV"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute paths rendered the way `git status --porcelain` renders them:
|
|
3
|
+
* relative to the repository root, forward-slashed. #639.
|
|
4
|
+
*
|
|
5
|
+
* The crates pre-publish dirty-tree check compares engine-managed paths
|
|
6
|
+
* against porcelain output, and porcelain names every file relative to the
|
|
7
|
+
* repo root with forward slashes on every platform. Comparing an absolute,
|
|
8
|
+
* platform-separated path against that never matches, so the conversion has
|
|
9
|
+
* to happen first — and it happens for three different sets of paths (the
|
|
10
|
+
* manifests `writeVersion` wrote, the sibling package directories, the
|
|
11
|
+
* artifacts root), which is why it lives here rather than inline three times.
|
|
12
|
+
*
|
|
13
|
+
* Paths that do not sit under `cwd` are dropped rather than returned in
|
|
14
|
+
* `../…` form: porcelain can never name a file outside the repository, so
|
|
15
|
+
* such an entry could only ever fail to match, and keeping it would suggest
|
|
16
|
+
* to a reader that it might match something.
|
|
17
|
+
*/
|
|
18
|
+
import { relative } from 'node:path';
|
|
19
|
+
/** Windows separators to the forward slashes git and this repo speak in. */
|
|
20
|
+
export function toPosixPath(p) {
|
|
21
|
+
return p.replaceAll('\\', '/');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `paths` as repo-relative, forward-slashed strings, dropping any that
|
|
25
|
+
* resolve to `cwd` itself or to somewhere outside it. `undefined` means "no
|
|
26
|
+
* paths" and yields an empty list, so callers holding an optional field can
|
|
27
|
+
* pass it straight through.
|
|
28
|
+
*/
|
|
29
|
+
export function repoRelativePaths(cwd, paths) {
|
|
30
|
+
const out = [];
|
|
31
|
+
for (const p of paths ?? []) {
|
|
32
|
+
const rel = relative(cwd, p);
|
|
33
|
+
if (rel === '' || rel.startsWith('..')) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
out.push(toPosixPath(rel));
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=repo-relative-paths.js.map
|