7

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?

Konstantin Bodnia
  • 1,372
  • 3
  • 20
  • 43

1 Answers1

10

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
        ]
      }
    }
...
NovyLevi
  • 522
  • 2
  • 7
  • 18
  • 3
    This will put the app.yaml in the public directory as an assets – amirhe Jul 23 '22 at 06:49
  • 1
    should be the accepted answer imho. this implementation outputs to the root of the dist dir for me. – ALFmachine Sep 15 '22 at 16:39
  • 1
    You can pass in an object in the `"assets"` array (`{ "glob": "web.config", "input": "src", "output": "."}`) but sadly you cannot copy files to outside the project folder – Pieterjan Jan 16 '23 at 10:42
  • It does not work if the file asset is outside the apps folder, in my case i need to copy the **schema.prisma** file in to dist folder but i cannot put it in the project.json – hpfs Mar 22 '23 at 05:43