mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-16 07:13:46 -05:00
chore(package): re-init package with commitizen and standard-release
This commit is contained in:
53
node_modules/commitizen/dist/cli/commitizen.js
generated
vendored
Normal file
53
node_modules/commitizen/dist/cli/commitizen.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.bootstrap = undefined;
|
||||
|
||||
var _commitizen = require('../commitizen');
|
||||
|
||||
var _parsers = require('./parsers');
|
||||
|
||||
var _shelljs = require('shelljs');
|
||||
|
||||
var sh = _interopRequireWildcard(_shelljs);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
var parse = _parsers.commitizen.parse;
|
||||
exports.bootstrap = bootstrap;
|
||||
|
||||
/**
|
||||
* This is the main cli entry point.
|
||||
* environment may be used for debugging.
|
||||
*/
|
||||
|
||||
function bootstrap() {
|
||||
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
|
||||
// Get cli args
|
||||
var rawGitArgs = process.argv.slice(2, process.argv.length);
|
||||
|
||||
// Parse the args
|
||||
var parsedArgs = parse(rawGitArgs);
|
||||
var command = parsedArgs._[0];
|
||||
|
||||
// Do actions based on commands
|
||||
if (command === "init") {
|
||||
var adapterNpmName = parsedArgs._[1];
|
||||
if (adapterNpmName) {
|
||||
console.log('Attempting to initialize using the npm package ' + adapterNpmName);
|
||||
try {
|
||||
(0, _commitizen.init)(sh, process.cwd(), adapterNpmName, parsedArgs);
|
||||
} catch (e) {
|
||||
console.error('Error: ' + e);
|
||||
}
|
||||
} else {
|
||||
console.error('Error: You must provide an adapter name as the second argument.');
|
||||
}
|
||||
} else {
|
||||
console.log('\n \n Commitizen has two command line tools:\n \n 1) commitizen -- used for installing adapters into your project\n 2) git-cz -- used for making commits according to convention\n note: you can run \'git cz\' if installed with -g\n \n Generally if you\'re using someone else\'s repo and they\'ve already set up an\n adapter, you\'re going to just be running:\n \n git-cz\n \n However, if you create a new repo and you want to make it easier for future \n contributors to follow your commit message conventions using commitizen then\n you\'ll need to run a command like this one to add this adapter to your config:\n \n commitizen init cz-conventional-changelog --save\n \n You should swap out cz-conventional-changelog for the NPM package name of the\n adapter you wish you install in your project\'s package.json.\n \n Detailed usage:\n \n 1) commitizen <sub-command>\n \n init <adapter-npm-name> [args]\n \n description: Install a commitizen adapter from npm and adds it to your\n config.commitizen in your package.json file.\n \n args:\n --save Install the adapter to package.json dependencies \n --save-dev Install the adapter to devDependencies\n --save-exact Install an exact version instead of a range\n --force Force install the adapter, even if a previous one exists.\n \n 2) git-cz <any regular git commit arguments>\n \n description: Runs the commitizen prompter, asking you questions so that you\n follow the commit conventions of the repository of the current \n directory.\n \n note: git-cz may even be run as \'git cz\' if installed with -g.\n \n ');
|
||||
}
|
||||
}
|
||||
36
node_modules/commitizen/dist/cli/git-cz.js
generated
vendored
Normal file
36
node_modules/commitizen/dist/cli/git-cz.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.bootstrap = undefined;
|
||||
|
||||
var _commitizen = require('../commitizen');
|
||||
|
||||
var _strategies = require('./strategies');
|
||||
|
||||
exports.bootstrap = bootstrap;
|
||||
|
||||
/**
|
||||
* This is the main cli entry point.
|
||||
* environment may be used for debugging.
|
||||
*/
|
||||
|
||||
function bootstrap() {
|
||||
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
|
||||
// Get cli args
|
||||
var rawGitArgs = process.argv.slice(2, process.argv.length);
|
||||
|
||||
var adapterConfig = environment.config || _commitizen.configLoader.load();
|
||||
|
||||
// Choose a strategy based on the existance the adapter config
|
||||
if (typeof adapterConfig !== 'undefined') {
|
||||
// This tells commitizen we're in business
|
||||
(0, _strategies.gitCz)(rawGitArgs, environment, adapterConfig);
|
||||
} else {
|
||||
// This tells commitizen that it is not needed, just use git
|
||||
(0, _strategies.git)(rawGitArgs, environment);
|
||||
}
|
||||
}
|
||||
19
node_modules/commitizen/dist/cli/parsers.js
generated
vendored
Normal file
19
node_modules/commitizen/dist/cli/parsers.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.gitCz = exports.commitizen = undefined;
|
||||
|
||||
var _commitizen = require('./parsers/commitizen');
|
||||
|
||||
var commitizen = _interopRequireWildcard(_commitizen);
|
||||
|
||||
var _gitCz = require('./parsers/git-cz');
|
||||
|
||||
var gitCz = _interopRequireWildcard(_gitCz);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
exports.commitizen = commitizen;
|
||||
exports.gitCz = gitCz;
|
||||
31
node_modules/commitizen/dist/cli/parsers/commitizen.js
generated
vendored
Normal file
31
node_modules/commitizen/dist/cli/parsers/commitizen.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parse = undefined;
|
||||
|
||||
var _minimist = require('minimist');
|
||||
|
||||
var _minimist2 = _interopRequireDefault(_minimist);
|
||||
|
||||
var _util = require('../../common/util');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.parse = parse;
|
||||
|
||||
/**
|
||||
* Takes args, parses with minimist and some ugly vudoo, returns output
|
||||
*
|
||||
* TODO: Aww shit this is ugly. Rewrite with mega leet tests plz, kthnx.
|
||||
*/
|
||||
|
||||
function parse(rawGitArgs) {
|
||||
|
||||
var args = (0, _minimist2.default)(rawGitArgs, {
|
||||
boolean: true
|
||||
});
|
||||
|
||||
return args;
|
||||
}
|
||||
86
node_modules/commitizen/dist/cli/parsers/git-cz.js
generated
vendored
Normal file
86
node_modules/commitizen/dist/cli/parsers/git-cz.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parse = undefined;
|
||||
|
||||
var _minimist = require('minimist');
|
||||
|
||||
var _minimist2 = _interopRequireDefault(_minimist);
|
||||
|
||||
var _util = require('../../common/util');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.parse = parse;
|
||||
|
||||
|
||||
var reShortMessage = /^-([a-zA-Z]*)m(.*)$/;
|
||||
var reLongMessage = /^--message(=.*)?$/;
|
||||
|
||||
/**
|
||||
* Strip message declaration from git arguments
|
||||
*/
|
||||
function parse(rawGitArgs) {
|
||||
var result = [];
|
||||
var skipNext = false;
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = rawGitArgs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var arg = _step.value;
|
||||
|
||||
var match = void 0;
|
||||
|
||||
if (skipNext) {
|
||||
skipNext = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
match = reShortMessage.exec(arg);
|
||||
|
||||
if (match) {
|
||||
if (match[1]) {
|
||||
result.push('-' + match[1]);
|
||||
}
|
||||
|
||||
if (!match[2]) {
|
||||
skipNext = true;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
match = reLongMessage.exec(arg);
|
||||
|
||||
if (match) {
|
||||
if (!match[1]) {
|
||||
skipNext = true;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
result.push(arg);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
19
node_modules/commitizen/dist/cli/strategies.js
generated
vendored
Normal file
19
node_modules/commitizen/dist/cli/strategies.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.gitCz = exports.git = undefined;
|
||||
|
||||
var _git = require('./strategies/git');
|
||||
|
||||
var _git2 = _interopRequireDefault(_git);
|
||||
|
||||
var _gitCz = require('./strategies/git-cz');
|
||||
|
||||
var _gitCz2 = _interopRequireDefault(_gitCz);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.git = _git2.default;
|
||||
exports.gitCz = _gitCz2.default;
|
||||
106
node_modules/commitizen/dist/cli/strategies/git-cz.js
generated
vendored
Normal file
106
node_modules/commitizen/dist/cli/strategies/git-cz.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _fs = require('fs');
|
||||
|
||||
var _fs2 = _interopRequireDefault(_fs);
|
||||
|
||||
var _path = require('path');
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
var _shelljs = require('shelljs');
|
||||
|
||||
var _shelljs2 = _interopRequireDefault(_shelljs);
|
||||
|
||||
var _inquirer = require('inquirer');
|
||||
|
||||
var _inquirer2 = _interopRequireDefault(_inquirer);
|
||||
|
||||
var _findRoot = require('find-root');
|
||||
|
||||
var _findRoot2 = _interopRequireDefault(_findRoot);
|
||||
|
||||
var _util = require('../../common/util');
|
||||
|
||||
var _parsers = require('../parsers');
|
||||
|
||||
var _commitizen = require('../../commitizen');
|
||||
|
||||
var _git = require('../../git');
|
||||
|
||||
var _git2 = require('./git');
|
||||
|
||||
var gitStrategy = _interopRequireWildcard(_git2);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// destructure for shorter apis
|
||||
var parse = _parsers.gitCz.parse;
|
||||
var getPrompter = _commitizen.adapter.getPrompter,
|
||||
resolveAdapterPath = _commitizen.adapter.resolveAdapterPath;
|
||||
var isClean = _commitizen.staging.isClean;
|
||||
exports.default = gitCz;
|
||||
|
||||
|
||||
function gitCz(rawGitArgs, environment, adapterConfig) {
|
||||
|
||||
// See if any override conditions exist.
|
||||
|
||||
// In these very specific scenarios we may want to use a different
|
||||
// commit strategy than git-cz. For example, in the case of --amend
|
||||
var parsedCommitizenArgs = _parsers.commitizen.parse(rawGitArgs);
|
||||
|
||||
if (parsedCommitizenArgs.a) {
|
||||
// console.log('override -a in place');
|
||||
(0, _git.addPath)(_shelljs2.default, process.cwd());
|
||||
}
|
||||
|
||||
if (parsedCommitizenArgs.amend) {
|
||||
// console.log('override --amend in place');
|
||||
gitStrategy.default(rawGitArgs, environment);
|
||||
return;
|
||||
}
|
||||
|
||||
// Now, if we've made it past overrides, proceed with the git-cz strategy
|
||||
var parsedGitCzArgs = parse(rawGitArgs);
|
||||
|
||||
// Determine if we need to process this commit as a retry instead of a
|
||||
// normal commit.
|
||||
var retryLastCommit = rawGitArgs && rawGitArgs[0] === '--retry';
|
||||
|
||||
var resolvedAdapterConfigPath = resolveAdapterPath(adapterConfig.path);
|
||||
var resolvedAdapterRootPath = (0, _findRoot2.default)(resolvedAdapterConfigPath);
|
||||
var prompter = getPrompter(adapterConfig.path);
|
||||
|
||||
isClean(process.cwd(), function (error, stagingIsClean) {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (stagingIsClean) {
|
||||
throw new Error('No files added to staging! Did you forget to run git add?');
|
||||
}
|
||||
|
||||
// OH GOD IM SORRY FOR THIS SECTION
|
||||
var adapterPackageJson = (0, _util.getParsedPackageJsonFromPath)(resolvedAdapterRootPath);
|
||||
var cliPackageJson = (0, _util.getParsedPackageJsonFromPath)(environment.cliPath);
|
||||
console.log('cz-cli@' + cliPackageJson.version + ', ' + adapterPackageJson.name + '@' + adapterPackageJson.version + '\n');
|
||||
(0, _commitizen.commit)(_shelljs2.default, _inquirer2.default, process.cwd(), prompter, {
|
||||
args: parsedGitCzArgs,
|
||||
disableAppendPaths: true,
|
||||
emitData: true,
|
||||
quiet: false,
|
||||
retryLastCommit: retryLastCommit
|
||||
}, function (error) {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
33
node_modules/commitizen/dist/cli/strategies/git.js
generated
vendored
Normal file
33
node_modules/commitizen/dist/cli/strategies/git.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _child_process = require('child_process');
|
||||
|
||||
var _child_process2 = _interopRequireDefault(_child_process);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = git;
|
||||
|
||||
// We don't have a config, so either we use raw args to try to commit
|
||||
// or if debug is enabled then we do a strict check for a config file.
|
||||
|
||||
function git(rawGitArgs, environment) {
|
||||
if (environment.debug === true) {
|
||||
console.error('COMMITIZEN DEBUG: No git-cz friendly config was detected. I looked for .czrc, .cz.json, or czConfig in package.json.');
|
||||
} else {
|
||||
var vanillaGitArgs = ["commit"].concat(rawGitArgs);
|
||||
|
||||
var child = _child_process2.default.spawn('git', vanillaGitArgs, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
|
||||
child.on('error', function (e, code) {
|
||||
console.error(e);
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user