Commit Graph

5 Commits

Author SHA1 Message Date
apk b718753839 chore(basta): ship basta on its own trigger, separate from the jscpd release
basta is a separate product from jscpd — a different question about the
same tree — so it gets its own version, its own prebuilt packages and its
own trigger. jscpd goes out on every push to master that leaves a version
unpublished; basta goes out only when a `basta-v*` tag is pushed, or by
hand through workflow_dispatch. Neither release can drag the other along
or hold it up.

`basta-release.yml` owns the whole thing: it checks that the crate, the npm
manifest and the tag all name the same version and that the working tree is
already synced, publishes the crate, builds the eight targets and publishes
`basta-<platform>` plus the `basta` wrapper. It ends by asserting that npm's
`latest` really points at this release — the package carries 1.x versions
from an unrelated tool of the same name, and a dist-tag that quietly stayed
on those would hand every `npm i basta` the wrong program.

The one place the two cannot be separated is crates.io: `jscpd` depends on
`basta`, so cargo refuses to publish jscpd until a matching basta exists.
The jscpd crates job therefore still publishes basta when it is missing, and
that is now commented as the dependency requirement it is. Both paths skip a
version already on the registry, so whichever runs first wins.

npm needed the wrapper pattern `jscpd` and `cpd` already use: `rust/basta/`
holds the manifest, a platform map naming `basta-<platform>`, and a launcher
that falls back to a local `cargo build` when no platform package is
installed. `npm-prebuilt-package.mjs` grew a `--product` flag; its output for
jscpd is byte-identical to before. `prebuilt-targets.json` now carries a
platform label rather than a jscpd-specific blurb, so one table serves both
products. `sync-version.mjs` syncs and verifies the basta wrapper against the
basta crate version — the same independent version/pin update the jscpd block
does, for the same reason it does it.

Nothing is published by this commit.

Claude-Session: https://claude.ai/code/session_01WztdFKZAwW9b51iJe9zhtV
2026-09-16 11:01:06 +02:00
Andrey Kucherenko ff1ae361fb fix(rust): rename cpd binary and npm platform packages to jscpd
Renames the compiled binary from cpd(.exe) to jscpd(.exe) and the
platform-specific optional-dependency npm packages from cpd-* to
jscpd-* to avoid collision with an antivirus-flagged executable name.

Fixes #826
2026-07-08 17:38:18 +02:00
apk bacf67bb6d feat: add jscpd npm package (v5.x, Rust-based) and fix --exit-code to match v4 behavior
- Add rust/jscpd/ npm package: same Rust binary as cpd, published as
  'jscpd' on npm with version 5.x (matching cpd). Exposes 'jscpd'
  CLI command, depends on cpd-* platform packages.

- Fix --exit-code: changed from boolean to Option<i32> with
  default_missing_value=1, matching jscpd v4's --exitCode behavior.
  --exit-code (no value) exits 1 on clones; --exit-code 2 exits 2.
  --threshold and --exit-code are now independent (matching v4).

- Update CI: add publish-jscpd job after cpd with fixture verification
  gate (installs cpd, runs on ./fixtures, then publishes jscpd).

- Update publish-npm.sh: publish jscpd wrapper after cpd with
  fixture check in --all, --target, and default modes.

- Update sync-version.mjs: sync jscpd/package.json version alongside
  cpd's.

- Update README docs across cpd, jscpd, and npm packages to document
  v5.x as Rust-based and v4.x as TypeScript, and fix --exit-code docs.
2026-06-08 08:07:35 +02:00
apk 7eccb4f244 fix: resolve LICENSE path from repo root instead of rust/ 2026-06-05 12:45:17 +02:00
apk 2dabdc766a feat: add publish pipelines for Rust jscpd (npm + crates.io)
- Add npm package scaffold for cpd@5.0.0 with prebuilt binary distribution
  - rust/package.json: main cpd package with optionalDependencies for 6 platforms
  - rust/run-cpd.js: CLI shim with platform detection and binary resolution
  - rust/platform-map.js: platform detection (6 targets including musl)
  - rust/npm/prebuilt-targets.json: platform matrix configuration
  - rust/npm/cpd-*/package.json: platform package templates
  - rust/scripts/npm-prebuilt-package.mjs: assembles platform packages from binaries

- Add GitHub Actions workflows
  - .github/workflows/crates-publish.yml: publishes all 5 crates to crates.io
    in dependency order with OIDC Trusted Publishing and index-wait polling
  - .github/workflows/npm-rust-publish.yml: cross-compiles for 6 platforms,
    publishes platform packages with idempotency checks, then main cpd package
  - .github/workflows/release-rust.yml: orchestrator triggered by push to
    release/rust branch, creates GitHub Release with cpd-v<version> tag

- Configure Rust crates for publishing
  - Change binary name from jscpd to cpd (crate name stays jscpd)
  - Convert inter-crate deps to dual version+path format for crates.io
  - Update integration tests for cpd binary name

- Add build and release scripts
  - rust/scripts/sync-version.mjs: syncs version from package.json to Cargo.toml
  - rust/scripts/publish-crates.sh: manual crates.io publish with dependency ordering

- Document pnpm workspace exclusion for rust/ directory
2026-06-05 11:37:08 +02:00