Commit Graph

9 Commits

Author SHA1 Message Date
apk eec83f853e refactor: fold accidental code clones in the Rust workspace
`jscpd rust/` reported 48 clones. This folds every one that was repetition
rather than a deliberate copy, leaving 34 across `rust/` and 14 in
`rust/crates`, all of the kinds the #1053 pass kept on purpose: fixture
corpora, `use` blocks, the TypeScript file and its JavaScript twin,
`impl Reporter` headers and the `ts_strip` visitor pair.

- basta's JSONC reader copied a string-skipping loop into both `strip_jsonc`
  and `drop_trailing_commas`. It is now `strip_comments` followed by a comma
  pass over `lang::outside_strings`, the quote-aware scanning the bundler
  config readers already share.
- The JavaScript and Python analyzer tests each built their own module
  index, import lookup, binding-reference lookup and member-read list. They
  live once in `test_scan` as `index_of`, `import`, `binding_reference` and
  `member_reads`.
- `test_scan::TempTree` writes a test's files and removes them when dropped,
  so a failing assertion no longer leaves its directory behind; the script
  and `extends` tests that repeated the setup use it.
- Four tsconfig `paths` tests with one shape are one table-driven test.
- The CLI integration tests share `duplicate_shapes`, `history_stdout` and
  `assert_only_the_real_file_was_scanned`.
- `scripts/publish-npm.sh` repeated a 43-line "publish the platform package,
  then the main packages under --force-main" tail in two branches, and the
  "publish unless already live, or show the dry run" block five times. They
  are `publish_platform_target` and `publish_package`. Run against the old
  script with the build, the registry check and `npm` stubbed, all eleven
  combinations of --target, --all, --force-main, --dry-run, --provenance, a
  failed build and missing platforms print the same lines and exit the same.

Behaviour is unchanged: the fixtures corpus reports in every mode, the
summary, the console output and the dead-code demo are byte-identical.
2026-09-17 15:15:11 +02:00
apk b0c31a4042 chore: apply audit fixes across repo, crates, npm wrapper and pipelines
Rust / crates.io
- report the invoked binary name in --version/--help (jscpd vs cpd)
- add repository, documentation, keywords, categories to all crates
- exclude tests/ from the jscpd crate package; add cargo-binstall metadata
- expand the crates.io README and render it on docs.rs

npm
- add funding field to jscpd, cpd and jscpd@4 packages
- add jscpd-linux-arm64-musl platform package and clearer unsupported-platform error
- enable provenance for the v4 changeset publish

Pipelines
- rust.yml: windows-latest in the matrix, drop dead schedule guard
- release.yml: cosign-sign release assets, floating v5 tag, LICENSE in tarballs,
  invoke the new docker.yml (GHCR multi-arch image) after each release
- audit.yml: nightly cargo audit, cargo deny and pnpm audit
- Dockerfile: multi-stage image from release binaries (distroless), mcp target for Glama

Docs / community
- README: shields badges, single primary install per OS, GitHub Action snippet,
  link to jscpd.dev, v5.1 features, 15 reporters, 224 formats, 8 platforms
- docs: @v5 action tag, Docker usage, baseline section, current crate versions
- YAML issue forms with engine selector, config.yml, CODEOWNERS
- remove stale .github/CONTRIBUTING.md stub, custom.md, TODO.md; untrack rust/jscpd-report.json
- examples: mark as v4 API, add a Rust cpd-finder example
2026-09-02 09:57:06 +02:00
Marvin Luchs b01910ddc2 feat: add support for Windows on ARM 2026-08-26 16:47:39 +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 c4c7aaaf46 feat: add --force-main flag to publish-npm.sh for publishing with available platforms only 2026-06-05 13:37:18 +02:00
apk 47320fecd4 fix: handle build failures gracefully in publish-npm.sh --all mode 2026-06-05 12:52:52 +02:00
apk cd71b226f1 feat: add --all flag to publish-npm.sh for all 6 platforms + main package 2026-06-05 12:50:15 +02:00
apk 1fff3e4912 fix: make --provenance optional in publish-npm.sh (requires GitHub Actions OIDC) 2026-06-05 12:46:12 +02:00
apk ddb3f42dd9 feat: add publish-npm.sh script for local npm publishing 2026-06-05 12:43:44 +02:00