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/dist/index.mjs CHANGED
@@ -1,48 +1,28 @@
1
- import { createRequire } from "node:module";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
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
- //#region \0rolldown/runtime.js
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
- * say hello
24
- *
25
- * @author CaoMeiYouRen
26
- * @date 2020-11-28
27
- * @export
10
+ * 简化调用的入口(内部数据处理,非 CLI 使用)。
28
11
  */
29
- function hello() {
30
- if (__PROD__) console.log("Hello production");
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
- console.log("__dirname:", typeof __dirname !== "undefined" ? __dirname : "not defined");
35
- console.log("__filename:", typeof __filename !== "undefined" ? __filename : "not defined");
36
- try {
37
- const os = __require && __require("node:os");
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
- console.log("import.meta.url:", import.meta.url || "not defined");
43
- console.log("import.meta.dirname:", import.meta.dirname || "not defined");
44
- console.log("import.meta.filename:", import.meta.filename || "not defined");
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 { hello };
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../node_modules/.pnpm/tsdown@0.22.3_tsx@4.23.1_typescript@6.0.3/node_modules/tsdown/esm-shims.js","../src/env.ts","../src/index.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","export const __PROD__ = process.env.NODE_ENV === 'production'\nexport const __DEV__ = process.env.NODE_ENV === 'development'\n","import { __PROD__, __DEV__ } from '@/env'\n/**\n * say hello\n *\n * @author CaoMeiYouRen\n * @date 2020-11-28\n * @export\n */\nexport function hello() {\n if (__PROD__) {\n console.log('Hello production')\n }\n if (__DEV__) {\n console.log('Hello development')\n }\n console.log('你好,世界!')\n}\n\n// 测试 ESM 中的 CommonJS 变量(需要 shims 支持)\nconsole.log('__dirname:', typeof __dirname !== 'undefined' ? __dirname : 'not defined')\nconsole.log('__filename:', typeof __filename !== 'undefined' ? __filename : 'not defined')\n\n// 测试 ESM 中的 require(Node.js 平台自动注入)\ntry {\n const os = require && require('os')\n console.log('require(\"os\"):', !!os)\n} catch (e) {\n console.log('require is not available:', e)\n}\n\n// 测试 CommonJS 中的 ESM 变量(始终可用)\nconsole.log('import.meta.url:', import.meta.url || 'not defined')\nconsole.log('import.meta.dirname:', import.meta.dirname || 'not defined')\nconsole.log('import.meta.filename:', import.meta.filename || 'not defined')\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;AAIA,MAAM,oBAAoB,cAAc,OAAO,KAAK,GAAG;AACvD,MAAM,mBAAmB,KAAK,QAAQ,YAAY,CAAC;AAEnD,MAAa,YAA4B,2BAAW;AACpD,MAAa,aAA6B,4BAAY;;;;ACRtD,MAAa,WAAW,QAAQ,IAAI,aAAa;AACjD,MAAa,UAAU,QAAQ,IAAI,aAAa;;;;;;;;;;;ACOhD,SAAgB,QAAQ;CACpB,IAAI,UACA,QAAQ,IAAI,kBAAkB;CAElC,IAAI,SACA,QAAQ,IAAI,mBAAmB;CAEnC,QAAQ,IAAI,QAAQ;AACxB;AAGA,QAAQ,IAAI,cAAc,OAAO,cAAc,cAAc,YAAY,aAAa;AACtF,QAAQ,IAAI,eAAe,OAAO,eAAe,cAAc,aAAa,aAAa;AAGzF,IAAI;CACA,MAAM,4BAAwB,SAAI;CAClC,QAAQ,IAAI,oBAAkB,CAAC,CAAC,EAAE;AACtC,SAAS,GAAG;CACR,QAAQ,IAAI,6BAA6B,CAAC;AAC9C;AAGA,QAAQ,IAAI,oBAAoB,OAAO,KAAK,OAAO,aAAa;AAChE,QAAQ,IAAI,wBAAwB,OAAO,KAAK,WAAW,aAAa;AACxE,QAAQ,IAAI,yBAAyB,OAAO,KAAK,YAAY,aAAa"}
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.0.0",
4
- "description": "这是一个面向多项目维护者的自动化工具,旨在自动处理 Dependabot 和 Code Scanning 产生的大量简单、重复的告警修复工作,如依赖版本升级、安全漏洞修复等,从而显著提升维护效率。",
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
- "scripts": {
26
- "release": "semantic-release",
27
- "lint": "cross-env NODE_ENV=production eslint . --fix",
28
- "prebuild": "rimraf dist",
29
- "build": "cross-env NODE_ENV=production tsdown",
30
- "dev": "cross-env NODE_ENV=development tsx watch src/index.ts",
31
- "dev:tsdown": "cross-env NODE_ENV=development tsdown --watch",
32
- "start": "node ./dist/index",
33
- "start:tsx": "cross-env NODE_ENV=production tsx src/index.ts",
34
- "commit": "cz",
35
- "prepare": "husky",
36
- "typecheck": "tsc --noEmit",
37
- "test": "vitest run",
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/node": "^26.0.1",
43
- "commitizen": "^4.3.2",
44
- "commitlint": "^21.2.1",
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
- "eslint": "^9.34.0",
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
- "semantic-release": "^25.0.8",
55
- "semantic-release-cmyr-config": "^1.0.2",
56
- "tsdown": "^0.22.0",
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
- "keywords": [
70
- "dependabot",
71
- "automation",
72
- "security-fixes",
73
- "dependency-management",
74
- "github-actions",
75
- "typescript"
76
- ],
77
- "homepage": "https://github.com/CaoMeiYouRen/dependfix#readme",
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
  }