js-code-detector 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -47,9 +47,9 @@ var import_parseGitLabDiffUril = require("./util/parseGitLabDiffUril");
47
47
  var import_gitDiffTool = require("./util/shared/gitDiffTool");
48
48
  var gitDiffFileName = "git_diff.txt";
49
49
  async function getGitRepositoryAndBranch() {
50
- const res = await import_utils.execa.execa("git remote get-url origin", { shell: "/bin/bash" });
50
+ const res = await import_utils.execa.execa("git remote get-url origin", { shell: true });
51
51
  import_utils.chalk.green(["仓库地址:", res.stdout]);
52
- const branch = await import_utils.execa.execa("git rev-parse --abbrev-ref HEAD", { shell: "/bin/bash" });
52
+ const branch = await import_utils.execa.execa("git rev-parse --abbrev-ref HEAD", { shell: true });
53
53
  import_utils.chalk.green(["分支名称:", branch.stdout]);
54
54
  return {
55
55
  gitUrl: res.stdout,
@@ -32,7 +32,7 @@ __export(AstFeatUtil_exports, {
32
32
  default: () => AstFeatUtil
33
33
  });
34
34
  module.exports = __toCommonJS(AstFeatUtil_exports);
35
- var import_lodash_es = require("lodash-es");
35
+ var import_lodash = require("lodash");
36
36
  var import_sha1 = __toESM(require("crypto-js/sha1"));
37
37
  var import_enc_base64 = __toESM(require("crypto-js/enc-base64"));
38
38
  var import_featureLevel = require("../shared/featureLevel");
@@ -202,7 +202,7 @@ var AstFeatUtil = class {
202
202
  let listOfCollection = listOfNodeInfo.map((e) => e.edgeNodeCollection);
203
203
  for (let i = 1; i <= maxDepth; i++) {
204
204
  const hashKeyList = listOfCollection.map((nodes) => nodes.map((node) => node._util.mapDepthDiffToHashKey.get(1)).filter(Boolean));
205
- const commonHashKeyList = (0, import_lodash_es.intersection)(...hashKeyList);
205
+ const commonHashKeyList = (0, import_lodash.intersection)(...hashKeyList);
206
206
  listOfCollection = listOfCollection.map((nodes) => nodes.filter((node) => commonHashKeyList.includes(node._util.mapDepthDiffToHashKey.get(1))));
207
207
  if (listOfCollection.every((collection) => collection.length > 0)) {
208
208
  listOfCollection.forEach((col, index) => {
@@ -32,7 +32,7 @@ __export(Core_exports, {
32
32
  default: () => Core
33
33
  });
34
34
  module.exports = __toCommonJS(Core_exports);
35
- var import_lodash_es = require("lodash-es");
35
+ var import_lodash = require("lodash");
36
36
  var import_FileUtil = __toESM(require("./FileUtil"));
37
37
  var import_AstFeatUtil = __toESM(require("./AstFeatUtil"));
38
38
  var Core = class {
@@ -86,13 +86,13 @@ ${content}
86
86
  const newList = listOfNodeInfo.map(({ rootNode, edgeNodeCollection }) => {
87
87
  var _a;
88
88
  const { filePath, startLine, endLine } = rootNode._util;
89
- const linesNums = (0, import_lodash_es.range)(startLine, endLine + 1);
89
+ const linesNums = (0, import_lodash.range)(startLine, endLine + 1);
90
90
  const edgeNodesLines = edgeNodeCollection.map((edgeNode) => {
91
91
  const { startLine: itemStartLine, endLine: itemEndLine } = edgeNode._util;
92
92
  if (itemStartLine === startLine || itemEndLine === endLine) {
93
93
  return [];
94
94
  }
95
- return itemStartLine + 1 >= itemEndLine ? [] : (0, import_lodash_es.range)(itemStartLine + 1, itemEndLine);
95
+ return itemStartLine + 1 >= itemEndLine ? [] : (0, import_lodash.range)(itemStartLine + 1, itemEndLine);
96
96
  }).flat();
97
97
  const listOfRatedContent = [
98
98
  {
@@ -50,12 +50,12 @@ var import_format_git_diff_content = require("../format_git_diff_content");
50
50
  async function cloneGitRepo(gitUrl, branchName, tempDirPath, folder) {
51
51
  import_utils.logger.ready(`准备clone 源代码到临时目录下的 ${tempDirPath}/${folder} 文件夹`);
52
52
  let stderr, failed;
53
- ({ stderr, failed } = await import_utils.execa.execa(`git clone ${gitUrl} ${tempDirPath}/${folder}`, { shell: "/bin/bash" }));
53
+ ({ stderr, failed } = await import_utils.execa.execa(`git clone ${gitUrl} ${tempDirPath}/${folder}`, { shell: true }));
54
54
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
55
55
  import_utils.logger.info("源代码clone完成");
56
56
  if (branchName !== "master") {
57
57
  import_utils.logger.ready("准备切换到分支");
58
- ({ stderr, failed } = await import_utils.execa.execa(`cd ${tempDirPath}/${folder} && git fetch origin ${branchName}:${branchName} && git checkout ${branchName}`, { shell: "/bin/bash" }));
58
+ ({ stderr, failed } = await import_utils.execa.execa(`cd ${tempDirPath}/${folder} && git fetch origin ${branchName}:${branchName} && git checkout ${branchName}`, { shell: true }));
59
59
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
60
60
  import_utils.logger.info("源代码切换分支完成");
61
61
  }
@@ -64,18 +64,18 @@ async function cloneGitRepo(gitUrl, branchName, tempDirPath, folder) {
64
64
  async function cloneGitRepoAndGetDiff(gitRepoUrl, branchName) {
65
65
  const today = (0, import_dayjs.default)().format("YYYYMDD_HHmmss") + Math.random().toString(36).slice(-5);
66
66
  import_utils.logger.ready("准备生成临时工作目录...");
67
- const [err] = await (0, import_await_to_js.default)(import_utils.execa.execa(`rm -rf ${today}`, { shell: "/bin/bash" }));
67
+ const [err] = await (0, import_await_to_js.default)(import_utils.execa.execa(`rm -rf ${today}`, { shell: true }));
68
68
  if (err) {
69
69
  import_utils.logger.error("临时目录删除失败");
70
70
  }
71
- await import_utils.execa.execa(`mkdir -p ${today}`, { shell: "/bin/bash" });
71
+ await import_utils.execa.execa(`mkdir -p ${today}`, { shell: true });
72
72
  import_utils.logger.info("临时目录建立完成");
73
73
  try {
74
74
  let stderr, failed;
75
75
  ({ stderr, failed } = await cloneGitRepo(gitRepoUrl, branchName, today, import_constants.TARGET));
76
76
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
77
77
  import_utils.logger.ready("准备生成git_diff.txt文件");
78
- ({ stderr, failed } = await import_utils.execa.execa(`cd ${today}/${import_constants.TARGET} && git diff master..${branchName} --unified=0 --output=${import__.gitDiffFileName}`, { shell: "/bin/bash" }));
78
+ ({ stderr, failed } = await import_utils.execa.execa(`cd ${today}/${import_constants.TARGET} && git diff master..${branchName} --unified=0 --output=${import__.gitDiffFileName}`, { shell: true }));
79
79
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
80
80
  const repoType = await (0, import_getRepoSupportFlag.getRepoType)((0, import_path.join)(process.cwd(), today, import_constants.TARGET, "package.json"));
81
81
  import_utils.logger.info(`项目类型为: ${repoType}`);
@@ -103,16 +103,16 @@ async function cloneGitRepoAndGetDiff(gitRepoUrl, branchName) {
103
103
  async function gitDiffTool(arg) {
104
104
  const { gitRepoUrl: gitUrl, baseBranch, targetBranch: branchName, tempDirPath: today, generateFile } = arg;
105
105
  import_utils.logger.ready("准备生成临时工作目录...");
106
- const [err] = await (0, import_await_to_js.default)(import_utils.execa.execa(`rm -rf ${today}`, { shell: "/bin/bash" }));
106
+ const [err] = await (0, import_await_to_js.default)(import_utils.execa.execa(`rm -rf ${today}`, { shell: true }));
107
107
  if (err) {
108
108
  import_utils.logger.error("临时目录删除失败");
109
109
  }
110
- await import_utils.execa.execa(`mkdir -p ${today}`, { shell: "/bin/bash" });
110
+ await import_utils.execa.execa(`mkdir -p ${today}`, { shell: true });
111
111
  import_utils.logger.info("临时目录建立完成");
112
112
  try {
113
113
  import_utils.logger.ready(`准备clone 源代码到临时目录下的 ${import_constants.TARGET} 文件夹`);
114
114
  let stderr, failed;
115
- ({ stderr, failed } = await import_utils.execa.execa(`git clone ${gitUrl} ${today}/${import_constants.TARGET}`, { shell: "/bin/bash" }));
115
+ ({ stderr, failed } = await import_utils.execa.execa(`git clone ${gitUrl} ${today}/${import_constants.TARGET}`, { shell: true }));
116
116
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
117
117
  import_utils.logger.info("源代码clone完成");
118
118
  import_utils.logger.wait("检测项目类型");
@@ -126,21 +126,21 @@ async function gitDiffTool(arg) {
126
126
  return;
127
127
  }
128
128
  import_utils.logger.ready(`准备clone 源代码到临时目录下的 ${import_constants.SOURCE} 文件夹`);
129
- ({ stderr, failed } = await import_utils.execa.execa(`git clone ${gitUrl} ${today}/${import_constants.SOURCE}`, { shell: "/bin/bash" }));
129
+ ({ stderr, failed } = await import_utils.execa.execa(`git clone ${gitUrl} ${today}/${import_constants.SOURCE}`, { shell: true }));
130
130
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
131
131
  import_utils.logger.info("源代码clone完成");
132
132
  if (baseBranch !== "master") {
133
133
  import_utils.logger.ready("准备切换到基准分支");
134
- ({ stderr, failed } = await import_utils.execa.execa(`cd ${today}/${import_constants.SOURCE} && git fetch origin ${baseBranch}:${baseBranch} && git checkout ${baseBranch}`, { shell: "/bin/bash" }));
134
+ ({ stderr, failed } = await import_utils.execa.execa(`cd ${today}/${import_constants.SOURCE} && git fetch origin ${baseBranch}:${baseBranch} && git checkout ${baseBranch}`, { shell: true }));
135
135
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
136
136
  import_utils.logger.info("源代码切换到基准分支完成");
137
137
  }
138
138
  import_utils.logger.ready("准备切换到目标分支");
139
- ({ stderr, failed } = await import_utils.execa.execa(`cd ${today}/${import_constants.TARGET} && git fetch origin ${branchName}:${branchName} && git checkout ${branchName}`, { shell: "/bin/bash" }));
139
+ ({ stderr, failed } = await import_utils.execa.execa(`cd ${today}/${import_constants.TARGET} && git fetch origin ${branchName}:${branchName} && git checkout ${branchName}`, { shell: true }));
140
140
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
141
141
  import_utils.logger.info("分支切换完成");
142
142
  import_utils.logger.ready("准备生成git_diff.txt文件");
143
- ({ stderr, failed } = await import_utils.execa.execa(`cd ${today}/${import_constants.TARGET} && git diff ${baseBranch}..${branchName} --unified=0 --output=${import__.gitDiffFileName}`, { shell: "/bin/bash" }));
143
+ ({ stderr, failed } = await import_utils.execa.execa(`cd ${today}/${import_constants.TARGET} && git diff ${baseBranch}..${branchName} --unified=0 --output=${import__.gitDiffFileName}`, { shell: true }));
144
144
  (0, import_handleExecaError.handleExecaError)({ failed, stderr });
145
145
  import_utils.logger.info("git_diff.txt文件生成完成");
146
146
  if (repoType === "umi") {
@@ -36,7 +36,7 @@ var userAliasGetter = (cwd, appData) => {
36
36
  };
37
37
  };
38
38
  async function umi4SetUp({ targetDirPath }) {
39
- const shellExeResult = await import_utils.execa.execa(`cd ${targetDirPath} && npx max setup`, { shell: "/bin/bash" });
39
+ const shellExeResult = await import_utils.execa.execa(`cd ${targetDirPath} && npx max setup`, { shell: true });
40
40
  const tsconfig = await import_utils.tsconfigPaths.loadConfig(targetDirPath);
41
41
  const appDataContent = (0, import_fs.readFileSync)((0, import_path.join)(targetDirPath, "src", ".umi", "appData.json"), "utf-8");
42
42
  let appData = { config: null };
@@ -27,7 +27,7 @@ var import_fs = require("fs");
27
27
  var import_utils = require("@umijs/utils");
28
28
  var webpackConfigFileName = "__webpack.config.js";
29
29
  async function vueSetUp({ targetDir }) {
30
- const shellExeResult = await import_utils.execa.execa(`cd ${targetDir} && npx vue-cli-service inspect --verbose`, { shell: "/bin/bash" });
30
+ const shellExeResult = await import_utils.execa.execa(`cd ${targetDir} && npx vue-cli-service inspect --verbose`, { shell: true });
31
31
  const { failed, stdout } = shellExeResult;
32
32
  const filePath = (0, import_path.join)(targetDir, webpackConfigFileName);
33
33
  if (!failed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-code-detector",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/crypto-js": "^4.2.2",
32
- "@types/lodash-es": "^4.17.12",
32
+ "@types/lodash": "^4.17.20",
33
33
  "@types/madge": "^5.0.3",
34
34
  "father": "^4.6.3"
35
35
  },
@@ -40,7 +40,7 @@
40
40
  "await-to-js": "^3.0.0",
41
41
  "crypto-js": "^4.2.0",
42
42
  "dayjs": "^1.11.13",
43
- "lodash-es": "^4.17.21",
43
+ "lodash": "^4.17.21",
44
44
  "madge": "^8.0.0",
45
45
  "vue-eslint-parser": "^10.2.0"
46
46
  }