nestjs / nest-cli

CLI tool for Nest applications 🍹
https://nestjs.com
Other
1.94k stars 388 forks source link

Hidden assets are not copied #2653

Closed addun closed 1 month ago

addun commented 1 month ago

Did you read the migration guide?

Is there an existing issue that is already proposing this?

Potential Commit/PR that introduced the regression

e19c2d3b58aed6d38e0e2109e5a378a25256b9d1

Versions

9 -> 10

Describe the regression

Assets are not copied when files start with .

Minimum reproduction code

  1. Create a file in app/config/envs/.development
  2. Add configuration to copy this file
    "compilerOptions": {
    "assets": ["config/envs/*"]
    }
  3. Build your application

https://stackblitz.com/edit/nestjs-typescript-starter-dhma8x?file=README.md

Expected behavior

In v9 (@nestjs/cli@9) all files inside config/envs/* were copied to /dist file. After migration to v10 they didn't. To fix this problem you need to explicitly add . prefix.

  "compilerOptions": {
    "assets": ["config/envs/.*"] // with `.` is works
  }

Other

Glob by default do NOT copy hidden files https://stackoverflow.com/questions/77509905/the-glob-npm-package-does-not-matches-the-file-which-name-begins-from-dot

kamilmysliwiec commented 1 month ago

We could expose a configuration attribute to control that behavior - would you like to create a PR for this?

kamilmysliwiec commented 1 month ago

Let's track this here https://github.com/nestjs/nest-cli/pull/2660