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

Support for globbing in script names #79

Merged
merged 2 commits into from
Aug 13, 2022
Merged

Support for globbing in script names #79

merged 2 commits into from
Aug 13, 2022

Conversation

xt0rted
Copy link
Owner

@xt0rted xt0rted commented Aug 12, 2022

This lets you run multiple scripts in series using wildcards. This means test:* will match test:unit and test:integration and run them in series in the order they're listed in the global.json file.

Globbing is handled by the DotNet.Glob library and supports all of its patterns and wildcards. This may need to change based on user feedback and performance.

Working on this made me realize there's a lot of code to make script names case insensitive while npm is case sensitive. To simplify things and reduce the possibility of bugs we should probably do the same.

@@ -77,32 +79,29 @@ public async Task<int> InvokeAsync(InvocationContext context)
return 0;
}

// The `env` script is special so if it's not explicitly declared we act like it was
var scriptsToRun = scripts
.Select(script => (name: script, exists: project.Scripts!.ContainsKey(script) || script == "env"))
Copy link
Owner Author

Choose a reason for hiding this comment

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

Turns out this (script == "env") is a bug and was fixed below in the new version. Long term the case insensitive support should probably be removed to both simplify things and reduce the number of edge case bugs like this.

@xt0rted xt0rted merged commit 0e54a66 into main Aug 13, 2022
@xt0rted xt0rted deleted the globbing branch August 13, 2022 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant