Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ignore Nx configuration's
targets
keyNx targets are configured in a project's configuration file like this:
Previously, this plugin had been using that <target-name> to determine which type of command to execute. However, users should be permitted to assign whatever string they'd like to those keys without affecting the behavior of the invoked executor. This PR reworks the
parseArgs
function to take a separate parameter for thecargo
command to execute, which we determine solely by which of the plugin's executors was invoked.Add a dedicated
run
executorInline with the above changes, a new
@nxrs/cargo:run
executor has been added to handlecargo run ...
commands. This executor was actually the main motivator for the changes above — if the Nx config's target key isrun
, users can no longer use the shorthand form for invoking that target (i.e.,nx <target> <project>
instead ofnx run <project>:<target>
), because it collides with the built-innx run
command.With these changes, the
run
executor can be configured like so:And users can invoke that target by running
nx dev <project>
.The default output from this plugin's
bin
generator also now outputs the configuration above instead of usingrun
as the target key, but users are welcome to change that key to whatever they'd like.Additional changes to executor processing
bin
argument, so you can specify a particular binary target when runningbuild
,run
, etc. This fixes [bug] Cannot build when the crate and bin name differ #20.parseArgs
function will now pass any unknown options it receives directly through tocargo
, after prefixing them with--
and converting them to kebab-case. This should help with future-proofing this plugin in the absence of specific updates to support additional arguments supported bycargo
in the future.