socket 1.0.42 → 1.0.43
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/cli.js +16 -9
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/types/commands/fix/agent-fix.d.mts.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3882,6 +3882,13 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
3882
3882
|
spinner?.dedent();
|
|
3883
3883
|
packumentCache.clear();
|
|
3884
3884
|
};
|
|
3885
|
+
const getModifiedFiles = async (cwd = process.cwd()) => {
|
|
3886
|
+
const unstagedCResult = await gitUnstagedModifiedFiles(cwd);
|
|
3887
|
+
return unstagedCResult.ok ? unstagedCResult.data.filter(filepath => {
|
|
3888
|
+
const basename = path.basename(filepath);
|
|
3889
|
+
return basename === 'package.json' || basename === pkgEnvDetails.lockName;
|
|
3890
|
+
}) : [];
|
|
3891
|
+
};
|
|
3885
3892
|
const handleInstallFail = () => {
|
|
3886
3893
|
cleanupInfoEntriesLoop();
|
|
3887
3894
|
return {
|
|
@@ -3890,6 +3897,9 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
3890
3897
|
cause: `Unexpected condition: ${pkgEnvDetails.agent} install failed`
|
|
3891
3898
|
};
|
|
3892
3899
|
};
|
|
3900
|
+
const hasModifiedFiles = async (cwd = process.cwd()) => {
|
|
3901
|
+
return (await getModifiedFiles(cwd)).length > 0;
|
|
3902
|
+
};
|
|
3893
3903
|
spinner?.stop();
|
|
3894
3904
|
infoEntriesLoop: for (let i = 0, {
|
|
3895
3905
|
length
|
|
@@ -4044,13 +4054,8 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4044
4054
|
await afterUpdate(editablePkgJson, packument, oldVersion, newVersion, vulnerableVersionRange, fixConfig);
|
|
4045
4055
|
|
|
4046
4056
|
// eslint-disable-next-line no-await-in-loop
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
const basename = path.basename(filepath);
|
|
4050
|
-
return basename === 'package.json' || basename === pkgEnvDetails.lockName;
|
|
4051
|
-
}) : [];
|
|
4052
|
-
if (!moddedFilepaths.length) {
|
|
4053
|
-
logger.logger.warn('Unexpected condition: Nothing to commit, skipping PR creation.');
|
|
4057
|
+
if (!(await hasModifiedFiles(cwd))) {
|
|
4058
|
+
debug.debugFn('notice', 'skip: nothing to commit, skipping PR creation');
|
|
4054
4059
|
// Reset things just in case.
|
|
4055
4060
|
if (fixEnv.isCi) {
|
|
4056
4061
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -4103,7 +4108,9 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4103
4108
|
try {
|
|
4104
4109
|
if (
|
|
4105
4110
|
// eslint-disable-next-line no-await-in-loop
|
|
4106
|
-
!(await gitCreateAndPushBranch(branch, getSocketCommitMessage(oldPurl, newVersion, workspace),
|
|
4111
|
+
!(await gitCreateAndPushBranch(branch, getSocketCommitMessage(oldPurl, newVersion, workspace),
|
|
4112
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4113
|
+
await getModifiedFiles(cwd), {
|
|
4107
4114
|
cwd,
|
|
4108
4115
|
email: fixEnv.gitEmail,
|
|
4109
4116
|
user: fixEnv.gitUser
|
|
@@ -14303,5 +14310,5 @@ void (async () => {
|
|
|
14303
14310
|
await utils.captureException(e);
|
|
14304
14311
|
}
|
|
14305
14312
|
})();
|
|
14306
|
-
//# debugId=
|
|
14313
|
+
//# debugId=54a399b0-5fc6-4a0b-ac22-11952f37b9d5
|
|
14307
14314
|
//# sourceMappingURL=cli.js.map
|