Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): extra parameters support for run tool #658

Merged
merged 1 commit into from
Mar 18, 2023

Conversation

mrfelton
Copy link
Contributor

@mrfelton mrfelton commented Mar 17, 2023

Fix #657

Example usage in custom executor:

const { name, context, project, outputDir, additionalArguments } = options;
const projectDir = normalizePath(dirname(projectFile));
const paramaters = {
    'startup-project': pathResolve(workspaceRoot, projectDir),
    'project': pathResolve(workspaceRoot, project),
    'context': context,
    'msbuildprojectextensionspath': pathResolve(workspaceRoot, `./dist/intermediates/${project}/obj`)
}
if (outputDir) {
    paramaters['output-dir'] = pathResolve(workspaceRoot, outputDir)
}
let extraParameters;
if (additionalArguments) {
    extraParameters = `-- ${additionalArguments}`;
}
dotnetClient.runTool('dotnet-ef', ['migrations', 'add', name ], paramaters, extraParameters);

With a target like this:

"ef-migrations": {
  "executor": "@org/dotnet-ef:migrations",
  "options": {
    "context": "AppDbContext",
    "project": "src/Shared.EventBus.IntegrationTests",
    "outputDir": "src/Shared.EventBus.IntegrationTests/Persistence/Migrations/EventBus",
    "additionalArguments": "-- Schema=test Assembly=Shared.EventBus.IntegrationTests"
  }
}

@nx-cloud
Copy link

nx-cloud bot commented Mar 17, 2023

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@AgentEnder AgentEnder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great 👍

Do you want to follow up with a @nx-dotnet/core:run-tool executor? It's been something I've wanted to add to the plugin for a while but not gotten to.

@mrfelton
Copy link
Contributor Author

Do you want to follow up with a @nx-dotnet/core:run-tool executor? It's been something I've wanted to add to the plugin for a while but not gotten to.

The one I've been working on is a dotnet-ef executor. Is that something you'd be interested in adding to @nx-dotnet/core?

@AgentEnder
Copy link
Member

I'd prefer to start with a generic run-tool executor, ef stuff wouldn't be bad to add eventually though

@AgentEnder AgentEnder merged commit fe4bc14 into nx-dotnet:master Mar 18, 2023
github-actions bot pushed a commit that referenced this pull request Mar 18, 2023
# [1.21.0](v1.20.0...v1.21.0) (2023-03-18)

### Features

* **core:** extra parameters support for run tool ([#658](#658)) ([fe4bc14](fe4bc14))

Mar 18, 2023, 5:55 AM
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mrfelton mrfelton deleted the feat/run-tool-extra-parameters branch March 18, 2023 06:51
@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to pass extra parameters to runTool
2 participants