putitoutthere 0.2.8 → 0.2.10
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/CHANGELOG.md +3 -0
- package/MIGRATIONS.md +147 -0
- package/README.md +26 -0
- package/action.yml +15 -5
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +29 -4
- package/dist/action.js.map +1 -1
- package/dist/cli.d.ts +11 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +36 -7
- package/dist/cli.js.map +1 -1
- package/dist/error-codes.d.ts +7 -0
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +8 -0
- package/dist/error-codes.js.map +1 -1
- package/dist/handlers/npm.d.ts.map +1 -1
- package/dist/handlers/npm.js +24 -5
- package/dist/handlers/npm.js.map +1 -1
- package/dist/preflight.d.ts +51 -10
- package/dist/preflight.d.ts.map +1 -1
- package/dist/preflight.js +104 -10
- package/dist/preflight.js.map +1 -1
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +6 -1
- package/dist/publish.js.map +1 -1
- package/dist/write-version.d.ts +48 -0
- package/dist/write-version.d.ts.map +1 -0
- package/dist/write-version.js +134 -0
- package/dist/write-version.js.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,7 @@ are prefixed `**BREAKING**` and link to the matching section in
|
|
|
12
12
|
|
|
13
13
|
### Added
|
|
14
14
|
|
|
15
|
+
- **Preflight check: every cascaded `kind = "npm"` package must declare a non-empty `repository` field in `package.json`.** `putitoutthere` invokes `npm publish --provenance` on the OIDC trusted-publisher path, and the npm CLI hard-requires this field so the registry can verify the artifact was built from the repo the trusted publisher declares. A missing or empty field previously surfaced as a confusing tail-end npm error after the runner had spun up, OIDC had been negotiated, and the artifact had been built — wasting a full release run on a precondition checkable in milliseconds. The new `requireProvenanceMetadata` runs alongside `requireAuth` in `src/publish.ts`, before any side effects, and reports every failing package in one error rather than failing on the first. Surfaces a new stable error code, `PIOT_NPM_MISSING_REPOSITORY`. Both the canonical object form (`{ type, url, directory? }`) and the legacy single-string form are accepted; only an empty `url` (or no `url` at all) fails. The npm handler's inline backstop is also tightened to match the same predicate (previously `!pkg.repository` slipped `{}`, `{ type: 'git' }`, and whitespace strings through). Documented in [README → `kind = "npm"`](./README.md#kind--npm). See [MIGRATIONS.md](./MIGRATIONS.md#npm-package-json-must-declare-repository). #280.
|
|
15
16
|
- **Reusable workflow `.github/workflows/build.yml` (`workflow_call`).** PR-time build verification: runs the same plan + build matrix that `release.yml` runs, calling a shared internal `_matrix.yml` reusable workflow so action pins, per-target build steps, and runner selection cannot drift between the two paths. `build.yml` declares only `permissions: contents: read` and contains no publish job, no `id-token: write`, no OIDC trusted-publisher exchange, and no registry auth — the bytes required to publish do not exist on this code path. Two optional inputs forwarded to `_matrix.yml`: `node_version` (default `24`), `python_version` (default `3.12`). Concurrency is keyed on `github.ref` with `cancel-in-progress: true` so PR pushes supersede stale runs (release.yml's repository-keyed group with `cancel-in-progress: false` is unchanged). An `actionlint`-job grep assertion rejects any future patch that adds `id-token: write` to `build.yml` or `_matrix.yml`. See [README → Build check](./README.md#1b-optional-drop-in-githubworkflowsbuild-checkyml) and [MIGRATIONS.md](./MIGRATIONS.md#new-buildyml-reusable-workflow-for-pr-time-build-verification).
|
|
16
17
|
- **`PIOT_PUBLISH_EMPTY_PLAN` error code.** Surfaced when `publish` is invoked with an empty matrix. Joins `PIOT_AUTH_NO_TOKEN` in the stable error-code vocabulary; foreign agents debugging a failed publish can fingerprint on the code without parsing prose.
|
|
17
18
|
- **`kind = "npm"` `build` accepts an array of entries with consumer-defined platform-package name templates.** For packages that ship both a napi-rs Node addon and a CLI binary from the same npm package (the `@swc/core` shape), declare `build = [{ mode = "napi", name = "@scope/lib-{triple}" }, { mode = "bundled-cli", name = "@scope/cli-{triple}" }]`. Each entry contributes its own per-platform package family; the main package's `optionalDependencies` spans both. Entries can be bare mode strings (`"napi"`, defaults to `{name}-{triple}` template) or `{ mode, name }` objects. Variables surfaced in `name` templates: `{name}`, `{scope}`, `{base}`, `{triple}`, `{mode}`. `{version}` is intentionally not surfaced. Single-mode string form (`build = "napi"`) preserved byte-for-byte — same artifact-name layout, same platform-package names, no migration pressure on existing consumers. See [README → Recipes → Multi-mode npm family](./README.md#multi-mode-npm-family) and [MIGRATIONS.md](./MIGRATIONS.md#npm-build-accepts-array-of-entries).
|
|
@@ -30,6 +31,8 @@ are prefixed `**BREAKING**` and link to the matching section in
|
|
|
30
31
|
|
|
31
32
|
### Fixed
|
|
32
33
|
|
|
34
|
+
- **pypi/maturin wheels now ship at the planned version instead of the literal in `pyproject.toml`.** The reusable workflow's build matrix (`_matrix.yml`) now bumps `[project].version` in `pyproject.toml` (or `[package].version` in `Cargo.toml` when `pyproject.toml` declares `dynamic = ["version"]`) to `matrix.version` before each `PyO3/maturin-action@v1` invocation. Maturin reads its version source from disk at build time and honors no env override — `SETUPTOOLS_SCM_PRETEND_VERSION` is a setuptools-scm / hatch-vcs feature, not a maturin one. Without the bump, wheels left the build runner at whatever literal happened to be in the consumer's manifest — diverging from the planned version, tripping PyPI's "file already exists" rejection at upload, and turning otherwise-clean release runs red even when crates and npm shipped correctly. The bump is implemented as a new internal `putitoutthere write-version` CLI subcommand and exposed through the JS action's existing surface (new `version:` input on `action.yml`); the e2e fixture harness now verifies wheel `METADATA: Version:` matches `matrix.version` post-build. The CLI subcommand and action input are internal — consumers compose with the reusable workflow, not directly with the CLI. Hit in the wild on `dirsql`'s 0.2.8 release (issue #276). See [MIGRATIONS.md](./MIGRATIONS.md#pypi-maturin-version-bump-at-build).
|
|
35
|
+
|
|
33
36
|
- **npm publish no longer fails red when npm CLI retries a successful PUT.** When the registry acks a publish but the response comes back flaky to the client (timeout / 502 / connection reset), the npm CLI retries with the same payload. The retry lands on a registry that already has the new version and exits `E403 "cannot publish over the previously published versions: <ver>"`. Both the platform-package handler (`src/handlers/npm-platform.ts:npmPublish`) and the main publish path (`src/handlers/npm.ts:publishImpl`) now detect that exact stderr shape and treat it as success — the package is already on the registry at the requested version. Hit in the wild on PR #257's polyglot-everything multi-mode publish (10 platform packages × ~1 in 10 chance per request meant the race was nearly guaranteed).
|
|
34
37
|
|
|
35
38
|
- **Crates publish no longer refuses on workflow-managed install state in sibling packages.** Before, the engine's pre-publish dirty-workspace check (`scanDirtyOutsideManifest`) flagged anything dirty outside the package's `Cargo.toml`. For polyglot consumers (rust + js in one repo), the reusable workflow's `Build npm packages` step (#256) creates `node_modules/`, `package-lock.json`, and `dist/` inside each npm package's path before cargo publish runs — these are workflow scratch, not stray edits, and cargo can't pack them anyway (it only packs files inside the crate's own dir). The check now whitelists every other configured package's path, similar to how it already whitelists `artifacts/`. Stray edits elsewhere in the repo (a `README.md` change, etc.) still fail the check. Hit in the wild on the polyglot-everything e2e fixture; would also have hit any consumer with the same shape.
|
package/MIGRATIONS.md
CHANGED
|
@@ -21,6 +21,153 @@ Each section covers five things, in order:
|
|
|
21
21
|
|
|
22
22
|
## Unreleased
|
|
23
23
|
|
|
24
|
+
### npm package.json must declare `repository`
|
|
25
|
+
|
|
26
|
+
**Summary.** Every cascaded `kind = "npm"` package's `package.json`
|
|
27
|
+
must now carry a non-empty `repository` field. The new preflight
|
|
28
|
+
check (`requireProvenanceMetadata` in `src/preflight.ts`) runs in
|
|
29
|
+
`src/publish.ts` immediately after `requireAuth` and rejects the
|
|
30
|
+
run with `PIOT_NPM_MISSING_REPOSITORY` before any runner work.
|
|
31
|
+
Why: `putitoutthere` invokes `npm publish --provenance` on the OIDC
|
|
32
|
+
trusted-publisher path; the npm CLI hard-requires this field so the
|
|
33
|
+
registry can verify the artifact was built from the repo the trusted
|
|
34
|
+
publisher declares. A missing or empty field previously surfaced
|
|
35
|
+
only after the runner had spun up, OIDC had been negotiated, and
|
|
36
|
+
the artifact had been built — wasting a full release run on a
|
|
37
|
+
precondition checkable in milliseconds. Hit in the wild on
|
|
38
|
+
`coaxer@0.1.1`'s first npm release; tracked in #280.
|
|
39
|
+
|
|
40
|
+
The npm handler's inline backstop (`assertRepositoryField` in
|
|
41
|
+
`src/handlers/npm.ts`) is also tightened. Previously it used
|
|
42
|
+
`if (!pkg.repository)` — falsy-only — which let three real shapes
|
|
43
|
+
slip through: an object without `url` (`{ type: 'git' }`), an
|
|
44
|
+
empty object (`{}`), and a whitespace-only string (`' '`). All
|
|
45
|
+
three are now rejected; the error message also carries the stable
|
|
46
|
+
`PIOT_NPM_MISSING_REPOSITORY` code and the path of the offending
|
|
47
|
+
file, matching the preflight error.
|
|
48
|
+
|
|
49
|
+
**Required changes.** Add a `repository` block to every
|
|
50
|
+
`package.json` declared as `kind = "npm"` in
|
|
51
|
+
`putitoutthere.toml`. Canonical shape:
|
|
52
|
+
|
|
53
|
+
| Before | After |
|
|
54
|
+
| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
55
|
+
| `{ "name": "@scope/lib", "version": "0.1.0" }` | `{ "name": "@scope/lib", "version": "0.1.0", "repository": { "type": "git", "url": "git+https://github.com/<owner>/<repo>.git", "directory": "<path/to/package>" } }` |
|
|
56
|
+
|
|
57
|
+
`directory` is needed for monorepo packages so npm can locate the
|
|
58
|
+
source within the repo. Both the object form and the legacy single-
|
|
59
|
+
string form (`"repository": "git+https://github.com/<owner>/<repo>.git"`)
|
|
60
|
+
are accepted; only a missing field, an empty string, or an object
|
|
61
|
+
without a non-empty `url` fails the check.
|
|
62
|
+
|
|
63
|
+
No `release.yml` or `putitoutthere.toml` changes are required.
|
|
64
|
+
|
|
65
|
+
**Deprecations removed.** None.
|
|
66
|
+
|
|
67
|
+
**Behavior changes without code changes.** `putitoutthere publish`
|
|
68
|
+
now fails fast at preflight with
|
|
69
|
+
`[PIOT_NPM_MISSING_REPOSITORY] npm publish requires a non-empty
|
|
70
|
+
\`repository\` field in package.json` for any cascaded npm package
|
|
71
|
+
whose `package.json` lacks the field. Previously the same shape
|
|
72
|
+
ran through plan + build + auth-negotiation + artifact-staging
|
|
73
|
+
and failed inside `npm publish` with `npm publish --provenance
|
|
74
|
+
requires a \`repository\` field in package.json`. Well-formed
|
|
75
|
+
packages are unaffected.
|
|
76
|
+
|
|
77
|
+
The error message names every failing package and its
|
|
78
|
+
`package.json` path so consumers fix all of them in one round-trip
|
|
79
|
+
rather than discovering them one at a time across multiple release
|
|
80
|
+
attempts.
|
|
81
|
+
|
|
82
|
+
**Verification.** Drop the `repository` field from one of your
|
|
83
|
+
`package.json` files locally and run `pnpm test:integration` (or
|
|
84
|
+
the engine against a local fixture); the failure should arrive at
|
|
85
|
+
preflight with `PIOT_NPM_MISSING_REPOSITORY` in the message, no
|
|
86
|
+
platform packages should be published, and no git tag should be
|
|
87
|
+
created. Restore the field; the next run completes normally.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### pypi/maturin version bump at build
|
|
92
|
+
|
|
93
|
+
**Summary.** `pypi` packages built with `build = "maturin"` now ship
|
|
94
|
+
wheels at the planned version, not at whatever literal happened to be
|
|
95
|
+
in `pyproject.toml` on the build runner. The reusable workflow's
|
|
96
|
+
build matrix (`_matrix.yml`) bumps the version source on disk to
|
|
97
|
+
`matrix.version` immediately before each `PyO3/maturin-action@v1`
|
|
98
|
+
step. Two version-source shapes are supported:
|
|
99
|
+
|
|
100
|
+
- Static literal: `[project].version = "0.1.0"` in `pyproject.toml`
|
|
101
|
+
is rewritten in place. This is maturin's default project shape and
|
|
102
|
+
the case that was previously broken for every consumer.
|
|
103
|
+
- Dynamic: `pyproject.toml` declaring `[project].dynamic = ["version"]`
|
|
104
|
+
with the version sourced from a sibling `Cargo.toml`'s
|
|
105
|
+
`[package].version` — that's where the bump lands instead.
|
|
106
|
+
|
|
107
|
+
Why it matters: maturin reads its version source from disk at build
|
|
108
|
+
time and honors no env override. Other build paths bumped elsewhere
|
|
109
|
+
in the contract — crates and npm at publish (`writeVersion` rewrites
|
|
110
|
+
the manifest before `cargo publish` / `npm publish` reads it),
|
|
111
|
+
setuptools-scm / hatch-vcs through `SETUPTOOLS_SCM_PRETEND_VERSION`
|
|
112
|
+
in the build step. Maturin had no equivalent, so wheels left the
|
|
113
|
+
build runner pre-versioned at the consumer's stale literal. PyPI
|
|
114
|
+
rejected the upload with `400 File already exists` whenever that
|
|
115
|
+
literal had been previously registered, even when crates and npm
|
|
116
|
+
shipped correctly. Hit in the wild on `dirsql`'s 0.2.8 release;
|
|
117
|
+
issue #276.
|
|
118
|
+
|
|
119
|
+
**Required changes.** None. The bump is internal to the reusable
|
|
120
|
+
workflow. Consumers pinning `release.yml@v0` and `build.yml@v0`
|
|
121
|
+
inherit the fix on the next workflow run with no `release.yml` edits
|
|
122
|
+
and no `putitoutthere.toml` edits. The fix applies equally to the
|
|
123
|
+
static-literal and dynamic-version shapes; consumers don't need to
|
|
124
|
+
restructure their pyproject to opt in.
|
|
125
|
+
|
|
126
|
+
The CLI gains a new internal subcommand,
|
|
127
|
+
`putitoutthere write-version --path <pkg-dir> --version <v>`, that
|
|
128
|
+
implements the bump dispatch. `action.yml` gains a new optional
|
|
129
|
+
`version:` input that the reusable workflow forwards. Both surfaces
|
|
130
|
+
are internal seams powering `_matrix.yml`; consumers compose with
|
|
131
|
+
the reusable workflow, not directly with the CLI or the JS action
|
|
132
|
+
(see [`notes/design-commitments.md`](./notes/design-commitments.md)
|
|
133
|
+
non-goal #7 and #10).
|
|
134
|
+
|
|
135
|
+
**Deprecations removed.** None.
|
|
136
|
+
|
|
137
|
+
**Behavior changes without code changes.** A maturin build run
|
|
138
|
+
through the reusable workflow now mutates the build runner's
|
|
139
|
+
`pyproject.toml` (or `Cargo.toml` for dynamic-version projects) in
|
|
140
|
+
place, bumping the version literal to `matrix.version`. The mutation
|
|
141
|
+
lives only on the build runner — the consumer's source tree is
|
|
142
|
+
untouched. Anyone fingerprinting on the on-disk manifest version
|
|
143
|
+
during a build (e.g. a custom shell step running between
|
|
144
|
+
`uses: thekevinscott/putitoutthere/.github/workflows/release.yml@v0`
|
|
145
|
+
and a follow-up step that reads the manifest) will now see the
|
|
146
|
+
planned version where they previously saw the consumer's stale
|
|
147
|
+
literal. Custom build steps that grep on a specific literal version
|
|
148
|
+
need to grep on `matrix.version` instead.
|
|
149
|
+
|
|
150
|
+
`pyproject.toml` projects whose `[project]` table is malformed
|
|
151
|
+
(neither a static `version = "..."` line nor `dynamic = ["version"]`)
|
|
152
|
+
now fail the build matrix with a clear error. Previously the same
|
|
153
|
+
shape produced wheels at whatever fallback the build backend chose,
|
|
154
|
+
which silently disagreed with the plan.
|
|
155
|
+
|
|
156
|
+
**Verification.** Cut a release on a maturin package whose
|
|
157
|
+
`pyproject.toml` carries a stale literal (e.g. `version = "0.1.0"`
|
|
158
|
+
when the planned version is `0.2.8`). The reusable workflow's
|
|
159
|
+
build matrix logs a `write-version: ... → 0.2.8` line before each
|
|
160
|
+
maturin invocation, and the produced wheel's `METADATA: Version:`
|
|
161
|
+
matches the planned version:
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
unzip -p dist/*.whl '*.dist-info/METADATA' | grep '^Version:'
|
|
165
|
+
# Version: 0.2.8
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
PyPI accepts the upload — assuming the planned version itself isn't
|
|
169
|
+
a duplicate of a previously-registered file.
|
|
170
|
+
|
|
24
171
|
### New `build.yml` reusable workflow for PR-time build verification
|
|
25
172
|
|
|
26
173
|
**Summary.** A second consumer-facing reusable workflow,
|
package/README.md
CHANGED
|
@@ -183,6 +183,32 @@ version = 1 # required; only 1 is valid today
|
|
|
183
183
|
| `build` | string \| array | `"napi"` \| `"bundled-cli"` (single mode), or an array of entries (each: a bare mode string or `{ mode, name }` with a [name template](#multi-mode-npm-family)). Omitted = vanilla. See [Recipes → Bundled-CLI npm family](#bundled-cli-npm-family). |
|
|
184
184
|
| `targets` | (string \| object)[] | Required when `build` is set. |
|
|
185
185
|
|
|
186
|
+
> [!IMPORTANT]
|
|
187
|
+
> **`package.json` MUST declare a non-empty `repository` field.** `putitoutthere`
|
|
188
|
+
> publishes npm packages with `npm publish --provenance` on the OIDC
|
|
189
|
+
> trusted-publisher path; the npm CLI hard-requires `repository` so the
|
|
190
|
+
> registry can verify the artifact was built from the repo the trusted
|
|
191
|
+
> publisher declares. Preflight rejects the run with
|
|
192
|
+
> `PIOT_NPM_MISSING_REPOSITORY` when the field is missing or empty.
|
|
193
|
+
>
|
|
194
|
+
> Canonical shape (use this in every npm `package.json` you publish through
|
|
195
|
+
> `putitoutthere`):
|
|
196
|
+
>
|
|
197
|
+
> ```json
|
|
198
|
+
> {
|
|
199
|
+
> "repository": {
|
|
200
|
+
> "type": "git",
|
|
201
|
+
> "url": "git+https://github.com/<owner>/<repo>.git",
|
|
202
|
+
> "directory": "<path/to/package>"
|
|
203
|
+
> }
|
|
204
|
+
> }
|
|
205
|
+
> ```
|
|
206
|
+
>
|
|
207
|
+
> `directory` is needed for monorepo packages so npm can locate the source
|
|
208
|
+
> within the repo. The legacy single-string form
|
|
209
|
+
> (`"repository": "git+https://github.com/<owner>/<repo>.git"`) is also
|
|
210
|
+
> accepted.
|
|
211
|
+
|
|
186
212
|
### Example: polyglot Rust library
|
|
187
213
|
|
|
188
214
|
One Rust crate feeds three artifacts:
|
package/action.yml
CHANGED
|
@@ -4,15 +4,25 @@ author: 'Kevin Scott'
|
|
|
4
4
|
|
|
5
5
|
inputs:
|
|
6
6
|
command:
|
|
7
|
-
description: 'Which CLI subcommand to run. Canonical values are `plan` and `
|
|
7
|
+
description: 'Which CLI subcommand to run. Canonical values are `plan`, `publish`, and `write-version`.'
|
|
8
8
|
required: false
|
|
9
9
|
default: 'plan'
|
|
10
10
|
working_directory:
|
|
11
11
|
description: >-
|
|
12
|
-
Path the CLI runs against
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
Path the CLI runs against. For `plan` / `publish`, forwarded as
|
|
13
|
+
`--cwd`. For `write-version` (#276), forwarded as `--path` —
|
|
14
|
+
the package directory whose pyproject.toml / Cargo.toml gets
|
|
15
|
+
bumped. Defaults to the runner working directory. Internal use;
|
|
16
|
+
the reusable workflow supplies this when invoked against a
|
|
17
|
+
non-root tree (e.g. e2e fixtures materialized into a subdir,
|
|
18
|
+
or a per-package `matrix.path`).
|
|
19
|
+
required: false
|
|
20
|
+
default: ''
|
|
21
|
+
version:
|
|
22
|
+
description: >-
|
|
23
|
+
Planned version string. Required when `command: write-version`
|
|
24
|
+
(#276); ignored otherwise. The reusable workflow forwards the
|
|
25
|
+
build matrix's `version` row from the planner.
|
|
16
26
|
required: false
|
|
17
27
|
default: ''
|
|
18
28
|
fail_on_error:
|
package/dist/action.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAmC1C"}
|
package/dist/action.js
CHANGED
|
@@ -7,18 +7,33 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Issue #24. Plan: §5.2, §5.3.
|
|
9
9
|
*/
|
|
10
|
+
import { pathToFileURL } from 'node:url';
|
|
10
11
|
import { run } from './cli.js';
|
|
11
12
|
export async function main() {
|
|
12
13
|
const command = process.env.INPUT_COMMAND ?? '';
|
|
13
14
|
const workingDirectory = process.env.INPUT_WORKING_DIRECTORY ?? '';
|
|
15
|
+
const versionInput = process.env.INPUT_VERSION ?? '';
|
|
14
16
|
const failOnError = (process.env.INPUT_FAIL_ON_ERROR ?? 'true').toLowerCase() !== 'false';
|
|
15
17
|
if (!command) {
|
|
16
18
|
process.stderr.write('putitoutthere action: missing required input `command`\n');
|
|
17
19
|
process.exit(1);
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
// #276: write-version uses a different argv shape — `--path` (the
|
|
22
|
+
// package dir, sourced from `working_directory`) and `--version`.
|
|
23
|
+
// No `--json`: the subcommand emits a single human line; there's
|
|
24
|
+
// no structured output to consume.
|
|
25
|
+
const argv = ['node', 'putitoutthere', command];
|
|
26
|
+
if (command === 'write-version') {
|
|
27
|
+
if (workingDirectory)
|
|
28
|
+
argv.push('--path', workingDirectory);
|
|
29
|
+
if (versionInput)
|
|
30
|
+
argv.push('--version', versionInput);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
argv.push('--json');
|
|
34
|
+
if (workingDirectory)
|
|
35
|
+
argv.push('--cwd', workingDirectory);
|
|
36
|
+
}
|
|
22
37
|
const code = await run(argv);
|
|
23
38
|
if (code !== 0 && !failOnError) {
|
|
24
39
|
process.stderr.write(`putitoutthere action: ignoring non-zero exit (fail_on_error=false): ${code}\n`);
|
|
@@ -26,8 +41,18 @@ export async function main() {
|
|
|
26
41
|
}
|
|
27
42
|
process.exit(code);
|
|
28
43
|
}
|
|
44
|
+
// Entry-point guard. Compare via `pathToFileURL` so the guard fires on
|
|
45
|
+
// Windows too: `import.meta.url` is a `file://` URL with forward
|
|
46
|
+
// slashes (`file:///D:/.../index.js`), while `process.argv[1]` is the
|
|
47
|
+
// native path (`D:\...\index.js`). Concatenating `file://` to the
|
|
48
|
+
// native path produces a string that never equals the URL on Windows,
|
|
49
|
+
// so the previous guard silently no-op'd the entire action when ncc-
|
|
50
|
+
// bundled and invoked via `uses: ./` on a windows-latest runner —
|
|
51
|
+
// `main()` was never called, the action exited 0 immediately, and
|
|
52
|
+
// `_matrix.yml`'s pre-maturin write-version step bumped nothing
|
|
53
|
+
// (PR #277, e2e Windows maturin failures). Issue #276.
|
|
29
54
|
/* v8 ignore next 3 -- entry-point guard; only reachable when invoked as a binary */
|
|
30
|
-
if (import.meta.url ===
|
|
55
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
31
56
|
void main();
|
|
32
57
|
}
|
|
33
58
|
//# sourceMappingURL=action.js.map
|
package/dist/action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,IAAI;IACxB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC;IAChD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,EAAE,CAAC;IACnE,MAAM,WAAW,GACf,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;IAExE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0DAA0D,CAC3D,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,IAAI;IACxB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC;IAChD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,EAAE,CAAC;IACnE,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC;IACrD,MAAM,WAAW,GACf,CAAC,OAAO,CAA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,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/E,KAAK,IAAI,EAAE,CAAC;AACd,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -5,15 +5,21 @@
|
|
|
5
5
|
* not promised externally. See `notes/design-commitments.md`.
|
|
6
6
|
*
|
|
7
7
|
* Commands:
|
|
8
|
-
* plan
|
|
9
|
-
* publish
|
|
10
|
-
* version
|
|
8
|
+
* plan — compute and emit the release plan
|
|
9
|
+
* publish — execute the plan against the registries
|
|
10
|
+
* write-version — bump a package's manifest to a planned version
|
|
11
|
+
* (pre-build hook for maturin; #276)
|
|
12
|
+
* version — print CLI version
|
|
11
13
|
*
|
|
12
14
|
* Global flags:
|
|
13
15
|
* --cwd <path> working directory (default: process.cwd())
|
|
14
16
|
* --config <path> path to putitoutthere.toml
|
|
15
17
|
* --json machine-readable output
|
|
16
18
|
*
|
|
19
|
+
* `write-version` flags:
|
|
20
|
+
* --path <dir> package directory (where pyproject.toml lives)
|
|
21
|
+
* --version <v> planned version to write
|
|
22
|
+
*
|
|
17
23
|
* `--dry-run` was removed deliberately (#244). The library's job is
|
|
18
24
|
* publishing; a non-publishing mode of the publish command was a
|
|
19
25
|
* coverage hole pretending to be a feature. Passing `--dry-run` now
|
|
@@ -23,6 +29,8 @@ interface ParsedFlags {
|
|
|
23
29
|
cwd: string;
|
|
24
30
|
config?: string | undefined;
|
|
25
31
|
json: boolean;
|
|
32
|
+
path?: string | undefined;
|
|
33
|
+
version?: string | undefined;
|
|
26
34
|
}
|
|
27
35
|
export declare function parseFlags(argv: readonly string[]): ParsedFlags;
|
|
28
36
|
export declare function run(argv: readonly string[]): Promise<number>;
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAwCH,UAAU,WAAW;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;IAId,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CA8B/D;AAED,wBAAsB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6GlE"}
|
package/dist/cli.js
CHANGED
|
@@ -5,15 +5,21 @@
|
|
|
5
5
|
* not promised externally. See `notes/design-commitments.md`.
|
|
6
6
|
*
|
|
7
7
|
* Commands:
|
|
8
|
-
* plan
|
|
9
|
-
* publish
|
|
10
|
-
* version
|
|
8
|
+
* plan — compute and emit the release plan
|
|
9
|
+
* publish — execute the plan against the registries
|
|
10
|
+
* write-version — bump a package's manifest to a planned version
|
|
11
|
+
* (pre-build hook for maturin; #276)
|
|
12
|
+
* version — print CLI version
|
|
11
13
|
*
|
|
12
14
|
* Global flags:
|
|
13
15
|
* --cwd <path> working directory (default: process.cwd())
|
|
14
16
|
* --config <path> path to putitoutthere.toml
|
|
15
17
|
* --json machine-readable output
|
|
16
18
|
*
|
|
19
|
+
* `write-version` flags:
|
|
20
|
+
* --path <dir> package directory (where pyproject.toml lives)
|
|
21
|
+
* --version <v> planned version to write
|
|
22
|
+
*
|
|
17
23
|
* `--dry-run` was removed deliberately (#244). The library's job is
|
|
18
24
|
* publishing; a non-publishing mode of the publish command was a
|
|
19
25
|
* coverage hole pretending to be a feature. Passing `--dry-run` now
|
|
@@ -22,8 +28,9 @@
|
|
|
22
28
|
import { isAbsolute, resolve } from 'node:path';
|
|
23
29
|
import { plan } from './plan.js';
|
|
24
30
|
import { publish } from './publish.js';
|
|
31
|
+
import { writeVersionForBuild } from './write-version.js';
|
|
25
32
|
import { VERSION } from './version.js';
|
|
26
|
-
const COMMANDS = ['plan', 'publish', 'version'];
|
|
33
|
+
const COMMANDS = ['plan', 'publish', 'write-version', 'version'];
|
|
27
34
|
function isCommand(value) {
|
|
28
35
|
return COMMANDS.includes(value);
|
|
29
36
|
}
|
|
@@ -32,13 +39,16 @@ function printUsage() {
|
|
|
32
39
|
'Usage: putitoutthere <command> [options]',
|
|
33
40
|
'',
|
|
34
41
|
'Commands:',
|
|
35
|
-
' plan
|
|
36
|
-
' publish
|
|
37
|
-
' version
|
|
42
|
+
' plan Compute and emit the release plan',
|
|
43
|
+
' publish Execute the plan',
|
|
44
|
+
' write-version Bump a package manifest to the planned version (pre-build; #276)',
|
|
45
|
+
' version Print CLI version',
|
|
38
46
|
'',
|
|
39
47
|
'Options:',
|
|
40
48
|
' --cwd <path> working directory',
|
|
41
49
|
' --config <path> path to putitoutthere.toml',
|
|
50
|
+
' --path <dir> package directory (write-version)',
|
|
51
|
+
' --version <v> planned version (write-version)',
|
|
42
52
|
' --json emit machine-readable output',
|
|
43
53
|
'',
|
|
44
54
|
'See https://github.com/thekevinscott/putitoutthere for docs.',
|
|
@@ -59,6 +69,10 @@ export function parseFlags(argv) {
|
|
|
59
69
|
out.config = argv[++i];
|
|
60
70
|
else if (a === '--json')
|
|
61
71
|
out.json = true;
|
|
72
|
+
else if (a === '--path')
|
|
73
|
+
out.path = argv[++i];
|
|
74
|
+
else if (a === '--version')
|
|
75
|
+
out.version = argv[++i];
|
|
62
76
|
else if (a === '--dry-run') {
|
|
63
77
|
// Removed in #244. Publishing is the library's only job; a
|
|
64
78
|
// non-publishing flavor of `publish` is a coverage hole, not
|
|
@@ -130,6 +144,21 @@ export async function run(argv) {
|
|
|
130
144
|
}
|
|
131
145
|
return 0;
|
|
132
146
|
}
|
|
147
|
+
case 'write-version': {
|
|
148
|
+
// #276: pre-build hook used by `_matrix.yml`'s maturin steps.
|
|
149
|
+
// Maturin reads the version from disk at build time with no
|
|
150
|
+
// env override, so the manifest must match the planned
|
|
151
|
+
// version before maturin runs. crates / npm bump at publish;
|
|
152
|
+
// setuptools-scm / hatch-vcs use SETUPTOOLS_SCM_PRETEND_VERSION.
|
|
153
|
+
if (!flags.path)
|
|
154
|
+
throw new Error('write-version: --path <pkg-dir> is required');
|
|
155
|
+
if (!flags.version)
|
|
156
|
+
throw new Error('write-version: --version <v> is required');
|
|
157
|
+
const target = isAbsolute(flags.path) ? flags.path : resolve(flags.cwd, flags.path);
|
|
158
|
+
const written = writeVersionForBuild(target, flags.version);
|
|
159
|
+
process.stdout.write(`write-version: ${target} → ${flags.version}; wrote ${written.join(', ')}\n`);
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
133
162
|
case 'publish': {
|
|
134
163
|
const result = await publish({
|
|
135
164
|
cwd: flags.cwd,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,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AC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACpE,CAAC,CAAC;gBACH,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;oBACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;gBACtD,CAAC;qBAAM,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;oBAC/C,6FAA6F;gBAC/F,CAAC;qBAAM,CAAC;oBACN,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;wBACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,cAAc,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CACpE,CAAC;oBACJ,CAAC;gBACH,CAAC;gBACD,oBAAoB;gBACpB,OAAO,CAAC,CAAC;YACX,CAAC;YACD,6DAA6D;YAC7D,KAAK,SAAS;gBACZ,OAAO,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,kBAAkB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CACvE,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,mEAAmE;AACnE,yBAAyB"}
|
package/dist/error-codes.d.ts
CHANGED
|
@@ -29,6 +29,13 @@ export declare const ErrorCodes: {
|
|
|
29
29
|
* prevent this from being reached; if it fires, the gate was
|
|
30
30
|
* bypassed or the engine is inconsistent. */
|
|
31
31
|
readonly PUBLISH_EMPTY_PLAN: "PIOT_PUBLISH_EMPTY_PLAN";
|
|
32
|
+
/** An npm package's `package.json` is missing a non-empty
|
|
33
|
+
* `repository` field. `npm publish --provenance` (the OIDC
|
|
34
|
+
* trusted-publisher path) requires it so the registry can verify
|
|
35
|
+
* the artifact was built from the repo the trusted publisher
|
|
36
|
+
* declares. Failing at preflight prevents wasting a build run on
|
|
37
|
+
* a precondition checkable in milliseconds. #280. */
|
|
38
|
+
readonly NPM_MISSING_REPOSITORY: "PIOT_NPM_MISSING_REPOSITORY";
|
|
32
39
|
};
|
|
33
40
|
export type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|
|
34
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,UAAU;IACrB;;;8CAG0C;;IAE1C;;;;;;kDAM8C;;
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,UAAU;IACrB;;;8CAG0C;;IAE1C;;;;;;kDAM8C;;IAE9C;;;;;0DAKsD;;CAE9C,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,SAAS,EAI/C,CAAC"}
|
package/dist/error-codes.js
CHANGED
|
@@ -29,6 +29,13 @@ export const ErrorCodes = {
|
|
|
29
29
|
* prevent this from being reached; if it fires, the gate was
|
|
30
30
|
* bypassed or the engine is inconsistent. */
|
|
31
31
|
PUBLISH_EMPTY_PLAN: 'PIOT_PUBLISH_EMPTY_PLAN',
|
|
32
|
+
/** An npm package's `package.json` is missing a non-empty
|
|
33
|
+
* `repository` field. `npm publish --provenance` (the OIDC
|
|
34
|
+
* trusted-publisher path) requires it so the registry can verify
|
|
35
|
+
* the artifact was built from the repo the trusted publisher
|
|
36
|
+
* declares. Failing at preflight prevents wasting a build run on
|
|
37
|
+
* a precondition checkable in milliseconds. #280. */
|
|
38
|
+
NPM_MISSING_REPOSITORY: 'PIOT_NPM_MISSING_REPOSITORY',
|
|
32
39
|
};
|
|
33
40
|
/**
|
|
34
41
|
* Iterable form of the codes. Walked by tests for uniqueness/format
|
|
@@ -37,5 +44,6 @@ export const ErrorCodes = {
|
|
|
37
44
|
export const ALL_ERROR_CODES = [
|
|
38
45
|
ErrorCodes.AUTH_NO_TOKEN,
|
|
39
46
|
ErrorCodes.PUBLISH_EMPTY_PLAN,
|
|
47
|
+
ErrorCodes.NPM_MISSING_REPOSITORY,
|
|
40
48
|
];
|
|
41
49
|
//# sourceMappingURL=error-codes.js.map
|
package/dist/error-codes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;;;8CAG0C;IAC1C,aAAa,EAAE,oBAAoB;IACnC;;;;;;kDAM8C;IAC9C,kBAAkB,EAAE,yBAAyB;
|
|
1
|
+
{"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;;;8CAG0C;IAC1C,aAAa,EAAE,oBAAoB;IACnC;;;;;;kDAM8C;IAC9C,kBAAkB,EAAE,yBAAyB;IAC7C;;;;;0DAKsD;IACtD,sBAAsB,EAAE,6BAA6B;CAC7C,CAAC;AAIX;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAyB;IACnD,UAAU,CAAC,aAAa;IACxB,UAAU,CAAC,kBAAkB;IAC7B,UAAU,CAAC,sBAAsB;CAClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../src/handlers/npm.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAA6B,KAAK,OAAO,EAAwC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../src/handlers/npm.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAA6B,KAAK,OAAO,EAAwC,MAAM,aAAa,CAAC;AAgN5G;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAsBvE;AAYD,eAAO,MAAM,GAAG,EAAE,OAKjB,CAAC"}
|
package/dist/handlers/npm.js
CHANGED
|
@@ -13,6 +13,7 @@ import { join } from 'node:path';
|
|
|
13
13
|
import { normalizeTarget } from '../types.js';
|
|
14
14
|
import { looksLikePublishOverRace, normalizeBuild, publishPlatforms, } from './npm-platform.js';
|
|
15
15
|
import { buildSubprocessEnv, nonEmpty } from '../env.js';
|
|
16
|
+
import { ErrorCodes } from '../error-codes.js';
|
|
16
17
|
import { USER_AGENT } from '../version.js';
|
|
17
18
|
function npmNameFor(pkg) {
|
|
18
19
|
return pkg.npm ?? pkg.name;
|
|
@@ -88,9 +89,12 @@ async function publishImpl(pkg, version, ctx) {
|
|
|
88
89
|
}
|
|
89
90
|
const hasOidc = Boolean(nonEmpty(ctx.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN) ??
|
|
90
91
|
nonEmpty(process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN));
|
|
91
|
-
// npm provenance requires a `repository` field in
|
|
92
|
-
// that matches the git remote.
|
|
93
|
-
//
|
|
92
|
+
// npm provenance requires a non-empty `repository` field in
|
|
93
|
+
// package.json that matches the git remote. The primary check is
|
|
94
|
+
// `requireProvenanceMetadata` in src/preflight.ts (#280), which
|
|
95
|
+
// runs before any runner work. This inline assertion is a
|
|
96
|
+
// defensive backstop for direct handler calls that bypass the
|
|
97
|
+
// publish pipeline.
|
|
94
98
|
if (hasOidc) {
|
|
95
99
|
assertRepositoryField(pkg.path);
|
|
96
100
|
}
|
|
@@ -150,8 +154,23 @@ function assertRepositoryField(path) {
|
|
|
150
154
|
const pkgJsonPath = join(path, 'package.json');
|
|
151
155
|
const raw = readFileSync(pkgJsonPath, 'utf8');
|
|
152
156
|
const pkg = JSON.parse(raw);
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
const repository = pkg.repository;
|
|
158
|
+
// Accept either the canonical object form (`{ type, url, … }`) or
|
|
159
|
+
// the legacy single-string form. Both shapes must carry a non-empty
|
|
160
|
+
// URL after trimming. `!pkg.repository` would pass `{}` and
|
|
161
|
+
// `{ type: 'git' }` since both are truthy — that's the bug #280
|
|
162
|
+
// is closing.
|
|
163
|
+
let ok = false;
|
|
164
|
+
if (typeof repository === 'string') {
|
|
165
|
+
ok = repository.trim().length > 0;
|
|
166
|
+
}
|
|
167
|
+
else if (repository !== null && typeof repository === 'object') {
|
|
168
|
+
const url = repository.url;
|
|
169
|
+
ok = typeof url === 'string' && url.trim().length > 0;
|
|
170
|
+
}
|
|
171
|
+
if (!ok) {
|
|
172
|
+
throw new Error(`[${ErrorCodes.NPM_MISSING_REPOSITORY}] npm publish --provenance requires a non-empty \`repository\` field in ${pkgJsonPath}. ` +
|
|
173
|
+
'See https://github.com/thekevinscott/putitoutthere#kind--npm.');
|
|
155
174
|
}
|
|
156
175
|
}
|
|
157
176
|
/** Heuristic match on npm's auth-related stderr shapes. */
|
package/dist/handlers/npm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../src/handlers/npm.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EA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QAChE,sDAAsD;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,SAAS,YAAY,CAAC,MAAc;IAClC,MAAM,CAAC,GAAG,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,0GAA0G;IAC1G,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM;QAAE,OAAO,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAY;IAC1B,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,eAAe;IAC5B,YAAY,EAAE,gBAAgB;IAC9B,OAAO,EAAE,WAAW;CACrB,CAAC"}
|
package/dist/preflight.d.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pre-flight
|
|
3
|
-
* every cascaded package has usable credentials.
|
|
2
|
+
* Pre-flight checks. Run before any publish side effect.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* OIDC
|
|
8
|
-
*
|
|
4
|
+
* Auth (`requireAuth` / `checkAuth`) — every cascaded package has a
|
|
5
|
+
* viable credentials path. Per plan.md §16.3: each handler accepts
|
|
6
|
+
* OIDC (detected by `ACTIONS_ID_TOKEN_REQUEST_TOKEN`) or a specific
|
|
7
|
+
* long-lived env var.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* npm provenance metadata (`requireProvenanceMetadata` /
|
|
10
|
+
* `checkProvenanceMetadata`) — every npm package's `package.json`
|
|
11
|
+
* carries a non-empty `repository` field. `npm publish --provenance`
|
|
12
|
+
* (the OIDC trusted-publisher path) hard-requires this; failing
|
|
13
|
+
* here, before runner work, beats failing deep inside the npm CLI
|
|
14
|
+
* after artifact upload + OIDC negotiation. #280.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
16
|
+
* Each function reports; callers decide whether to throw. The
|
|
17
|
+
* `require*` variants are the publish path; the `check*` variants
|
|
18
|
+
* exist so future diagnostic surfaces can render tables instead of
|
|
19
|
+
* aborting.
|
|
20
|
+
*
|
|
21
|
+
* Issue #14, #280.
|
|
15
22
|
*/
|
|
16
23
|
import type { Package } from './config.js';
|
|
17
24
|
import type { Kind } from './types.js';
|
|
@@ -30,4 +37,38 @@ export interface AuthStatus {
|
|
|
30
37
|
}
|
|
31
38
|
export declare function checkAuth(packages: readonly Package[]): AuthStatus;
|
|
32
39
|
export declare function requireAuth(packages: readonly Package[]): void;
|
|
40
|
+
export interface ProvenanceFinding {
|
|
41
|
+
package: string;
|
|
42
|
+
/** Pkg-relative `package.json` path examined. */
|
|
43
|
+
packageJsonPath: string;
|
|
44
|
+
/** Why the field is unusable: missing entirely, or empty/no-url. */
|
|
45
|
+
reason: 'missing' | 'empty';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Scan every npm package's `package.json` for a non-empty `repository`
|
|
49
|
+
* field. Returns the list of findings; an empty list means every npm
|
|
50
|
+
* package is well-formed.
|
|
51
|
+
*
|
|
52
|
+
* `repository` is accepted in either the canonical object form
|
|
53
|
+
* (`{ type, url, directory? }`) or the legacy single-string form
|
|
54
|
+
* (`"git+https://…"`). The string form must be non-empty after
|
|
55
|
+
* trimming; the object form must carry a non-empty `url`.
|
|
56
|
+
*
|
|
57
|
+
* Non-npm packages and a malformed `package.json` (parse error) are
|
|
58
|
+
* skipped — other parts of the pipeline already cover those failure
|
|
59
|
+
* modes; this check is scoped to the `repository` field alone.
|
|
60
|
+
*/
|
|
61
|
+
export declare function checkProvenanceMetadata(packages: readonly Package[]): ProvenanceFinding[];
|
|
62
|
+
/**
|
|
63
|
+
* Throw with an actionable error when any npm package's `package.json`
|
|
64
|
+
* lacks a non-empty `repository` field. Reports every failing package
|
|
65
|
+
* in one error rather than failing on the first, so consumers fix
|
|
66
|
+
* them all in one round-trip.
|
|
67
|
+
*
|
|
68
|
+
* Always runs (not OIDC-gated): the README demands the field for
|
|
69
|
+
* every npm publish, and `npm publish --provenance` is putitoutthere's
|
|
70
|
+
* blessed publish mode. Even on the token path, missing `repository`
|
|
71
|
+
* is a misconfiguration — fail fast.
|
|
72
|
+
*/
|
|
73
|
+
export declare function requireProvenanceMetadata(packages: readonly Package[]): void;
|
|
33
74
|
//# sourceMappingURL=preflight.d.ts.map
|
package/dist/preflight.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAqBvC,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAClC,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,UAAU,CAgBlE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAiB9D;AAcD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC3B,iBAAiB,EAAE,CA0BrB;AAWD;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CA8B5E"}
|
package/dist/preflight.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pre-flight
|
|
3
|
-
* every cascaded package has usable credentials.
|
|
2
|
+
* Pre-flight checks. Run before any publish side effect.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* OIDC
|
|
8
|
-
*
|
|
4
|
+
* Auth (`requireAuth` / `checkAuth`) — every cascaded package has a
|
|
5
|
+
* viable credentials path. Per plan.md §16.3: each handler accepts
|
|
6
|
+
* OIDC (detected by `ACTIONS_ID_TOKEN_REQUEST_TOKEN`) or a specific
|
|
7
|
+
* long-lived env var.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* npm provenance metadata (`requireProvenanceMetadata` /
|
|
10
|
+
* `checkProvenanceMetadata`) — every npm package's `package.json`
|
|
11
|
+
* carries a non-empty `repository` field. `npm publish --provenance`
|
|
12
|
+
* (the OIDC trusted-publisher path) hard-requires this; failing
|
|
13
|
+
* here, before runner work, beats failing deep inside the npm CLI
|
|
14
|
+
* after artifact upload + OIDC negotiation. #280.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
16
|
+
* Each function reports; callers decide whether to throw. The
|
|
17
|
+
* `require*` variants are the publish path; the `check*` variants
|
|
18
|
+
* exist so future diagnostic surfaces can render tables instead of
|
|
19
|
+
* aborting.
|
|
20
|
+
*
|
|
21
|
+
* Issue #14, #280.
|
|
15
22
|
*/
|
|
23
|
+
import { readFileSync } from 'node:fs';
|
|
24
|
+
import { join } from 'node:path';
|
|
25
|
+
import { ErrorCodes } from './error-codes.js';
|
|
16
26
|
// Per-kind accepted env var names, primary first. `checkAuth` scans left
|
|
17
27
|
// to right and reports the first that has a non-empty value. npm takes
|
|
18
28
|
// two names because ecosystems have split on the convention:
|
|
@@ -67,4 +77,88 @@ export function requireAuth(packages) {
|
|
|
67
77
|
function nonEmpty(v) {
|
|
68
78
|
return typeof v === 'string' && v.trim().length > 0;
|
|
69
79
|
}
|
|
80
|
+
/* ----------------------- npm provenance metadata ----------------------- */
|
|
81
|
+
// Anchor for the README section that documents the field requirement.
|
|
82
|
+
// Surfaced verbatim in the thrown error so users have something
|
|
83
|
+
// actionable to follow rather than a code-search target.
|
|
84
|
+
const REPOSITORY_DOC_POINTER = 'https://github.com/thekevinscott/putitoutthere#kind--npm';
|
|
85
|
+
/**
|
|
86
|
+
* Scan every npm package's `package.json` for a non-empty `repository`
|
|
87
|
+
* field. Returns the list of findings; an empty list means every npm
|
|
88
|
+
* package is well-formed.
|
|
89
|
+
*
|
|
90
|
+
* `repository` is accepted in either the canonical object form
|
|
91
|
+
* (`{ type, url, directory? }`) or the legacy single-string form
|
|
92
|
+
* (`"git+https://…"`). The string form must be non-empty after
|
|
93
|
+
* trimming; the object form must carry a non-empty `url`.
|
|
94
|
+
*
|
|
95
|
+
* Non-npm packages and a malformed `package.json` (parse error) are
|
|
96
|
+
* skipped — other parts of the pipeline already cover those failure
|
|
97
|
+
* modes; this check is scoped to the `repository` field alone.
|
|
98
|
+
*/
|
|
99
|
+
export function checkProvenanceMetadata(packages) {
|
|
100
|
+
const findings = [];
|
|
101
|
+
for (const p of packages) {
|
|
102
|
+
if (p.kind !== 'npm')
|
|
103
|
+
continue;
|
|
104
|
+
const pkgJsonPath = join(p.path, 'package.json');
|
|
105
|
+
let raw;
|
|
106
|
+
try {
|
|
107
|
+
raw = readFileSync(pkgJsonPath, 'utf8');
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
findings.push({ package: p.name, packageJsonPath: pkgJsonPath, reason: 'missing' });
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
let parsed;
|
|
114
|
+
try {
|
|
115
|
+
parsed = JSON.parse(raw);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
// A malformed package.json is a different failure surface;
|
|
119
|
+
// leave it to the publish step to bubble up. This check only
|
|
120
|
+
// owns the `repository` field.
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (!hasNonEmptyRepository(parsed.repository)) {
|
|
124
|
+
findings.push({ package: p.name, packageJsonPath: pkgJsonPath, reason: 'empty' });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return findings;
|
|
128
|
+
}
|
|
129
|
+
function hasNonEmptyRepository(value) {
|
|
130
|
+
if (typeof value === 'string')
|
|
131
|
+
return value.trim().length > 0;
|
|
132
|
+
if (value !== null && typeof value === 'object') {
|
|
133
|
+
const url = value.url;
|
|
134
|
+
return typeof url === 'string' && url.trim().length > 0;
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Throw with an actionable error when any npm package's `package.json`
|
|
140
|
+
* lacks a non-empty `repository` field. Reports every failing package
|
|
141
|
+
* in one error rather than failing on the first, so consumers fix
|
|
142
|
+
* them all in one round-trip.
|
|
143
|
+
*
|
|
144
|
+
* Always runs (not OIDC-gated): the README demands the field for
|
|
145
|
+
* every npm publish, and `npm publish --provenance` is putitoutthere's
|
|
146
|
+
* blessed publish mode. Even on the token path, missing `repository`
|
|
147
|
+
* is a misconfiguration — fail fast.
|
|
148
|
+
*/
|
|
149
|
+
export function requireProvenanceMetadata(packages) {
|
|
150
|
+
const findings = checkProvenanceMetadata(packages);
|
|
151
|
+
if (findings.length === 0)
|
|
152
|
+
return;
|
|
153
|
+
const lines = [
|
|
154
|
+
`[${ErrorCodes.NPM_MISSING_REPOSITORY}] npm publish requires a non-empty \`repository\` field in package.json.`,
|
|
155
|
+
'',
|
|
156
|
+
'Failing packages:',
|
|
157
|
+
];
|
|
158
|
+
for (const f of findings) {
|
|
159
|
+
lines.push(` - ${f.package}: ${f.packageJsonPath} (${f.reason})`);
|
|
160
|
+
}
|
|
161
|
+
lines.push('', 'Why: `npm publish --provenance` (used by putitoutthere on the OIDC trusted-publisher', 'path) hard-requires this field so npm can verify the package was built from the repo', 'the trusted publisher declares.', '', 'Fix: add a `repository` block to each failing package.json. Canonical shape:', '', ' {', ' "repository": {', ' "type": "git",', ' "url": "git+https://github.com/<owner>/<repo>.git",', ' "directory": "<path/to/package>"', ' }', ' }', '', `See ${REPOSITORY_DOC_POINTER}.`);
|
|
162
|
+
throw new Error(lines.join('\n'));
|
|
163
|
+
}
|
|
70
164
|
//# sourceMappingURL=preflight.js.map
|
package/dist/preflight.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,yEAAyE;AACzE,uEAAuE;AACvE,6DAA6D;AAC7D,oEAAoE;AACpE,kEAAkE;AAClE,yDAAyD;AACzD,uEAAuE;AACvE,uCAAuC;AACvC,MAAM,SAAS,GAAoC;IACjD,MAAM,EAAE,CAAC,sBAAsB,CAAC;IAChC,IAAI,EAAE,CAAC,gBAAgB,CAAC;IACxB,GAAG,EAAE,C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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;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;CAC/E;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH,OAAO,EAA6B,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAGzF,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,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;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;CAC/E;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAyI1E"}
|
package/dist/publish.js
CHANGED
|
@@ -24,7 +24,7 @@ import { handlerFor as defaultHandlerFor } from './handlers/index.js';
|
|
|
24
24
|
import { createLogger } from './log.js';
|
|
25
25
|
import { plan } from './plan.js';
|
|
26
26
|
import { formatTag } from './tag-template.js';
|
|
27
|
-
import { requireAuth } from './preflight.js';
|
|
27
|
+
import { requireAuth, requireProvenanceMetadata } from './preflight.js';
|
|
28
28
|
import { withRetry } from './retry.js';
|
|
29
29
|
import { readHandlerMeta } from './types.js';
|
|
30
30
|
import { dumpFailure } from './verbose.js';
|
|
@@ -66,6 +66,11 @@ export async function publish(opts) {
|
|
|
66
66
|
// auth path (OIDC env or env-var token) before any side effects.
|
|
67
67
|
const selectedPackages = [...perPackage.keys()].map((name) => mustGet(config.packages, name));
|
|
68
68
|
requireAuth(selectedPackages);
|
|
69
|
+
// 2b. Pre-flight npm provenance metadata: every selected npm package's
|
|
70
|
+
// package.json must carry a non-empty `repository` field. Without
|
|
71
|
+
// it, `npm publish --provenance` fails deep inside the npm CLI
|
|
72
|
+
// after the runner has spun up — checkable in milliseconds. #280.
|
|
73
|
+
requireProvenanceMetadata(selectedPackages);
|
|
69
74
|
// 3. Artifact completeness.
|
|
70
75
|
const completeness = checkCompleteness(matrix, artifactsRoot(cwd));
|
|
71
76
|
const incomplete = [...completeness.entries()].filter(([, r]) => !r.ok);
|
package/dist/publish.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAW,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QACzB,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,GAAG,CACN,CAAC,CAAC,IAAI,EACN,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACjD,CAAC;QACJ,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAQ,EAAE;QACnC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,QAAQ;QAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-build version bump used by `_matrix.yml`'s maturin steps. #276.
|
|
3
|
+
*
|
|
4
|
+
* Maturin reads `[project].version` from `pyproject.toml` (or
|
|
5
|
+
* `[package].version` from a sibling `Cargo.toml` when pyproject
|
|
6
|
+
* declares `dynamic = ["version"]`) at build time. There is no env
|
|
7
|
+
* override the build job can inject — `SETUPTOOLS_SCM_PRETEND_VERSION`
|
|
8
|
+
* is honored by hatch-vcs / setuptools-scm but not by maturin. So
|
|
9
|
+
* the on-disk manifest has to be rewritten before `maturin build`
|
|
10
|
+
* runs. crates and npm bump at publish (cargo / npm read the
|
|
11
|
+
* manifest at upload time, not before); maturin is the one path
|
|
12
|
+
* where the artifact (the wheel) leaves the build runner already
|
|
13
|
+
* versioned.
|
|
14
|
+
*
|
|
15
|
+
* This module is the build-time complement to `pypi.writeVersion`.
|
|
16
|
+
* The publish-time handler logs guidance for dynamic-version
|
|
17
|
+
* projects rather than rewriting Cargo.toml; here we actually do
|
|
18
|
+
* the rewrite, because the build step has no fallback.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Rewrite the version source(s) for a maturin package and return the
|
|
22
|
+
* list of absolute paths that were modified.
|
|
23
|
+
*
|
|
24
|
+
* Dispatch:
|
|
25
|
+
* - `[project].version = "..."` is a static literal → rewrite
|
|
26
|
+
* pyproject.toml in place. If a sibling `Cargo.toml` with a
|
|
27
|
+
* `[package].version` line is present, rewrite it too. This is
|
|
28
|
+
* not redundant: a python-rust-maturin shape with both a static
|
|
29
|
+
* pyproject literal AND a Cargo `[package].version` literal will
|
|
30
|
+
* have the two manifests disagree post-bump if only pyproject is
|
|
31
|
+
* rewritten, and maturin's mismatch-resolution behavior varies
|
|
32
|
+
* by platform / version (PR #277 hit this on Windows: wheels
|
|
33
|
+
* shipped at the stale Cargo literal even though pyproject was
|
|
34
|
+
* bumped). Bumping both keeps the contract straightforward.
|
|
35
|
+
* - `[project].dynamic = ["version", ...]` → rewrite the sibling
|
|
36
|
+
* `Cargo.toml`'s `[package].version`. Errors if Cargo.toml is
|
|
37
|
+
* missing.
|
|
38
|
+
*
|
|
39
|
+
* Throws on missing pyproject.toml, malformed TOML, or a `[project]`
|
|
40
|
+
* table that declares neither a literal nor `dynamic = ["version"]`.
|
|
41
|
+
*
|
|
42
|
+
* I/O uses `readFileSync` with `try` / `catch (ENOENT)` instead of an
|
|
43
|
+
* `existsSync` precheck — the precheck is a TOCTOU race CodeQL flags
|
|
44
|
+
* (`pull/277` advisories #13, #14), and `pypi.writeVersion` already
|
|
45
|
+
* uses the same try/catch shape we mirror here.
|
|
46
|
+
*/
|
|
47
|
+
export declare function writeVersionForBuild(pkgDir: string, version: string): string[];
|
|
48
|
+
//# sourceMappingURL=write-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-version.d.ts","sourceRoot":"","sources":["../src/write-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAUH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA6E9E"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-build version bump used by `_matrix.yml`'s maturin steps. #276.
|
|
3
|
+
*
|
|
4
|
+
* Maturin reads `[project].version` from `pyproject.toml` (or
|
|
5
|
+
* `[package].version` from a sibling `Cargo.toml` when pyproject
|
|
6
|
+
* declares `dynamic = ["version"]`) at build time. There is no env
|
|
7
|
+
* override the build job can inject — `SETUPTOOLS_SCM_PRETEND_VERSION`
|
|
8
|
+
* is honored by hatch-vcs / setuptools-scm but not by maturin. So
|
|
9
|
+
* the on-disk manifest has to be rewritten before `maturin build`
|
|
10
|
+
* runs. crates and npm bump at publish (cargo / npm read the
|
|
11
|
+
* manifest at upload time, not before); maturin is the one path
|
|
12
|
+
* where the artifact (the wheel) leaves the build runner already
|
|
13
|
+
* versioned.
|
|
14
|
+
*
|
|
15
|
+
* This module is the build-time complement to `pypi.writeVersion`.
|
|
16
|
+
* The publish-time handler logs guidance for dynamic-version
|
|
17
|
+
* projects rather than rewriting Cargo.toml; here we actually do
|
|
18
|
+
* the rewrite, because the build step has no fallback.
|
|
19
|
+
*/
|
|
20
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
21
|
+
import { join } from 'node:path';
|
|
22
|
+
import { parse as parseToml } from 'smol-toml';
|
|
23
|
+
import { replaceCargoVersion } from './handlers/crates.js';
|
|
24
|
+
import { replacePyProjectVersion } from './handlers/pypi.js';
|
|
25
|
+
/**
|
|
26
|
+
* Rewrite the version source(s) for a maturin package and return the
|
|
27
|
+
* list of absolute paths that were modified.
|
|
28
|
+
*
|
|
29
|
+
* Dispatch:
|
|
30
|
+
* - `[project].version = "..."` is a static literal → rewrite
|
|
31
|
+
* pyproject.toml in place. If a sibling `Cargo.toml` with a
|
|
32
|
+
* `[package].version` line is present, rewrite it too. This is
|
|
33
|
+
* not redundant: a python-rust-maturin shape with both a static
|
|
34
|
+
* pyproject literal AND a Cargo `[package].version` literal will
|
|
35
|
+
* have the two manifests disagree post-bump if only pyproject is
|
|
36
|
+
* rewritten, and maturin's mismatch-resolution behavior varies
|
|
37
|
+
* by platform / version (PR #277 hit this on Windows: wheels
|
|
38
|
+
* shipped at the stale Cargo literal even though pyproject was
|
|
39
|
+
* bumped). Bumping both keeps the contract straightforward.
|
|
40
|
+
* - `[project].dynamic = ["version", ...]` → rewrite the sibling
|
|
41
|
+
* `Cargo.toml`'s `[package].version`. Errors if Cargo.toml is
|
|
42
|
+
* missing.
|
|
43
|
+
*
|
|
44
|
+
* Throws on missing pyproject.toml, malformed TOML, or a `[project]`
|
|
45
|
+
* table that declares neither a literal nor `dynamic = ["version"]`.
|
|
46
|
+
*
|
|
47
|
+
* I/O uses `readFileSync` with `try` / `catch (ENOENT)` instead of an
|
|
48
|
+
* `existsSync` precheck — the precheck is a TOCTOU race CodeQL flags
|
|
49
|
+
* (`pull/277` advisories #13, #14), and `pypi.writeVersion` already
|
|
50
|
+
* uses the same try/catch shape we mirror here.
|
|
51
|
+
*/
|
|
52
|
+
export function writeVersionForBuild(pkgDir, version) {
|
|
53
|
+
const pyProjectPath = join(pkgDir, 'pyproject.toml');
|
|
54
|
+
let pyOriginal;
|
|
55
|
+
try {
|
|
56
|
+
pyOriginal = readFileSync(pyProjectPath, 'utf8');
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
if (err.code === 'ENOENT') {
|
|
60
|
+
throw new Error(`write-version: pyproject.toml not found at ${pyProjectPath}`, {
|
|
61
|
+
cause: err,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/* v8 ignore next -- non-ENOENT read errors surface as-is */
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
let parsed;
|
|
68
|
+
try {
|
|
69
|
+
parsed = parseToml(pyOriginal);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
73
|
+
throw new Error(`write-version: failed to parse ${pyProjectPath}: ${msg}`, { cause: err });
|
|
74
|
+
}
|
|
75
|
+
const project = parsed?.project;
|
|
76
|
+
if (!project) {
|
|
77
|
+
throw new Error(`write-version: ${pyProjectPath} has no [project] table -- declare [project].version or [project].dynamic = ["version"]`);
|
|
78
|
+
}
|
|
79
|
+
const cargoPath = join(pkgDir, 'Cargo.toml');
|
|
80
|
+
if (isDynamicVersion(project)) {
|
|
81
|
+
let cargoOriginal;
|
|
82
|
+
try {
|
|
83
|
+
cargoOriginal = readFileSync(cargoPath, 'utf8');
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
if (err.code === 'ENOENT') {
|
|
87
|
+
throw new Error(`write-version: pyproject.toml declares dynamic = ["version"] but Cargo.toml is missing at ${cargoPath}. Maturin's dynamic-version mode reads [package].version from Cargo.toml; without it there's nothing to bump.`, { cause: err });
|
|
88
|
+
}
|
|
89
|
+
/* v8 ignore next -- non-ENOENT read errors surface as-is */
|
|
90
|
+
throw err;
|
|
91
|
+
}
|
|
92
|
+
const cargoUpdated = replaceCargoVersion(cargoOriginal, version);
|
|
93
|
+
if (cargoUpdated !== cargoOriginal)
|
|
94
|
+
writeFileSync(cargoPath, cargoUpdated, 'utf8');
|
|
95
|
+
return [cargoPath];
|
|
96
|
+
}
|
|
97
|
+
const written = [];
|
|
98
|
+
const pyUpdated = replacePyProjectVersion(pyOriginal, version);
|
|
99
|
+
if (pyUpdated !== pyOriginal)
|
|
100
|
+
writeFileSync(pyProjectPath, pyUpdated, 'utf8');
|
|
101
|
+
written.push(pyProjectPath);
|
|
102
|
+
// Bump a sibling Cargo.toml's [package].version too, when present.
|
|
103
|
+
// Pure-python pyproject (no Rust crate) → no Cargo.toml → skip.
|
|
104
|
+
// Cargo.toml without [package].version (workspace root) → skip
|
|
105
|
+
// (replaceCargoVersion throws on missing field; catch and continue).
|
|
106
|
+
let cargoOriginal;
|
|
107
|
+
try {
|
|
108
|
+
cargoOriginal = readFileSync(cargoPath, 'utf8');
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
if (err.code === 'ENOENT')
|
|
112
|
+
return written;
|
|
113
|
+
/* v8 ignore next -- non-ENOENT read errors surface as-is */
|
|
114
|
+
throw err;
|
|
115
|
+
}
|
|
116
|
+
let cargoUpdated;
|
|
117
|
+
try {
|
|
118
|
+
cargoUpdated = replaceCargoVersion(cargoOriginal, version);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// No [package].version in Cargo.toml — nothing to bump on the
|
|
122
|
+
// Cargo side. The pyproject bump above is the source of truth.
|
|
123
|
+
return written;
|
|
124
|
+
}
|
|
125
|
+
if (cargoUpdated !== cargoOriginal)
|
|
126
|
+
writeFileSync(cargoPath, cargoUpdated, 'utf8');
|
|
127
|
+
written.push(cargoPath);
|
|
128
|
+
return written;
|
|
129
|
+
}
|
|
130
|
+
function isDynamicVersion(project) {
|
|
131
|
+
const { dynamic } = project;
|
|
132
|
+
return Array.isArray(dynamic) && dynamic.includes('version');
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=write-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-version.js","sourceRoot":"","sources":["../src/write-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,E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