Repository: nrwl/nx-console

Issue #1585: [Intellij] context menu action should prefill Generate dialog with a valid directory value
Created: 2023-03-02T19:45:58Z
Current Behavior
If called from the context menu, Nx Generate UI opens with prefilled directory field that contains full path. This breaks generation with the Path contains invalid characters: C:\nx-example\libs\c:\nx-example\libs\somelib error
Expected Behavior
It looks like a context menu action should use a relative path (not full) for the directory property of the generator
Steps to Reproduce

In Project Panel open the context menu on lib folder
Call Nx Generate (UI)
Chose nrwl/lib
Define required fields and press Run

Failure Logs / Images / Videos

C:/nx-example/node_modules/.bin/nx.cmd g @nrwl/js:library --name=somelib --unitTestRunner=none --directory=C:/nx-example/libs --no-interactive

>  NX  Generating @nrwl/js:library

CREATE libs/c:/nx-example/libs/somelib/package.json
CREATE libs/c:/nx-example/libs/somelib/README.md
CREATE libs/c:/nx-example/libs/somelib/src/index.ts
CREATE libs/c:/nx-example/libs/somelib/src/lib/c:-nx-example-libs-somelib.ts
CREATE libs/c:/nx-example/libs/somelib/tsconfig.json
CREATE libs/c:/nx-example/libs/somelib/tsconfig.lib.json
CREATE libs/c:/nx-example/libs/somelib/project.json
CREATE libs/c:/nx-example/libs/somelib/.eslintrc.json
UPDATE tsconfig.base.json

 >  NX   Path contains invalid characters: C:\nx-example\libs\c:\nx-example\libs\somelib

   Pass --verbose to see the stacktrace.

Environment

Nx: 15.8.2
Windows 10
Nx Console version: 1.2.0
JetBrains IntelliJ IDEA 2022.3.1

Duplicate issue #1602: Failure while generating Angular library in IntelliJ due to "Schematic input does not validate against the Schema"
Created: 2023-03-10T15:57:24Z
Current Behavior
When running the "generate Angular library" command from the Nx Console in IntelliJ, there is a dry-run of the schematics involved, however it fails due the name not matching a required pattern.
I put the output in the IntelliJ console of the command triggered by the Nx Console below.
Expected Behavior
The Angular library should be created with no issues.
In fact, when running the schematics manually in the terminal, it works fine: npx nx g @nrwl/angular:library --name=mylib --buildable
Steps to Reproduce





Failure Logs / Images / Videos
C:/some/path/to/my/project/node_modules/.bin/nx.cmd g @nrwl/angular:library --name=mylib --buildable --directory=C:/som/path/to/my/project/libs --no-interactive --dry-run

>  NX  Generating @nrwl/angular:library

InvalidInputOptions [Error]: Schematic input does not validate against the Schema: {"name":"c:-some-path-to-my-project-libs-mylib","prefix":"someprefix","entryFile":"index","skipPackageJson":false,"skipTsConfig":true}
Errors:

  Data path "/name" must match pattern "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$".
    at MapSubscriber.project (C:\some\path\to\my\project\node_modules\@angular-devkit\schematics\tools\schema-option-transform.js:30:27)
    at MapSubscriber._next (C:\some\path\to\my\project\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\map.js:49:35)
    at MapSubscriber.Subscriber.next (C:\some\path\to\my\project\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Subscriber.js:66:18)
    at SafeSubscriber.__tryOrUnsub (C:\some\path\to\my\project\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.next (C:\some\path\to\my\project\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:143:22)
    at Subscriber._next (C:\some\path\to\my\project\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:89:26)
    at Subscriber.next (C:\some\path\to\my\project\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:66:18)
    at SafeSubscriber.__tryOrUnsub (C:\some\path\to\my\project\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.next (C:\some\path\to\my\project\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Subscriber.js:143:22)
    at ThrowIfEmptySubscriber._next (C:\some\path\to\my\project\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\throwIfEmpty.js:44:26) {
  errors: [
    {
      instancePath: '/name',
      schemaPath: '#/properties/name/pattern',
      keyword: 'pattern',
      params: [Object],
      message: 'must match pattern "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$"'
    }
  ]
}

 >  NX   Schematic input does not validate against the Schema: {"name":"c:-some-path-to-my-project-libs-mylib","prefix":"someprefix","entryFile":"index","skipPackageJson":false,"skipTsConfig":true}

   Errors:
   
     Data path "/name" must match pattern "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$".
   Pass --verbose to see the stacktrace.

Environment




Nx Console version: 1.2.0
VSCode version: n/a
IntelliJ: WebStorm 2022.3.3

Closing comment (2023-03-16T12:23:26Z): Duplicate of #1585