[go: up one dir, main page]

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

ignore flag doesn't work #445

Closed
jeetiss opened this issue Dec 27, 2021 · 22 comments
Closed

ignore flag doesn't work #445

jeetiss opened this issue Dec 27, 2021 · 22 comments
Labels
kind: bug Something isn't working needs: investigation The bug / idea needs more investigation

Comments

@jeetiss
Copy link
jeetiss commented Dec 27, 2021

What version of Turborepo are you using?

1.0.23

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Describe the Bug

turbo run build --ignore='package/path' doesn't ignore build for package/path

Expected Behavior

turbo run build --ignore='package/path' run build for all packages except package/path

To Reproduce

ignore some package and run build

@jaredpalmer jaredpalmer added kind: bug Something isn't working needs: investigation The bug / idea needs more investigation labels Jan 3, 2022
@kieranm
Copy link
kieranm commented Jan 8, 2022

If it's helpful I can't get this to work either. I've tried...

  • Using node_modules/.bin/turbo run build and yarn turbo run build
  • With and without --no-deps
  • With and without --scope
  • Different glob patterns e.g. --ignore="apps" --ignore="apps/** --ignore="apps/**/*

I'm having to resort to exhaustively listing the packages I do want to build with --scope because they don't all have a common prefix.

Thanks!

@kieranm
Copy link
kieranm commented Jan 8, 2022

Just wanted to type up some thoughts. I've ran into multiple issues with this.

Looking into this a bit further, it should be possible to achieve this using a glob on --scope. --ignore only really seems to apply to changed files.

For example, to exclude packages beginning with @daybridge/app-, I would expect to be able to say:

turbo run build --no-deps --scope="@daybridge/\!(app-)*"

However, the glob library that Turborepo uses appears to be limited, and doesn't support ! on anything other than single characters in a range. So the above glob doesn't actually work. Someone filed an issue for it here.

This seems to be at odds with what the documentation says because the negation operator ! doesn't seem to do anything unless it's inside a [] range. It doesn't seem to negate any arbitrary group as the documentation suggests. Something like...

turbo run build --no-deps --scope="@daybridge/[\!app]*"

sort of works, but excludes all packages beginning with @daybridge/a or @daybridge/p - which is not the desired behaviour.

In addition, because of a function called hasMeta in the source code, something like...

turbo run build --no-deps --scope="@daybridge/{auth,theme}"

would not work because hasMeta only checks for the presence of ?, * and [. If none of these characters are present then the glob is not parsed at all.

If the glob doesn't match any packages, Turbrorepo seems to build everything - which feels bit unintuitive to me. I would expect it to build nothing or error. Maybe there is some historical context I am missing.

Apologies if I'm missing something obvious here!

@AlonMiz
Copy link
AlonMiz commented Jan 18, 2022

agree, basically i would summarize that it would be nice to have an opposite flag for --scope
instead of --scope all I want, I can --exclude what I don't want
pnpm turbo run lint --scope="@wow/app" --scope="@wow/web" --scope="@wow/app2" --scope="@wow/web2"
i can write
pnpm turbo run lint --exclude="@wow/types"
exclude can be replaced with ignore/filter or something more clear

@ragrag
Copy link
Contributor
ragrag commented Feb 2, 2022

@jeetiss would be nice if you can share some workaround you found for this

@jeetiss
Copy link
Author
jeetiss commented Feb 3, 2022

I did not find any workaround for this. It is still broken

@ndom91
Copy link
ndom91 commented Feb 4, 2022

Still having this issue as well, nothing I've tried has successfully been able to ignore individual @org/pkg type packages.

For example, we have a bunch of @next-auth/*-adapter type packages in our /packages directory. I'm trying to run tests like so, turbo run test --scope=@next-auth/*-adapter --ignore=@next-auth/pouchdb-adapter. The goal being, to run all adapters except the pouchdb one. Unfortunately, it will include the pouchdb adapter as well.

Like the the first replier, I've tried it with the path name, package.json name field, with and without glob stars prefixed and suffixed, etc. None of them did the trick 🤷

Currently tried it with:

  • turbo@1.1.2
  • node@14.17.1
  • yarn@1.22.16

@morriq
Copy link
morriq commented Feb 18, 2022

@jaredpalmer please check this out 😇

@kieranm
Copy link
kieranm commented Feb 21, 2022

For the time being it looks like this has been fixed in #696

I think the --filter syntax will fix this properly but for now it's possible to use --scope to achieve the desired exclude behaviour.

From the release notes:

Fixed --scope exclusion. As a reminder, a ! is the proper way to ignore something from execution scope (e.g. --scope="!something-*"). Recall that --ignore is only used for --since`.

@morriq
Copy link
morriq commented Feb 22, 2022

on mac with ! it even not executes command:

pnpm turbo run build --scope="!webapp"

zsh: event not found: webapp

--

pnpm turbo run build --scope="@lib/**"

• Packages in scope: @lib/aa, @lib/bb, webapp1, webapp2

and it runs on webapp1 and webapp2

--

pnpm turbo run build --scope="webapp1"

• Packages in scope: webapp1

and it runs only on webapp1

@vtereshyn
Copy link

The issue still appears. I wasn't able to ignore packages using:

  • package name
  • path to folder

@paul-vd
Copy link
paul-vd commented Feb 22, 2022

I'm having same issue, ignore does not seem to work.

Using this to negate the scope

 --no-deps --scope='!excluded-app'

Should ignore work without the --no-deps flag? I did try with it and it is still not working.


on mac with ! it even not executes command:

pnpm turbo run build --scope="!webapp"

zsh: event not found: webapp

@morriq Is that not zsh related? try with single quotes

@danielweck
Copy link

I am experiencing the same issues as above. This is currently a blocker bug in my dev workflow :(
I just need to be able to exclude package name(s) or folder path(s) from a Turbo task run.

@danielweck danielweck mentioned this issue Mar 4, 2022
4 tasks
@Pagebakers
Copy link

I posted this originally: #398

Still having issues ignoring packages in my build with 1.1.5 unfornunately.

@Chrischuck
Copy link

Same issue here, ignore does not work.

@brunojppb
Copy link
Contributor

I can also confirm. We are also encountering this issue in our projects.
Currently running Turbo v1.1.6.
CC: @ekaitzht-n26

@claycoleman
Copy link
claycoleman commented Mar 22, 2022

I managed to get this working using --scope="\!something-*". Note the escaped \! due to zsh.

This also worked with single quotes with no escape, as in --scope='!something-*'

@emroot
Copy link
emroot commented Mar 22, 2022

I'm having the same issue. Been running this command line npx turbo run build --scope="@bdqe/api" --scope='!@bdqe/trivia' and it still runs my build script in packages/trivia.
packages/trivia calls packages/api as a shared dependency. but not the other way around.
would love some guidance on what I'm doing wrong

@kieranm
Copy link
kieranm commented Mar 22, 2022

@emroot You might need to add --no-deps if trivia depends on api and you only want to build api and not trivia.

@emroot
Copy link
emroot commented Mar 22, 2022

that helped thanks!

@kieranm
Copy link
kieranm commented Apr 8, 2022

I suspect this issue could probably be closed now the new --filter syntax has been released:
https://turborepo.org/blog/turbo-1-2-0

@jeetiss
Copy link
Author
jeetiss commented Jun 6, 2022

thanks, everything works like a charm with the --filter option

@jeetiss jeetiss closed this as completed Jun 6, 2022
@panieldark
Copy link

For everyone who experiences this even with the --filter option with a zsh: event not found: error, escape the ! like so:
turbo run build --filter="\!@scope/package"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working needs: investigation The bug / idea needs more investigation
Projects
None yet
Development

No branches or pull requests