Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx nx g @nx-dotnet/core:application -d services/apps/DevApiGateway does not put the project in the correct directory #825

Open
jefedeltodos opened this issue Feb 6, 2024 · 0 comments
Labels
bug Something isn't working needs-triage This issue has yet to be looked over by a core team member

Comments

@jefedeltodos
Copy link

jefedeltodos commented Feb 6, 2024

Current Behavior

  1. Executing the command:
npx nx g @nx-dotnet/core:application -d services/apps/DevApiGateway --solutionFile App.sln --language C# --template web --tags app --dry-run
  1. Note the location of the generated files:
Executing Command: dotnet "new" "web" "--language" "C#" "--name" "App.Services.Apps.DevApiGateway" "--output" "apps/services/apps/DevApiGateway" "--dry-run"
File actions would have been taken:
  Create: apps/services/apps/DevApiGateway/App.Services.Apps.DevApiGateway.csproj
  Create: apps/services/apps/DevApiGateway/Program.cs
  Create: apps/services/apps/DevApiGateway/Properties/launchSettings.json
  Create: apps/services/apps/DevApiGateway/appsettings.Development.json
  Create: apps/services/apps/DevApiGateway/appsettings.json

Note the added apps/ prefix

Expected Behavior

The directory passed to --directory would be honored for the @nx-dotnet/core:application generator in the same way it is honored for the @nx-dotnet/core:library

I would expect the following output:

Executing Command: dotnet "new" "web" "--language" "C#" "--name" "App.Services.Apps.DevApiGateway" "--output" "services/apps/DevApiGateway" "--dry-run"
File actions would have been taken:
  Create: services/apps/DevApiGateway/App.Services.Apps.DevApiGateway.csproj
  Create: services/apps/DevApiGateway/Program.cs
  Create: services/apps/DevApiGateway/Properties/launchSettings.json
  Create: services/apps/DevApiGateway/appsettings.Development.json
  Create: services/apps/DevApiGateway/appsettings.json

Note the absence of the apps/ directory prefix

Github Repo

No response

Steps to Reproduce

  1. Executing the command:
npx nx g @nx-dotnet/core:application -d services/apps/DevApiGateway --solutionFile App.sln --language C# --template web --tags app --dry-run
  1. Note the location of the generated files:
Executing Command: dotnet "new" "web" "--language" "C#" "--name" "App.Services.Apps.DevApiGateway" "--output" "apps/services/apps/DevApiGateway" "--dry-run"
File actions would have been taken:
  Create: apps/services/apps/DevApiGateway/App.Services.Apps.DevApiGateway.csproj
  Create: apps/services/apps/DevApiGateway/Program.cs
  Create: apps/services/apps/DevApiGateway/Properties/launchSettings.json
  Create: apps/services/apps/DevApiGateway/appsettings.Development.json
  Create: apps/services/apps/DevApiGateway/appsettings.json

Note the added apps/ prefix

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 20.11.0
   OS     : linux-x64
   npm    : 10.2.4
   
   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/linter         : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/angular        : 17.2.8
   @nx/cypress        : 17.2.8
   @nx/devkit         : 17.2.8
   @nx/eslint-plugin  : 17.2.8
   @nx/playwright     : 17.2.8
   @nrwl/tao          : 17.2.8
   @nx/web            : 17.2.8
   @nx/webpack        : 17.2.8
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @nx-dotnet/core : 2.2.0

nx.json

{
  "$schema": "./node_modules/nx/schemas/nx-schema.json",
  "neverConnectToCloud": true,
  "targetDefaults": {
    "build": {
      "cache": true,
      "dependsOn": ["^build"],
      "inputs": ["production", "^production"]
    },
    "lint": {
      "cache": true,
      "inputs": [
        "default",
        "{workspaceRoot}/.eslintrc.json",
        "{workspaceRoot}/.eslintignore",
        "{workspaceRoot}/eslint.config.js"
      ]
    },
    "@nx/jest:jest": {
      "cache": true,
      "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
      "options": {
        "passWithNoTests": true
      },
      "configurations": {
        "ci": {
          "ci": true,
          "codeCoverage": true
        }
      }
    },
    "e2e": {
      "cache": true,
      "inputs": ["default", "^production"]
    }
  },
  "namedInputs": {
    "default": ["{projectRoot}/**/*", "sharedGlobals"],
    "production": [
      "default",
      "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
      "!{projectRoot}/tsconfig.spec.json",
      "!{projectRoot}/jest.config.[jt]s",
      "!{projectRoot}/src/test-setup.[jt]s",
      "!{projectRoot}/test-setup.[jt]s",
      "!{projectRoot}/.eslintrc.json",
      "!{projectRoot}/eslint.config.js"
    ],
    "sharedGlobals": []
  },
  "generators": {
    "@nx/angular:application": {
      "style": "scss",
      "linter": "eslint",
      "unitTestRunner": "jest",
      "e2eTestRunner": "playwright"
    },
    "@nx/angular:library": {
      "linter": "eslint",
      "unitTestRunner": "jest"
    },
    "@nx/angular:component": {
      "style": "scss"
    }
  }
}

Failure Logs

No response

Additional Information

I think if an explicit directory is specified the full directory should be used and the apps/ prefix should not be included.

@jefedeltodos jefedeltodos added bug Something isn't working needs-triage This issue has yet to be looked over by a core team member labels Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage This issue has yet to be looked over by a core team member
Projects
None yet
Development

No branches or pull requests

1 participant