nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
22.69k stars 2.27k forks source link

configuration not including assets #23202

Closed jeffschulzusc closed 2 months ago

jeffschulzusc commented 2 months ago

Current Behavior

I include "assets" in a configuration ... it does not get parsed ... only the "assets" under "options" are considered.

Expected Behavior

Should be able to specify configuration assets in addition to "options" assets, as implied by the nx project-schema.json.

GitHub Repo

No response

Steps to Reproduce

in this version of my project.json, it is verified that the files in ./he are copied to the dist output assets folder:

{
  "name": "vha",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "projectType": "application",
  "sourceRoot": "apps/vha/src",
  "prefix": "vhap",
  "i18n": {
    "sourceLocale": "en-US",
    "locales": {
      "he": {
        "translation": "apps/vha/src/locale/messages.he.xlf",
        "baseHref": ""
      }
    }
  },
  "targets": {
    "build": {
      "executor": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/apps/vha",
        "index": "apps/vha/src/index.html",
        "main": "apps/vha/src/main.ts",
        "polyfills": "apps/vha/src/polyfills.ts",
        "tsConfig": "apps/vha/tsconfig.app.json",
        "aot": true,
        "allowedCommonJsDependencies": [
          "hammerjs",
          "axios",
          "lodash",
          "qs",
          "jodit",
          "wordcloud",
          "contentful",
          "oidc-client",
          "aws-rum-web",
          "@aws-crypto/sha256-js",
          "@aws-crypto/crc32",
          "shimmer",
          "ua-parser-js",
          "flat"
        ],
        "assets": [
          "apps/vha/src/favicon.ico",
          "apps/vha/src/assets",
          "apps/vha/src/uscshoahfoundation-share.png",
          "apps/vha/src/silent-callback.html",
          {
            "glob": "app.config.json",
            "input": ".",
            "output": "/"
          },
          {
            "input": "libs/vcc/src/assets",
            "glob": "**/*",
            "output": "assets/vcc"
          },
          {
            "glob": "web.config",
            "input": ".",
            "output": "/"
          },
          {
            "glob": "*",
            "input": "./he",
            "output": "assets"
          }
        ],
        "styles": [
          "libs/vstyle/src/lib/material-themes.scss",
          "apps/vha/src/styles.scss",
          "libs/vcc/src/styles.scss"
        ],
        "scripts": [
          "apps/vha/src/sjcl.js"
        ],
        "stylePreprocessorOptions": {
          "includePaths": [
            "libs/vstyle/src/lib"
          ]
        },
        "i18nMissingTranslation": "warning"
      },
      "configurations": {
        "dev": {
          "fileReplacements": [],
          "optimization": false,
          "outputHashing": "none",
          "sourceMap": true,
          "namedChunks": false,
          "extractLicenses": false,
          "vendorChunk": true,
          "buildOptimizer": false
        },
        "test": {
          "fileReplacements": [
            {
              "replace": "apps/vha/src/environments/environment.ts",
              "with": "apps/vha/src/environments/environment.test.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "namedChunks": false,
          "extractLicenses": true,
          "vendorChunk": true,
          "buildOptimizer": true
        },
        "stage": {
          "fileReplacements": [
            {
              "replace": "apps/vha/src/environments/environment.ts",
              "with": "apps/vha/src/environments/environment.stage.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "namedChunks": false,
          "extractLicenses": true,
          "vendorChunk": true,
          "buildOptimizer": true
        },
        "production": {
          "fileReplacements": [
            {
              "replace": "apps/vha/src/environments/environment.ts",
              "with": "apps/vha/src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "namedChunks": false,
          "extractLicenses": true,
          "vendorChunk": true,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumError": "3.95mb"
            },
            {
              "type": "anyComponentStyle",
              "maximumError": "10kb"
            },
            {
              "type": "all",
              "maximumError": "8.25mb"
            }
          ]
        },
        "analyze": {
          "deleteOutputPath": true,
          "fileReplacements": [
            {
              "replace": "apps/vha/src/environments/environment.ts",
              "with": "apps/vha/src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "none",
          "sourceMap": false,
          "namedChunks": true,
          "extractLicenses": true,
          "vendorChunk": true,
          "buildOptimizer": true,
          "statsJson": true,
          "verbose": true
        },
        "he": {
          "localize": [
            "he"
          ]
        }
      }
    },
    "serve": {
      "executor": "@angular-devkit/build-angular:dev-server",
      "options": {
        "proxyConfig": "apps/vha/proxy.conf.json",
        "buildTarget": "vha:build"
      },
      "configurations": {
        "dev": {
          "buildTarget": "vha:build:dev"
        },
        "production": {
          "buildTarget": "vha:build:production"
        },
        "dev-he": {
          "buildTarget": "vha:build:dev,he"
        }
      }
    },
    "extract-i18n": {
      "executor": "@angular-devkit/build-angular:extract-i18n",
      "options": {
        "buildTarget": "vha:build"
      }
    },
    "lint": {
      "executor": "@nx/eslint:lint"
    },
    "test": {
      "executor": "@nx/jest:jest",
      "outputs": [
        "{workspaceRoot}/coverage/apps/vha"
      ],
      "options": {
        "jestConfig": "apps/vha/jest.config.ts"
      }
    }
  },
  "tags": [
    "scope:vha"
  ]
}

however, if instead i include the assets glob in the "he" configuration, the files are not copied:

{
  "name": "vha",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "projectType": "application",
  "sourceRoot": "apps/vha/src",
  "prefix": "vhap",
  "i18n": {
    "sourceLocale": "en-US",
    "locales": {
      "he": {
        "translation": "apps/vha/src/locale/messages.he.xlf",
        "baseHref": ""
      }
    }
  },
  "targets": {
    "build": {
      "executor": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/apps/vha",
        "index": "apps/vha/src/index.html",
        "main": "apps/vha/src/main.ts",
        "polyfills": "apps/vha/src/polyfills.ts",
        "tsConfig": "apps/vha/tsconfig.app.json",
        "aot": true,
        "allowedCommonJsDependencies": [
          "hammerjs",
          "axios",
          "lodash",
          "qs",
          "jodit",
          "wordcloud",
          "contentful",
          "oidc-client",
          "aws-rum-web",
          "@aws-crypto/sha256-js",
          "@aws-crypto/crc32",
          "shimmer",
          "ua-parser-js",
          "flat"
        ],
        "assets": [
          "apps/vha/src/favicon.ico",
          "apps/vha/src/assets",
          "apps/vha/src/uscshoahfoundation-share.png",
          "apps/vha/src/silent-callback.html",
          {
            "glob": "app.config.json",
            "input": ".",
            "output": "/"
          },
          {
            "input": "libs/vcc/src/assets",
            "glob": "**/*",
            "output": "assets/vcc"
          },
          {
            "glob": "web.config",
            "input": ".",
            "output": "/"
          }
        ],
        "styles": [
          "libs/vstyle/src/lib/material-themes.scss",
          "apps/vha/src/styles.scss",
          "libs/vcc/src/styles.scss"
        ],
        "scripts": [
          "apps/vha/src/sjcl.js"
        ],
        "stylePreprocessorOptions": {
          "includePaths": [
            "libs/vstyle/src/lib"
          ]
        },
        "i18nMissingTranslation": "warning"
      },
      "configurations": {
        "dev": {
          "fileReplacements": [],
          "optimization": false,
          "outputHashing": "none",
          "sourceMap": true,
          "namedChunks": false,
          "extractLicenses": false,
          "vendorChunk": true,
          "buildOptimizer": false
        },
        "test": {
          "fileReplacements": [
            {
              "replace": "apps/vha/src/environments/environment.ts",
              "with": "apps/vha/src/environments/environment.test.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "namedChunks": false,
          "extractLicenses": true,
          "vendorChunk": true,
          "buildOptimizer": true
        },
        "stage": {
          "fileReplacements": [
            {
              "replace": "apps/vha/src/environments/environment.ts",
              "with": "apps/vha/src/environments/environment.stage.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "namedChunks": false,
          "extractLicenses": true,
          "vendorChunk": true,
          "buildOptimizer": true
        },
        "production": {
          "fileReplacements": [
            {
              "replace": "apps/vha/src/environments/environment.ts",
              "with": "apps/vha/src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "namedChunks": false,
          "extractLicenses": true,
          "vendorChunk": true,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumError": "3.95mb"
            },
            {
              "type": "anyComponentStyle",
              "maximumError": "10kb"
            },
            {
              "type": "all",
              "maximumError": "8.25mb"
            }
          ]
        },
        "analyze": {
          "deleteOutputPath": true,
          "fileReplacements": [
            {
              "replace": "apps/vha/src/environments/environment.ts",
              "with": "apps/vha/src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "none",
          "sourceMap": false,
          "namedChunks": true,
          "extractLicenses": true,
          "vendorChunk": true,
          "buildOptimizer": true,
          "statsJson": true,
          "verbose": true
        },
        "he": {
          "assets": [
            {
              "glob": "*",
              "input": "./he",
              "output": "assets"
            }
          ],
          "localize": [
            "he"
          ]
        }
      }
    },
    "serve": {
      "executor": "@angular-devkit/build-angular:dev-server",
      "options": {
        "proxyConfig": "apps/vha/proxy.conf.json",
        "buildTarget": "vha:build"
      },
      "configurations": {
        "dev": {
          "buildTarget": "vha:build:dev"
        },
        "production": {
          "buildTarget": "vha:build:production"
        },
        "dev-he": {
          "buildTarget": "vha:build:dev,he"
        }
      }
    },
    "extract-i18n": {
      "executor": "@angular-devkit/build-angular:extract-i18n",
      "options": {
        "buildTarget": "vha:build"
      }
    },
    "lint": {
      "executor": "@nx/eslint:lint"
    },
    "test": {
      "executor": "@nx/jest:jest",
      "outputs": [
        "{workspaceRoot}/coverage/apps/vha"
      ],
      "options": {
        "jestConfig": "apps/vha/jest.config.ts"
      }
    }
  },
  "tags": [
    "scope:vha"
  ]
}

use case: need to include different fonts for en and he localized builds

Nx Report

jeffs-Mac-mini:vhap.ws jeffschulzuscmacmini$ nx report

 NX   Report complete - copy this into the issue template

Node   : 21.5.0
OS     : darwin-arm64
yarn   : 1.22.21

nx (global)        : 18.0.6
nx                 : 18.0.6
@nx/js             : 18.0.6
@nx/jest           : 18.0.6
@nx/linter         : 18.0.6
@nx/eslint         : 18.0.6
@nx/workspace      : 18.0.6
@nx/angular        : 18.0.6
@nx/cypress        : 18.0.6
@nx/devkit         : 18.0.6
@nrwl/devkit       : 15.8.5
@nx/eslint-plugin  : 18.0.6
@nx/nest           : 18.0.6
@nx/node           : 18.0.6
@nrwl/tao          : 18.0.6
@nx/web            : 18.0.6
@nx/webpack        : 18.0.6
nx-cloud           : 18.0.0
typescript         : 5.3.3
---------------------------------------
Community plugins:
@ngneat/transloco    : 6.0.4
@ngrx/effects        : 17.0.1
@ngrx/entity         : 17.0.1
@ngrx/router-store   : 17.0.1
@ngrx/schematics     : 17.0.1
@ngrx/signals        : 17.0.1
@ngrx/store          : 17.0.1
@ngrx/store-devtools : 17.0.1
@nx-dotnet/core      : 1.22.0
---------------------------------------
The following packages should match the installed version of nx
  - @nrwl/devkit@15.8.5

To fix this, run `nx migrate nx@18.0.6`

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

Coly010 commented 2 months ago

Hi @jeffschulzusc

I'm sorry you're running into this, however, I can see that you're using @angular-devkit/build-angular:browser. This is a builder that is built and owned by the Angular team and therefore not under the control of Nx.

You should raise an issue at https://github.com/angular/angular-cli

As this is outside the realm of Nx, I'm going to close this issue.

github-actions[bot] commented 1 month ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.