nest-cli icon indicating copy to clipboard operation
nest-cli copied to clipboard

Assets only works on top level project.

Open mkabatek opened this issue 4 months ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current behavior

If I have a nest-cli.json like like below I can use the assets to get files from top level project. However If I want to store my assets along with a library it doesn't properly copy the assets/

  "collection": "@nestjs/schematics",
  "sourceRoot": "apps/api/src",
  "monorepo": true,
  "root": "apps/api",
  "compilerOptions": {
    "webpack": true,
    "tsConfigPath": "apps/api/tsconfig.app.json",
    "assets": [{ "include": "**/*.html", "outDir": "dist/apps", "watchAssets": true }]
  },
  "projects": {
    "api": {
      "type": "application",
      "root": "apps/api",
      "entryFile": "main",
      "sourceRoot": "apps/api/src",
      "compilerOptions": {
        "tsConfigPath": "apps/api/tsconfig.app.json"
      }
    },
    "jobs": {
      "type": "application",
      "root": "apps/jobs",
      "entryFile": "main",
      "sourceRoot": "apps/jobs/src",
      "compilerOptions": {
        "tsConfigPath": "apps/jobs/tsconfig.app.json"
      }
    },
    "persistence": {
      "type": "library",
      "root": "libs/persistence",
      "entryFile": "index",
      "sourceRoot": "libs/persistence/src",
      "compilerOptions": {
        "tsConfigPath": "libs/persistence/tsconfig.lib.json"
      }
    },

....

For example if I wanted to do this below, and put my assets with a library, the assets don't copy into the build directory.

  "collection": "@nestjs/schematics",
  "sourceRoot": "apps/api/src",
  "monorepo": true,
  "root": "apps/api",
  "compilerOptions": {
    "webpack": true,
    "tsConfigPath": "apps/api/tsconfig.app.json"
  },
  "projects": {
    "api": {
      "type": "application",
      "root": "apps/api",
      "entryFile": "main",
      "sourceRoot": "apps/api/src",
      "compilerOptions": {
        "tsConfigPath": "apps/api/tsconfig.app.json"
      }
    },
    "jobs": {
      "type": "application",
      "root": "apps/jobs",
      "entryFile": "main",
      "sourceRoot": "apps/jobs/src",
      "compilerOptions": {
        "tsConfigPath": "apps/jobs/tsconfig.app.json"
      }
    },
    "persistence": {
      "type": "library",
      "root": "libs/persistence",
      "entryFile": "index",
      "sourceRoot": "libs/persistence/src",
      "compilerOptions": {
        "tsConfigPath": "libs/persistence/tsconfig.lib.json"
        "assets": [{ "include": "**/*.html", "outDir": "dist/apps", "watchAssets": true }]
      }
    },

....

Minimum reproduction code

https://github.com/nestjs/nest-cli

Steps to reproduce

  1. Put assets in a library, and try to use the assets in the nest-cli.json

Expected behavior

The assets should be copied even if they are in a library.

Package version

9.4.2

NestJS version

9.4.2

Node.js version

v20.5.1

In which operating systems have you tested?

  • [ ] macOS
  • [ ] Windows
  • [ ] Linux

Other

No response

mkabatek avatar Feb 10 '24 01:02 mkabatek

Please provide a minimum reproduction repository. You can start one by running npm init nest in your terminal

why reproductions are required

micalevisk avatar Feb 11 '24 22:02 micalevisk