Skip to content

Extending pluginOptions in generator #850

Open
@wietseva

Description

@wietseva

What problem does this feature solve?

Enabling custom cli plugins to extend pluginOptions with defaults or prompt answers.
Extending pluginPluginOptions with the generator api.extendPackage will currently just replace instead off merge pluginOptions.

Current Config vue.config.js

{
  lintOnSave: true,
  pluginOptions: {
    someOption: "Some option that was present"
  }
}

Extending pluginOptions generator.js

api.extendPackage({
  vue: {
    pluginOptions: {
      extraOption: "An extra option to be added"
    }
  }
})

In the resulting config vue.config.js someOption was removed.

{
  lintOnSave: true,
  pluginOptions: {
    extraOption: "An extra option to be added"
  }
}

What does the proposed API look like?

generator.js

api.extendPluginOptions( (options) => {
  options.extraOption = "An extra option to be added "
  return options
})

Resulting config vue.config.js

{
  lintOnSave: true,
  pluginOptions: {
    someOption: "Some option that was present"
    extraOption: "An extra option to be added"
  }
}

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