commitizen / commitizen/cz-cli

Can I pass the adapter config from node but not read from then package.json

Offen
#667 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
17.5k
Forks
566
Ø Merge
8 Std. 16 Min.
Gemergte PRs (30 T.)
1

Beschreibung

Hi, thanks you for the great work.
I am trying write a new command to call the `cz-cli` like the [doc](https://github.com/commitizen/cz-cli#commitizen-for-multi-repo-projects) said.
However, I will get some error as below when I run the command if the `pakcage.json` does not have the `config` propery.
```
\node_modules\commitizen\node_modules\cz-conventional-changelog\index.js:10
defaultType: process.env.CZ_TYPE || config.defaultType,
^
TypeError: Cannot read property 'defaultType' of undefined

```
I want the user can just run a commit command and do not need to add package.json config. Is that possible?Someways like:
```
const bootstrap = require('commitizen/dist/cli/git-cz').bootstrap
const path = require('path')
bootstrap({
cliPath: path.join(__dirname, '../node_modules/commitizen'),
config: {
"path": 'cz-conventional-changelog'
},
adapter: {
"commitizen": {
"path": "cz-conventional-changelog"
}
}
})
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit commitizen/dist/cli/git-cz und dem in node_modules/commitizen/node_modules/cz-conventional-changelog/index.js gezeigten Adapter-Pfad und reproduziere anschließend den Befehl ohne eine package.json-Konfiguration. Prüfe, wie bootstrap die Konfiguration erhält und wie der Adapter initialisiert wird. Erledigt ist die Aufgabe, wenn der dokumentierte Befehl die Adapter-Konfiguration direkt übergeben und ohne die package.json-Konfigurationseigenschaft ausgeführt werden kann.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
cli
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.