t-comm
Version:
专业、稳定、纯粹的工具库
40 lines (33 loc) • 1.4 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var path = require('path');
var git_submodule = require('../git/submodule.js');
var node_nodeCommand = require('../node/node-command.js');
require('fs');
require('../fs/fs.js');
require('@babel/runtime/helpers/typeof');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
function getSubmodulePathStr(file) {
var submodules = git_submodule.getSubmodulePathList(file);
var str = "\n".concat(submodules.map(function (item) {
return "".concat(item, "/*");
}).join('\n'));
return str;
}
function ignoreSubmoduleInESLint(root) {
if (root === void 0) {
root = process.cwd();
}
var str = getSubmodulePathStr(path__default["default"].resolve(root, '.gitmodules'));
node_nodeCommand.execCommand("echo \"".concat(str, "\" >> .eslintignore"), root, 'inherit');
}
function ignoreSubmoduleInStyleLint(root) {
if (root === void 0) {
root = process.cwd();
}
var str = getSubmodulePathStr(path__default["default"].resolve(root, '.gitmodules'));
node_nodeCommand.execCommand("echo \"".concat(str, "\" >> .stylelintignore"), root, 'inherit');
}
exports.ignoreSubmoduleInESLint = ignoreSubmoduleInESLint;
exports.ignoreSubmoduleInStyleLint = ignoreSubmoduleInStyleLint;