UNPKG

849 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.bootstrap = bootstrap;
7
8var _commitizen = require("../commitizen");
9
10var _strategies = require("./strategies");
11
12/**
13 * This is the main cli entry point.
14 * environment may be used for debugging.
15 */
16function bootstrap(environment = {}, argv = process.argv) {
17 // Get cli args
18 let rawGitArgs = argv.slice(2, argv.length);
19
20 let adapterConfig = environment.config || _commitizen.configLoader.load(); // Choose a strategy based on the existance the adapter config
21
22
23 if (typeof adapterConfig !== 'undefined') {
24 // This tells commitizen we're in business
25 (0, _strategies.gitCz)(rawGitArgs, environment, adapterConfig);
26 } else {
27 // This tells commitizen that it is not needed, just use git
28 (0, _strategies.git)(rawGitArgs, environment);
29 }
30}
\No newline at end of file