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

after nest build the nest-cli defined assets are only placed into the expected outdir directories if watchAssets is true #2687

Closed
4 tasks done
andreasvh-conceto opened this issue Aug 8, 2024 · 7 comments

Comments

@andreasvh-conceto
Copy link

andreasvh-conceto commented Aug 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

After npm run build the files are not placed in the expected directories. Only if watchAssets is set to true the files are copied to their desired outdirs.

Minimum reproduction code

https://github.com/andreasvh-conceto/nestcli-reproduce-asset-include

Steps to reproduce

  1. git clone git@github.com:andreasvh-conceto/nestcli-reproduce-asset-include.git
  2. cd nestcli-reproduce-asset-include
  3. npm i
  4. Look inside the nest-cli.json to check expectations
  5. npm run build and look inside the dist folder
    image
  6. set watchAssets: true in the nest-cli.json
  7. npm run build
  8. Look again in the dist directory and compare it to step 5
    image

Expected behavior

If watchAssets is not set or is set to true/false will not have an effect on the outdir directory structure after an npm run build. The files/directories defined in nest-cli.json will be copied as expected to their outdirs.

Package version

10.4.2

NestJS version

10.3.10

Node.js version

v20.12.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

Could be related to: #2677

Hardware Overview:

Model Name: MacBook Pro
Model Identifier: MacBookPro17,1
Model Number: Z11C000JAD/A
Chip: Apple M1
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 16 GB
System Firmware Version: 10151.121.1
OS Loader Version: 10151.121.1
Serial Number (system): FVFFF2NPQ05P
Hardware UUID: F8CA8278-2342-568C-AF29-5A89497A28A4
Provisioning UDID: 00008103-000E2098143A001E
Activation Lock Status: Disabled

@kamilmysliwiec
Copy link
Member

Why if you change this

{"include": "../certs/*", "outDir": "./dist/certs1"},
{"include": "../certs", "outDir": "./dist/certs2"}

to this

{"include": "../certs/*", "outDir": "./dist/certs1"},
{"include": "../certs/*", "outDir": "./dist/certs2"}

@andreasvh-conceto
Copy link
Author

andreasvh-conceto commented Aug 8, 2024

Thanks, this works like expected with the /*. We used this one in nestjs version 9 all the time successfully:

{"include": "../certs", "outDir": "./dist/certs2"}

After upgrade to nestjs 10 we figured out, that the behavior is different. All our certificates where not copied anymore.

But the main issue/confusion persist. Why nestcli produces different outputs depending on the flag watchAssets true / false. It should not have an effect after running nest build.

@JacksonBates
Copy link

After upgrade to nestjs 10 we figured out, that the behavior is different. All our certificates where not copied anymore.

I just did this upgrade today and it took a while to also uncover this.

Previously ../someDir/ would add all the files and directories to the appropriate location in the dist, but now the glob requires ../someDir/*, or ../someDir/** if we're adding child folders too.

Was this change in behaviour intentional or documented? I couldn't find anything.

@kamilmysliwiec
Copy link
Member

This should be fixed in 10.4.3

@andreasvh-conceto
Copy link
Author

Hi @kamilmysliwiec ,

i increased the nest-cli version to 10.4.3 and the issue still persist. The behaviour is still different. You can try it out with the steps to reproduce from my initial post.

Best regards
Andreas

@kamilmysliwiec
Copy link
Member

Thanks for the quick feedback @andreasvh-conceto. It seems that these are 2 different bugs and only one of them was solved in the new release.

I just pushed a quick hotfix and published a new version (10.4.4). Let me know if you're still running into this issue.

@andreasvh-conceto
Copy link
Author

Hi @kamilmysliwiec ,

thank you very much. It is working now as expected! :)
Thanks for the quick fix.

Best regards :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants