Skip to content

Parser: Schematics options camelCase coercion #13544

Closed

Description

@nickofthyme

🚀 Feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
- [x] schematics

Description

When passing arguments to schematics as options, I would like to be able to pass a dash-case option (i.e. ---dry-run) and get the camelCase equivalent (i.e. dryRun) in the options passed to my schematic.

Currently, if I pass the option option-one as a dash-case argument...

schematics my-collection:my-schematic --option-one=test

The factory function will receive the following options object...

{
    "option-one": "test"
}

Furthermore, if I were to pass both the dash-case and camelCase equivalent of the same argument like so...

schematics my-collection:my-schematic --option-one=test1 --optionOne=test2

The factory function will receive the following options object...

{
    "option-one": "test1",
    "optionOne": "test2"
}

This is not only very confusing but also inconsistent with the base schematics options such as --dry-run. Meaning that the following two commands are analogous...

schematics my-collection:my-schematic --dry-run=true
schematics my-collection:my-schematic --dryRun=true

Thereby treating dry-run as dryRun. I don't see a great use case for allowing two arguments of different cases to coexist.

Describe the solution you'd like

Option 1

Coerce all options argument to camelCase.

Option 2

Smart case corecursion of all options argument based on options schema.

Describe alternatives you've considered

Checking for both dash-case and camelCase options and resolving each option manually based on expected options schema.

Activity

  1. added this to the Backlog milestone on Jan 29, 2019
  2. changed the title [-]Schematics options camelCase coercion[/-] [+]Parser: Schematics options camelCase coercion[/+] on Jan 9, 2020
  3. angular-robot commented on Feb 1, 2022

    @angular-robot
    Contributor

    Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

    Find more details about Angular's feature request process in our documentation.

  4. modified the milestones: Backlog, needsTriage on Feb 1, 2022
  5. angular-robot commented on Feb 21, 2022

    @angular-robot
    Contributor

    Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

    We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

    You can find more details about the feature request process in our documentation.

  6. added
    feature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authors
    and removed
    feature: votes requiredFeature request which is currently still in the voting phase
    on Feb 21, 2022
  7. added a commit that references this issue on Mar 2, 2022
    5330d52
  8. angular-automatic-lock-bot commented on Apr 2, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular-devkit/schematics-clifeatureLabel used to distinguish feature request from other issuesfeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authors

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions