Skip to content

bang in outputs does not work correctly #26769

Open

Description

Current Behavior

When using bangs in outputs to exclude specific files, it does not work as expected.

For example, if I have this file tree in my project:

dist/
├── bin/
│  ├── file.sh
│  └── file.js
└── test.ts

and I want to add to the outputs cache, all files under dist but excluding the files that are in dist/bin with a sh extension.

The outputs configuration is this case should be:

"outputs": [
        "{projectRoot}/dist/**",
        "!{projectRoot}/dist/bin/*.sh"
      ]

But when running the task, I see that the dist/bin/file.sh is cached in the outputs.

Expected Behavior

The bang allow to exclude some type of files

GitHub Repo

https://github.com/Elyahou/nx-examples/tree/outputs-issue

Steps to Reproduce

  1. Clone the fork https://github.com/Elyahou/nx-example and checkout the outputs-issue branch
  2. yarn install
  3. npx nx repro cart
  4. Check the outputs folder under .nx/cache and see that the .sh file is cached...

Nx Report

Node   : 16.15.0
OS     : darwin-arm64
yarn   : 1.22.22

nx                 : 19.1.0-beta.3
@nx/js             : 19.1.0-beta.3
@nx/jest           : 19.1.0-beta.3
@nx/linter         : 19.1.0-beta.3
@nx/eslint         : 19.1.0-beta.3
@nx/workspace      : 19.1.0-beta.3
@nx/angular        : 19.1.0-beta.3
@nx/cypress        : 19.1.0-beta.3
@nx/devkit         : 19.1.0-beta.3
@nx/eslint-plugin  : 19.1.0-beta.3
@nx/react          : 19.1.0-beta.3
@nrwl/tao          : 19.1.0-beta.3
@nx/web            : 19.1.0-beta.3
@nx/webpack        : 19.1.0-beta.3
typescript         : 5.4.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/cypress/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
@ngrx/component-store : 17.0.1
@ngrx/effects         : 17.0.1
@ngrx/entity          : 17.0.1
@ngrx/operators       : 17.0.0-beta.0
@ngrx/router-store    : 17.0.1
@ngrx/store           : 17.0.1
@ngrx/store-devtools  : 17.0.1

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

I checked a lot of possibilities and no one work:

"outputs": [
        "{projectRoot}/dist",
        "!{projectRoot}/dist/bin/*.sh"
      ]

"outputs": [
        "{projectRoot}/dist",
        "{projectRoot}/dist/bin/!(*.sh)"
      ]      

"outputs": [
        "{projectRoot}/dist/**/*",
        "!{projectRoot}/dist/bin/*.sh"
      ]      
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions