NX: Copy one extra file to build directory

Viewed 1242

I have a project that I've built with nx and I'm deploying it to Google App Engine.

It needs app.yaml in the same folder.

Is there a way to tell nx builder to copy that extra file to the build directory next to everything else?

1 Answers

I guess you figured it out by now, but if anyone is still looking for a solution;

In project.json you can specify assets for targets so if you need app.yaml you can do something like this:

...
"targets": {
    "build": {
      "executor": "@nrwl/js:tsc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/apps/example",
        "main": "apps/example/src/index.ts",
        "tsConfig": "apps/example/tsconfig.app.json",
        "assets": [
          "apps/example/*.md",
          "apps/example/src/app.yaml" <-- specify your path here
        ]
      }
    }
...
Related