{"id":25057,"library":"cargo-cp-artifact","title":"cargo-cp-artifact","description":"Small CLI utility for copying Rust compiler artifacts (binaries, cdylibs, dylibs) produced by cargo to a specified output file. Current stable version 0.1.9, released as part of the Neon bindings ecosystem. Parses cargo's JSON metadata output (via --message-format=json) to reliably locate artifacts regardless of build profile or target. Differentiators: works with npm script integration via --npm flag, supports multiple artifact mappings, and wraps arbitrary commands as a child process. Not actively maintained; last release in 2023.","status":"maintenance","version":"0.1.9","language":"javascript","source_language":"en","source_url":"https://github.com/neon-bindings/neon","tags":["javascript","cargo","rust","neon"],"install":[{"cmd":"npm install cargo-cp-artifact","lang":"bash","label":"npm"},{"cmd":"yarn add cargo-cp-artifact","lang":"bash","label":"yarn"},{"cmd":"pnpm add cargo-cp-artifact","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Typically installed globally or used via npx. No JavaScript API; pure CLI tool.","wrong":"npm install cargo-cp-artifact (local install)","symbol":"cli tool","correct":"npm install -g cargo-cp-artifact"},{"note":"The -- separator is required to distinguish cargo-cp-artifact args from wrapped command args.","wrong":"npx cargo-cp-artifact -a cdylib my-crate lib/index.node cargo build (missing -- separator)","symbol":"npx usage","correct":"npx cargo-cp-artifact -a cdylib my-crate lib/index.node -- cargo build --message-format=json-render-diagnostics"},{"note":"--npm flag reads npm_package_name env var automatically. Avoid manual env references.","wrong":"\"build\": \"cargo-cp-artifact -a cdylib %npm_package_name% lib/index.node -- cargo build\"","symbol":"npm script usage","correct":"\"build\": \"cargo-cp-artifact -nc lib/index.node -- cargo build --message-format=json-render-diagnostics\""}],"quickstart":{"code":"npm install -g cargo-cp-artifact\n\n# In a Rust project that produces a cdylib named 'my_crate'\nmkdir -p lib\ncargo-cp-artifact -a cdylib my_crate lib/index.node -- cargo build --release --message-format=json-render-diagnostics\n\n# Verify artifact was copied\nls -la lib/index.node","lang":"javascript","description":"Installs cargo-cp-artifact globally and uses it to copy a Rust cdylib to a .node file after building with cargo."},"warnings":[{"fix":"Use -- before the wrapped command, e.g., cargo-cp-artifact -a cdylib my-crate lib/index.node -- cargo build --message-format=json-render-diagnostics","message":"The -- separator is required between cargo-cp-artifact arguments and the wrapped command. Omitting it causes unexpected behavior.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use only 'bin', 'cdylib', or 'dylib' (or abbreviations 'b', 'c', 'd').","message":"Artifact kind must match exactly: 'bin', 'cdylib', or 'dylib'. Alternatives like 'staticlib' will not be recognized.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use the exact Cargo.toml [package] name. For npm integration, ensure npm_package_name matches or use --npm flag with proper env variable.","message":"The crate name must match the Cargo.toml package name, not the directory name or the package name with hyphens. Hyphens in Cargo names are automatically converted to underscores in artifact names.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Verify crate name in Cargo.toml and artifact kind (cdylib, bin, etc.). Use cargo build --release --message-format=json to see available artifacts.","cause":"Crate name or artifact kind does not match any artifact emitted by cargo.","error":"Error: No matching artifacts found for pattern"},{"fix":"Provide three values: artifact-kind crate-name output-file, e.g., --artifact cdylib my-crate lib/index.node","cause":"Missing the third argument (output file) for --artifact.","error":"Error: The argument '--artifact' requires 3 arguments but only 2 were provided"},{"fix":"Use one of: bin, cdylib, dylib (or abbreviations b, c, d).","cause":"Unsupported artifact kind specified.","error":"Error: unknown artifact kind 'staticlib'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}