dependfix 0.0.0 → 0.1.0
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/README.md +59 -78
- package/dist/bin.cjs +14 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +15 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/cli.cjs +2812 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.mjs +2530 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.cjs +66 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +667 -7
- package/dist/index.d.mts +667 -7
- package/dist/index.mjs +18 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +53 -67
package/dist/index.mjs
CHANGED
|
@@ -1,48 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { A as createPullRequest, B as fetchDependabotAlerts, C as parseMajorVersion, D as computeFixAndPrPlan, E as closePullRequest, F as getBranchPrStatus, H as createGitHubClient, I as isConfirmAnswer, L as listDependfixBranches, M as extractFingerprintFromBranch, N as findDependfixOpenPR, O as computeFixFingerprint, P as generatePRBody, R as pushBranch, S as overrideTransitiveDependency, T as upgradeDependency, V as mapGitHubError, _ as repairLockfile, a as RUNTIME_MODES, b as extractPrefix, c as readEnvConfig, d as resolveRepoList, f as DependfixApp, g as computeLockfileDiff, h as classifyLockfileFailure, i as DEFAULT_RUNTIME_CONFIG, j as deleteRemoteBranch, k as createFixBranch, l as resolveRuntimeConfig, m as sanitizeOutput, n as parseCliArgs, o as SEVERITY_THRESHOLDS, p as runVerification, r as runCli, s as inferRepoFromGitRemote, t as dependfixCommand, u as readReposFile, v as resolvePnpmVersion, w as readLockfileVersion, x as findDependencyVersion, y as ensurePnpmOverrides, z as stageAndCommit } from "./cli.mjs";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { runMain } from "citty";
|
|
4
|
+
import { toAppError } from "@dependfix/core";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
6
|
+
export * from "@dependfix/core"
|
|
7
7
|
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region node_modules/.pnpm/tsdown@0.22.3_tsx@4.23.1_typescript@6.0.3/node_modules/tsdown/esm-shims.js
|
|
10
|
-
const getFilename = () => fileURLToPath(import.meta.url);
|
|
11
|
-
const getDirname = () => path.dirname(getFilename());
|
|
12
|
-
const __dirname = /* @__PURE__ */ getDirname();
|
|
13
|
-
const __filename = /* @__PURE__ */ getFilename();
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/env.ts
|
|
17
|
-
const __PROD__ = process.env.NODE_ENV === "production";
|
|
18
|
-
const __DEV__ = process.env.NODE_ENV === "development";
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
8
|
//#region src/index.ts
|
|
22
9
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @author CaoMeiYouRen
|
|
26
|
-
* @date 2020-11-28
|
|
27
|
-
* @export
|
|
10
|
+
* 简化调用的入口(内部数据处理,非 CLI 使用)。
|
|
28
11
|
*/
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
if (__DEV__) console.log("Hello development");
|
|
32
|
-
console.log("你好,世界!");
|
|
12
|
+
function main(args = process.argv.slice(2)) {
|
|
13
|
+
return runCli(args);
|
|
33
14
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
console.log("require(\"os\"):", !!os);
|
|
39
|
-
} catch (e) {
|
|
40
|
-
console.log("require is not available:", e);
|
|
15
|
+
function isExecutedAsEntryPoint() {
|
|
16
|
+
const entry = process.argv[1];
|
|
17
|
+
if (!entry) return false;
|
|
18
|
+
return import.meta.url === pathToFileURL(entry).href;
|
|
41
19
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
console.
|
|
20
|
+
if (isExecutedAsEntryPoint()) runMain(dependfixCommand).catch((error) => {
|
|
21
|
+
const appError = toAppError(error, "CLI_EXECUTION_FAILED");
|
|
22
|
+
console.error(appError.message);
|
|
23
|
+
process.exitCode = 1;
|
|
24
|
+
});
|
|
45
25
|
|
|
46
26
|
//#endregion
|
|
47
|
-
export {
|
|
27
|
+
export { DEFAULT_RUNTIME_CONFIG, DependfixApp, RUNTIME_MODES, SEVERITY_THRESHOLDS, classifyLockfileFailure, closePullRequest, computeFixAndPrPlan, computeFixFingerprint, computeLockfileDiff, createFixBranch, createGitHubClient, createPullRequest, deleteRemoteBranch, dependfixCommand, ensurePnpmOverrides, extractFingerprintFromBranch, extractPrefix, fetchDependabotAlerts, findDependencyVersion, findDependfixOpenPR, generatePRBody, getBranchPrStatus, inferRepoFromGitRemote, isConfirmAnswer, listDependfixBranches, main, mapGitHubError, overrideTransitiveDependency, parseCliArgs, parseMajorVersion, pushBranch, readEnvConfig, readLockfileVersion, readReposFile, repairLockfile, resolvePnpmVersion, resolveRepoList, resolveRuntimeConfig, runCli, runVerification, sanitizeOutput, stageAndCommit, upgradeDependency };
|
|
48
28
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url'\nimport { runMain } from 'citty'\nimport { toAppError } from '@dependfix/core'\nimport { dependfixCommand, runCli, type CliRunResult } from './cli'\n\nexport * from '@dependfix/core'\nexport * from './app'\nexport * from './cli'\nexport * from './config'\nexport * from './fixers/dependency'\nexport * from './fixers/pnpm'\nexport * from './github'\nexport * from './runners'\n\n/**\n * 简化调用的入口(内部数据处理,非 CLI 使用)。\n */\nexport function main(args: string[] = process.argv.slice(2)): CliRunResult {\n return runCli(args)\n}\n\nfunction isExecutedAsEntryPoint(): boolean {\n const entry = process.argv[1]\n\n if (!entry) {\n return false\n }\n\n return import.meta.url === pathToFileURL(entry).href\n}\n\nif (isExecutedAsEntryPoint()) {\n // 优先使用 citty 接管(自动 --help、子命令等)\n void runMain(dependfixCommand).catch((error: unknown) => {\n const appError = toAppError(error, 'CLI_EXECUTION_FAILED')\n console.error(appError.message)\n process.exitCode = 1\n })\n}\n"],"mappings":";;;;;;;;;;;AAiBA,SAAgB,KAAK,OAAiB,QAAQ,KAAK,MAAM,EAAE,EAAgB;AACvE,QAAO,OAAO,KAAK;;AAGvB,SAAS,yBAAkC;CACvC,MAAM,QAAQ,QAAQ,KAAK;AAE3B,KAAI,CAAC,MACD,QAAO;AAGX,QAAO,OAAO,KAAK,QAAQ,cAAc,MAAM,CAAC;;AAGpD,IAAI,wBAAwB,CAExB,CAAK,QAAQ,iBAAiB,CAAC,OAAO,UAAmB;CACrD,MAAM,WAAW,WAAW,OAAO,uBAAuB;AAC1D,SAAQ,MAAM,SAAS,QAAQ;AAC/B,SAAQ,WAAW;EACrB"}
|
package/package.json
CHANGED
|
@@ -1,95 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dependfix",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "一个自动化修复 github security 告警的方案",
|
|
5
5
|
"author": "CaoMeiYouRen",
|
|
6
|
-
"private": false,
|
|
7
6
|
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"security",
|
|
10
|
+
"dependabot",
|
|
11
|
+
"code-scanning",
|
|
12
|
+
"dependabot-alerts",
|
|
13
|
+
"cli"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/dependfix/dependfix#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/dependfix/dependfix.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/dependfix/dependfix/issues"
|
|
22
|
+
},
|
|
8
23
|
"main": "./dist/index.cjs",
|
|
9
24
|
"module": "./dist/index.mjs",
|
|
10
25
|
"types": "./dist/index.d.mts",
|
|
11
26
|
"exports": {
|
|
12
27
|
".": {
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
13
29
|
"import": "./dist/index.mjs",
|
|
14
|
-
"require": "./dist/index.cjs"
|
|
15
|
-
"types": "./dist/index.d.mts"
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
16
31
|
},
|
|
17
32
|
"./package.json": "./package.json"
|
|
18
33
|
},
|
|
19
34
|
"files": [
|
|
20
35
|
"dist"
|
|
21
36
|
],
|
|
37
|
+
"bin": {
|
|
38
|
+
"dependfix": "./dist/bin.mjs"
|
|
39
|
+
},
|
|
22
40
|
"engines": {
|
|
23
41
|
"node": ">=20"
|
|
24
42
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"test:coverage": "vitest run --coverage"
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@octokit/rest": "^22.0.1",
|
|
45
|
+
"citty": "^0.2.2",
|
|
46
|
+
"dayjs": "^1.11.20",
|
|
47
|
+
"dotenv": "^17.3.1",
|
|
48
|
+
"fs-extra": "^11.3.4",
|
|
49
|
+
"isomorphic-unfetch": "^4.0.2",
|
|
50
|
+
"lodash-es": "^4.17.23",
|
|
51
|
+
"p-queue": "^9.1.0",
|
|
52
|
+
"tslib": "^2.8.1",
|
|
53
|
+
"yaml": "^2.8.3",
|
|
54
|
+
"zx": "^8.8.5",
|
|
55
|
+
"@dependfix/core": "0.1.0"
|
|
39
56
|
},
|
|
40
57
|
"devDependencies": {
|
|
58
|
+
"@octokit/request-error": "^5.1.1",
|
|
41
59
|
"@types/debug": "^4.1.13",
|
|
42
|
-
"@types/
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"commitlint-config-cmyr": "^1.0.1",
|
|
60
|
+
"@types/fs-extra": "^11.0.4",
|
|
61
|
+
"@types/lodash-es": "^4.17.12",
|
|
62
|
+
"@types/node": "^25.5.0",
|
|
46
63
|
"cross-env": "^10.0.0",
|
|
47
|
-
"cz-conventional-changelog-cmyr": "^2.0.0",
|
|
48
64
|
"debug": "^4.4.3",
|
|
49
|
-
"
|
|
50
|
-
"eslint-config-cmyr": "^2.3.1",
|
|
51
|
-
"husky": "^9.1.7",
|
|
52
|
-
"lint-staged": "^17.2.0",
|
|
65
|
+
"nock": "^14.0.16",
|
|
53
66
|
"rimraf": "^6.1.3",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"tsx": "^4.23.1",
|
|
58
|
-
"typescript": "^6.0.2",
|
|
59
|
-
"vite": "^7.0.5",
|
|
60
|
-
"vitest": "^3.2.4"
|
|
61
|
-
},
|
|
62
|
-
"config": {},
|
|
63
|
-
"lint-staged": {
|
|
64
|
-
"*.{js,ts}": [
|
|
65
|
-
"npm run lint",
|
|
66
|
-
"git add"
|
|
67
|
-
]
|
|
67
|
+
"tsdown": "^0.21.5",
|
|
68
|
+
"tsx": "^4.21.0",
|
|
69
|
+
"typescript": "^5.9.3"
|
|
68
70
|
},
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"repository": {
|
|
79
|
-
"type": "git",
|
|
80
|
-
"url": "git+https://github.com/CaoMeiYouRen/dependfix.git"
|
|
81
|
-
},
|
|
82
|
-
"bugs": {
|
|
83
|
-
"url": "https://github.com/CaoMeiYouRen/dependfix/issues"
|
|
84
|
-
},
|
|
85
|
-
"dependencies": {
|
|
86
|
-
"tslib": "^2.8.1"
|
|
87
|
-
},
|
|
88
|
-
"type": "module",
|
|
89
|
-
"publishConfig": {
|
|
90
|
-
"access": "public"
|
|
91
|
-
},
|
|
92
|
-
"changelog": {
|
|
93
|
-
"language": "zh"
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "tsdown",
|
|
73
|
+
"prebuild": "rimraf dist",
|
|
74
|
+
"dev": "cross-env NODE_ENV=development tsx watch src/index.ts",
|
|
75
|
+
"dev:tsdown": "cross-env NODE_ENV=development tsdown --watch",
|
|
76
|
+
"start": "node ./dist/index.mjs",
|
|
77
|
+
"start:tsx": "cross-env NODE_ENV=production tsx src/index.ts",
|
|
78
|
+
"typecheck": "tsc --noEmit",
|
|
79
|
+
"lint": "eslint . --fix"
|
|
94
80
|
}
|
|
95
81
|
}
|