twittwer / nx-tools

Workspace for Nx Plugins.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cache not reverted when not setting output path options

jogelin opened this issue · comments

I have this config:

"compodoc": {
      "executor": "@twittwer/compodoc:compodoc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "tsConfig": "libs/ui/tsconfig.lib.json",
        "outputPath": "dist/compodoc/ui",
        "exportFormat": "json"
      },
      "configurations": {
        "watch": {
          "watch": true
        }
      }
    }

but I wanted to use the default value so remove tsconfig + outputPath to have this:

"compodoc": {
      "executor": "@twittwer/compodoc:compodoc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "exportFormat": "json"
      },
      "configurations": {
        "watch": {
          "watch": true
        }
      }
    }

then the cache of Nx isn't reverted in the dist folder

Do you know what has to be done to achieve this? I thought Nx resolves the template in outputs from configured options.

@twittwer sorry for the late answer.

I don't really know what you mean by "has to be done".

If I execute these steps with my hard coded outputPath in me project.json:

  • remove dist/compodoc/may-app --> if exists
  • exec yarn nx run my-app:compodoc --> store it in dist/compodoc/may-app and in the cloud
  • remove dist/compodoc/may-app
  • exec yarn nx run my-app:compodoc --> get from cloud and set it to dist/compodoc/may-app

If I remove my config outputPath then the last step doesn't work

After playing with the debug mode, I clearly see that the outputPath disappeared in the configurations:

with the config set: Prepare Compodoc...

{
  tsConfig: 'libs/shared/ui/tsconfig.lib.json',
  outputPath: 'dist/compodoc/shared-ui',
  disablePrivate: true,
  disableInternal: true,
  exportFormat: 'json',
  debug: true,
  workspaceDocs: false,
  disableCoverage: true,
  disableSourceCode: false,
  disableDomTree: false,
  disableTemplateTab: false,
  disableStyleTab: false,
  disableGraph: false,
  disableProtected: false,
  disableLifeCycleHooks: true,
  disableRoutesGraph: false,
  disableSearch: false,
  disableDependencies: false,
  language: 'en-US',
  theme: 'gitbook',
  hideGenerator: false,
  port: 8080,
  watch: false
}

without the config set: Prepare Compodoc...

 {
  tsConfig: 'libs/sdc/shared/ui/tsconfig.lib.json',
  disablePrivate: true,
  disableInternal: true,
  exportFormat: 'json',
  debug: true,
  workspaceDocs: false,
  disableCoverage: true,
  disableSourceCode: false,
  disableDomTree: false,
  disableTemplateTab: false,
  disableStyleTab: false,
  disableGraph: false,
  disableProtected: false,
  disableLifeCycleHooks: true,
  disableRoutesGraph: false,
  disableSearch: false,
  disableDependencies: false,
  language: 'en-US',
  theme: 'gitbook',
  hideGenerator: false,
  port: 8080,
  watch: false
}

So I think Nrwl/Nx cannot apply the config: "outputs": ["{options.outputPath}"], correctly

May it be a good option to define only the outputs, like nx's jest configuration?

    "test": {
      "executor": "@nrwl/jest:jest",
      "outputs": ["coverage/libs/foo"],
      "options": {
        "jestConfig": "libs/foo/jest.config.ts",
        "passWithNoTests": true
      }
    },

The minimal options would look like this:

    "compodoc": {
      "executor": "@twittwer/compodoc:compodoc",
      "outputs": ["dist/compodoc/foo"],
      "configurations": {
        "json": {
          "exportFormat": "json"
        }
      }
    }