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

Deno task --filter issue #27408

Closed
nomocas opened this issue Dec 17, 2024 · 2 comments · Fixed by #27396
Closed

Deno task --filter issue #27408

nomocas opened this issue Dec 17, 2024 · 2 comments · Fixed by #27396
Labels
bug Something isn't working correctly task runner related to deno task

Comments

@nomocas
Copy link

nomocas commented Dec 17, 2024

Version: Deno v2.1.3 and v2.1.4 (didn't check previous versions)
OSX: Darwin Kernel Version 23.6.0 arm64

Hello Community,

There is a weird behaviour with the brand new deno task --filter and workspace.

Root deno.json:

{
	"workspace": ["./libs/foo"],
	"tasks": {
		"bar": "echo bar"
	}
}

And ./libs/foo/deno.json:

{
	"name": "@scope/foo",
	"tasks": {
		"bar": "echo foo"
	}
}

Then:

➜ deno task --filter foo bar
Task bar echo foo
foo

No problem.
But if root deno.json:

{
	"workspace": ["./libs/foo"],
	"tasks": {
		"bar:baz": "echo bar"
	}
}

Then both tasks (bar and bar:baz) are triggered:

➜ deno task --filter foo bar
Task bar echo foo
foo
Task bar:baz echo bar
bar

It's also the case if:
Root deno.json:

{
	"workspace": ["./libs/foo"],
	"tasks": {
		"bar": "echo bar"
	}
}

And ./libs/foo/deno.json

{
	"name": "@scope/foo",
	"tasks": {
		"bar:baz": "echo foo"
	}
}

Then:

➜ deno task --filter foo bar
Task bar:baz echo foo
foo
Task bar echo bar
bar

But then if:
Root deno.json:

{
	"workspace": ["./libs/foo"],
	"tasks": {
		"bar:baz": "echo bar"
	}
}

And ./libs/foo/deno.json:

{
	"name": "@scope/foo",
	"tasks": {
		"bar:baz": "echo foo"
	}
}

Then:

➜ deno task --filter foo bar
Task bar:baz echo foo
foo

At the end, if:
Root deno.json:

{
	"workspace": ["./libs/foo"],
	"tasks": {
		"bar:baz1": "echo baz1",
		"bar:baz2": "echo baz2"
	}
}

And ./libs/foo/deno.json:

{
	"name": "@scope/foo",
	"tasks": {
		"bar": "echo foo"
	}
}

Then:

➜ deno task --filter foo bar
Task bar echo foo
foo
Task bar:baz1 echo baz1
baz1
Task bar:baz2 echo baz2
baz2

Fun isn't it ? :)

@nomocas
Copy link
Author

nomocas commented Dec 18, 2024

@marvinhagemeister @bartlomieju
Oh! That was quick! Thank you!

dsherret pushed a commit that referenced this issue Jan 9, 2025
This commit fixes `deno task` by checking if the provided
task name actually has a wildcard char ("*").

Previously, if the "--recursive" flag was passed, the task name
was treated as a regex, which lead to a situation where exact task
name resulted in a regex that matched all tasks with the specific
prefix.

This commit fixes it, by checking if the provided task name, is an exact
name, or is it a wildcard match.

Closes #27370
Closes #27401
Closes #27408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly task runner related to deno task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants