Use in CI
jscycles fails the build when it finds cycles (status 1) or cannot complete the scan (status 2).
GitHub Actions
Section titled “GitHub Actions”If the project already installs jscycles from npm:
- run: npx jscyclesOr download a verified release binary, with no Node.js needed:
- name: Check for circular imports run: | version=v0.2.0 base=https://github.com/ALMaclaine/jscycles/releases/download/$version curl -sSfLO "$base/jscycles-linux-x86_64" curl -sSfLO "$base/SHA256SUMS" sha256sum --check --ignore-missing SHA256SUMS chmod +x jscycles-linux-x86_64 ./jscycles-linux-x86_64Adopting it in a codebase with cycles
Section titled “Adopting it in a codebase with cycles”Start with --only or --exclude for the packages that are clean, or with
--outer for package cycles only, and widen the check as cycles are fixed.
pre-commit
Section titled “pre-commit”With pre-commit, using a binary on PATH:
repos: - repo: local hooks: - id: jscycles name: jscycles entry: jscycles --quiet language: system pass_filenames: false types_or: [javascript, jsx, ts, tsx]Machine-readable results
Section titled “Machine-readable results”--json prints a stable report for other tools; see
output and JSON. Always check the exit status before trusting a
report.