commitizen / commitizen/cz-cli

Bootstrap and custom plugin configuration

Ouverte
#438 6 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
17.5k
Forks
566
Merge moyen
8 h 16 min
PR mergées (30 j)
1

Description

Hi everyone.

Our company is using commitizen for one of our main OSS project but we slowly started using it in smaller projects and tools.

We now require a standard commitizen configuration in order to keep all projects the same way.
Our current solution has a lot of configs and is not working very well for us.

For context we are using:
- Commitizen
- cz-customizable
- validate-commit-msg

Each of this packages has it's own config. for sake of conventions I've started creating our own tool to manage commits (an adapter of comitizen) the goal is to keep all the configuration hidden for the end user as much as possible.

I've seen the `bootstrap` and as far as I can see in the code this are the options you can give:

```js
debug: false,
cliPath: path.join(__dirname, '../node_modules/commitizen'),
config: {
"path": "cz-customizable"
}
```

Now my current problem. `cz-customizable` right now reads from a config file specified in the package json.

I think bootstrap should be able to send all this configuration options to the adapter, but right now the project only uses the path and instances the prompter.

I was thinking on something like:

```js
function getPrompter(adapterConfig) {
var resolvedAdapterPath = resolveAdapterPath(adapterConfig.path);
var adapter = require(resolvedAdapterPath)(adapterConfig);
}
```

or

```js
function getPrompter(adapterPath, adapterConfig) {
var resolvedAdapterPath = resolveAdapterPath(adapterPath);
var adapter = require(resolvedAdapterPath);

if (adapterConfig && adapter && adapter.setConfig && (0, _util.isFunction)(adapter.setConfig)) {
adapter.setConfig(adapterConfig)
}
}
```

First one breaks all the current adapters, so I understand no one is eager to do that.
The second one works without breaking anything since I think most of the adapters do not require a config?

What do you think about it? is something you will like to see for adapters?
Or maybe I should create my own adapter for the company? I was thinking on this because `cz-customizable` has all we need, but it lack the ability to get config from bootstrap

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

L’issue porte sur bootstrap et le chemin de chargement des adaptateurs de getPrompter ; commencez par suivre la manière dont bootstrap transmet actuellement la configuration et dont les adaptateurs sont instanciés. Le travail sera considéré comme terminé lorsqu’une méthode rétrocompatible permettant de transmettre la configuration de bootstrap aux adaptateurs sera définie, avec un accord sur le comportement attendu pour les adaptateurs existants et cz-customizable.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, node.js
Domaine
cli, tooling
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.