Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Boolean options not parsed correctly on schematics cli #393

Closed
@TinyMan

Description

@TinyMan

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x] devkit
- [ ] schematics

Versions

> node --version
v8.9.4
> npm --version
5.6.0
> ver
Microsoft Windows [version 10.0.16299.192]

> npm list -g --depth=0
+-- UNMET PEER DEPENDENCY @angular-devkit/schematics@0.0.48
+-- @angular-devkit/schematics-cli@0.0.5
+-- @angular/cli@1.6.4
+-- @schematics/angular@0.1.13
+-- @types/node@7.0.31
+-- eslint@4.0.0
+-- npm@5.6.0
+-- rxjs@5.5.6
+-- typescript@2.6.2
`-- watchify@3.9.0

npm ERR! peer dep missing: @angular-devkit/schematics@0.0.46, required by @schematics/angular@0.1.13
npm ERR! peer dep missing: @angular-devkit/schematics@0.0.46, required by @schematics/schematics@0.0.13
npm ERR! peer dep missing: @angular-devkit/schematics@0.0.46, required by @schematics/angular@0.1.13

Repro steps

> schematics @schematics/angular:module --name test --routing true

The log given by the failure

Schematic input does not validate against the Schema: {"name":"test","routing":"true","path":"app","sourceDir":"src","routingScope":"Child","spec":true,"flat":false,"commonModule":true}
Errors:
  .routing should be boolean

Desired functionality

Boolean options should be parsed.
Right now it is true if only --routing is specified but it fails with --routing false or --routing true.
For --routing option it is not really a problem because by default it is false: we can set it to true with --routing.
However it is blocking for custom schematics with boolean option that defaults to true: we can't set it to false.

Mention any other details that might be useful

Only the arguments specified here are parsed as booleans:

const booleanArgs = [ 'debug', 'dry-run', 'force', 'help', 'list-schematics', 'verbose' ];

After this minimist assigns the string "true" or "false" to the option hence the error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions