renovate 44.100.0 → 44.101.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/modules/manager/bun/artifacts.js +25 -22
- package/dist/modules/manager/bun/artifacts.js.map +1 -1
- package/dist/modules/manager/deno/artifacts.js +38 -35
- package/dist/modules/manager/deno/artifacts.js.map +1 -1
- package/dist/modules/manager/devbox/artifacts.js +6 -6
- package/dist/modules/manager/devbox/artifacts.js.map +1 -1
- package/dist/modules/manager/fingerprint.generated.js +2 -2
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/npm/artifacts.js +20 -22
- package/dist/modules/manager/npm/artifacts.js.map +1 -1
- package/dist/modules/manager/npm/post-update/index.js +113 -116
- package/dist/modules/manager/npm/post-update/index.js.map +1 -1
- package/dist/modules/manager/npm/utils.js +15 -1
- package/dist/modules/manager/npm/utils.js.map +1 -1
- package/dist/modules/manager/types.d.ts +6 -2
- package/dist/modules/manager/util.js +9 -2
- package/dist/modules/manager/util.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../../../constants/error-messages.js";
|
|
2
2
|
import { GlobalConfig } from "../../../config/global.js";
|
|
3
3
|
import { logger } from "../../../logger/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { readLocalFile } from "../../../util/fs/index.js";
|
|
5
5
|
import { exec } from "../../../util/exec/index.js";
|
|
6
|
-
import { artifactErrorResult,
|
|
6
|
+
import { artifactErrorResult, resolveToolConstraint, updateLockFile } from "../util.js";
|
|
7
7
|
import { processHostRules } from "../npm/post-update/rules.js";
|
|
8
|
-
import {
|
|
8
|
+
import { withNpmrcHostRules } from "../npm/utils.js";
|
|
9
9
|
import { isEmptyArray } from "@sindresorhus/is";
|
|
10
10
|
import upath from "upath";
|
|
11
11
|
//#region lib/modules/manager/bun/artifacts.ts
|
|
@@ -28,27 +28,30 @@ async function updateArtifacts(updateArtifact) {
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
const pkgFileDir = upath.dirname(packageFileName);
|
|
31
|
-
const npmrcContent = await getNpmrcContent(pkgFileDir);
|
|
32
31
|
const { additionalNpmrcContent } = processHostRules();
|
|
33
|
-
await updateNpmrcContent(pkgFileDir, npmrcContent, additionalNpmrcContent);
|
|
34
32
|
try {
|
|
35
|
-
await
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
return await withNpmrcHostRules(pkgFileDir, additionalNpmrcContent, async () => {
|
|
34
|
+
let cmd = "bun install";
|
|
35
|
+
if (!GlobalConfig.get("allowScripts") || config.ignoreScripts) cmd += " --ignore-scripts";
|
|
36
|
+
const execOptions = {
|
|
37
|
+
cwdFile: lockFileName,
|
|
38
|
+
docker: {},
|
|
39
|
+
toolConstraints: [{
|
|
40
|
+
toolName: "bun",
|
|
41
|
+
constraint: await resolveToolConstraint(config, "bun")
|
|
42
|
+
}]
|
|
43
|
+
};
|
|
44
|
+
return await updateLockFile({
|
|
45
|
+
lockFileName,
|
|
46
|
+
existingLockFileContent: oldLockFileContent,
|
|
47
|
+
packageFile: {
|
|
48
|
+
path: packageFileName,
|
|
49
|
+
contents: newPackageFileContent
|
|
50
|
+
},
|
|
51
|
+
deleteLockFile: isLockFileMaintenance,
|
|
52
|
+
run: () => exec(cmd, execOptions)
|
|
53
|
+
});
|
|
54
|
+
});
|
|
52
55
|
} catch (err) {
|
|
53
56
|
if (err.message === "temporary-error") throw err;
|
|
54
57
|
logger.warn({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bun/artifacts.ts"],"sourcesContent":["import { isEmptyArray } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bun/artifacts.ts"],"sourcesContent":["import { isEmptyArray } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport { readLocalFile } from '../../../util/fs/index.ts';\nimport { processHostRules } from '../npm/post-update/rules.ts';\nimport { withNpmrcHostRules } from '../npm/utils.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n artifactErrorResult,\n resolveToolConstraint,\n updateLockFile,\n} from '../util.ts';\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n const { packageFileName, updatedDeps, newPackageFileContent, config } =\n updateArtifact;\n logger.debug(`bun.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (isEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated bun deps - returning null');\n return null;\n }\n\n // Find the first bun dependency in order to handle mixed manager updates,\n // eventually falling back to the first lock file from config.\n const lockFileName =\n updatedDeps.find((dep) => dep.manager === 'bun')?.lockFiles?.[0] ??\n config.lockFiles?.[0];\n\n if (!lockFileName) {\n logger.debug(`bun: No lock file found`);\n return null;\n }\n\n const oldLockFileContent = await readLocalFile(lockFileName);\n if (!oldLockFileContent) {\n logger.debug(`No ${lockFileName} found`);\n return null;\n }\n\n const pkgFileDir = upath.dirname(packageFileName);\n const { additionalNpmrcContent } = processHostRules();\n\n try {\n return await withNpmrcHostRules(\n pkgFileDir,\n additionalNpmrcContent,\n async () => {\n let cmd = 'bun install';\n\n if (!GlobalConfig.get('allowScripts') || config.ignoreScripts) {\n cmd += ' --ignore-scripts';\n }\n\n const execOptions: ExecOptions = {\n cwdFile: lockFileName,\n docker: {},\n toolConstraints: [\n {\n toolName: 'bun',\n constraint: await resolveToolConstraint(config, 'bun'),\n },\n ],\n };\n\n return await updateLockFile({\n lockFileName,\n existingLockFileContent: oldLockFileContent,\n packageFile: {\n path: packageFileName,\n contents: newPackageFileContent,\n },\n deleteLockFile: isLockFileMaintenance,\n run: () => exec(cmd, execOptions),\n });\n },\n );\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.warn({ lockfile: lockFileName, err }, `Failed to update lock file`);\n return artifactErrorResult(lockFileName, err);\n }\n}\n"],"mappings":";;;;;;;;;;;AAiBA,eAAsB,gBACpB,gBACyC;CACzC,MAAM,EAAE,iBAAiB,aAAa,uBAAuB,WAC3D;CACF,OAAO,MAAM,uBAAuB,gBAAgB,EAAE;CACtD,MAAM,EAAE,0BAA0B;CAElC,IAAI,aAAa,WAAW,KAAK,CAAC,uBAAuB;EACvD,OAAO,MAAM,sCAAsC;EACnD,OAAO;CACT;CAIA,MAAM,eACJ,YAAY,MAAM,QAAQ,IAAI,YAAY,KAAK,CAAC,EAAE,YAAY,MAC9D,OAAO,YAAY;CAErB,IAAI,CAAC,cAAc;EACjB,OAAO,MAAM,yBAAyB;EACtC,OAAO;CACT;CAEA,MAAM,qBAAqB,MAAM,cAAc,YAAY;CAC3D,IAAI,CAAC,oBAAoB;EACvB,OAAO,MAAM,MAAM,aAAa,OAAO;EACvC,OAAO;CACT;CAEA,MAAM,aAAa,MAAM,QAAQ,eAAe;CAChD,MAAM,EAAE,2BAA2B,iBAAiB;CAEpD,IAAI;EACF,OAAO,MAAM,mBACX,YACA,wBACA,YAAY;GACV,IAAI,MAAM;GAEV,IAAI,CAAC,aAAa,IAAI,cAAc,KAAK,OAAO,eAC9C,OAAO;GAGT,MAAM,cAA2B;IAC/B,SAAS;IACT,QAAQ,CAAC;IACT,iBAAiB,CACf;KACE,UAAU;KACV,YAAY,MAAM,sBAAsB,QAAQ,KAAK;IACvD,CACF;GACF;GAEA,OAAO,MAAM,eAAe;IAC1B;IACA,yBAAyB;IACzB,aAAa;KACX,MAAM;KACN,UAAU;IACZ;IACA,gBAAgB;IAChB,WAAW,KAAK,KAAK,WAAW;GAClC,CAAC;EACH,CACF;CACF,SAAS,KAAK;EACZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,OAAO,KAAK;GAAE,UAAU;GAAc;EAAI,GAAG,4BAA4B;EACzE,OAAO,oBAAoB,cAAc,GAAG;CAC9C;AACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../../../constants/error-messages.js";
|
|
2
2
|
import { logger } from "../../../logger/index.js";
|
|
3
3
|
import { findAll } from "../../../util/host-rules.js";
|
|
4
|
-
import {
|
|
4
|
+
import { readLocalFile } from "../../../util/fs/index.js";
|
|
5
5
|
import { exec } from "../../../util/exec/index.js";
|
|
6
|
-
import { artifactError, artifactErrorResult,
|
|
6
|
+
import { artifactError, artifactErrorResult, resolveToolConstraint, updateLockFile } from "../util.js";
|
|
7
7
|
import { processHostRules } from "../npm/post-update/rules.js";
|
|
8
|
-
import {
|
|
8
|
+
import { withNpmrcHostRules } from "../npm/utils.js";
|
|
9
9
|
import { isEmptyArray } from "@sindresorhus/is";
|
|
10
10
|
import { quote } from "shlex";
|
|
11
11
|
import upath from "upath";
|
|
@@ -13,7 +13,7 @@ import upath from "upath";
|
|
|
13
13
|
async function updateArtifacts(updateArtifact) {
|
|
14
14
|
const { packageFileName, updatedDeps, newPackageFileContent, config } = updateArtifact;
|
|
15
15
|
logger.debug(`deno.updateArtifacts(${packageFileName})`);
|
|
16
|
-
const isLockFileMaintenance = config
|
|
16
|
+
const { isLockFileMaintenance } = config;
|
|
17
17
|
if (isEmptyArray(updatedDeps) && !isLockFileMaintenance) {
|
|
18
18
|
logger.debug("No updated deno deps - returning null");
|
|
19
19
|
return null;
|
|
@@ -38,38 +38,41 @@ async function updateArtifacts(updateArtifact) {
|
|
|
38
38
|
}
|
|
39
39
|
const pkgFileDir = upath.dirname(packageFileName);
|
|
40
40
|
const { additionalNpmrcContent } = processHostRules();
|
|
41
|
-
const npmrcContent = await getNpmrcContent(pkgFileDir);
|
|
42
|
-
await updateNpmrcContent(pkgFileDir, npmrcContent, additionalNpmrcContent);
|
|
43
41
|
try {
|
|
44
|
-
await
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
return await withNpmrcHostRules(pkgFileDir, additionalNpmrcContent, async () => {
|
|
43
|
+
const execOptions = {
|
|
44
|
+
cwdFile: updatedDeps.find((dep) => dep.managerData?.importMapReferrer)?.managerData?.importMapReferrer ?? packageFileName,
|
|
45
|
+
docker: {},
|
|
46
|
+
toolConstraints: [{
|
|
47
|
+
toolName: "deno",
|
|
48
|
+
constraint: await resolveToolConstraint(config, "deno")
|
|
49
|
+
}]
|
|
50
|
+
};
|
|
51
|
+
let command = "deno install --frozen=false";
|
|
52
|
+
const defaultImportHosts = [
|
|
53
|
+
"deno.land:443",
|
|
54
|
+
"esm.sh:443",
|
|
55
|
+
"jsr.io:443",
|
|
56
|
+
"cdn.jsdelivr.net:443",
|
|
57
|
+
"raw.githubusercontent.com:443",
|
|
58
|
+
"gist.githubusercontent.com:443"
|
|
59
|
+
];
|
|
60
|
+
const additionalImportHosts = findAll({ hostType: "npm" }).filter((rule) => rule.resolvedHost).map((rule) => rule.resolvedHost);
|
|
61
|
+
if (additionalImportHosts.length > 0) {
|
|
62
|
+
const importHosts = [.../* @__PURE__ */ new Set([...defaultImportHosts, ...additionalImportHosts])].join(",");
|
|
63
|
+
command += ` --allow-import=${quote(importHosts)}`;
|
|
64
|
+
}
|
|
65
|
+
return await updateLockFile({
|
|
66
|
+
lockFileName,
|
|
67
|
+
existingLockFileContent: oldLockFileContent,
|
|
68
|
+
packageFile: {
|
|
69
|
+
path: packageFileName,
|
|
70
|
+
contents: newPackageFileContent
|
|
71
|
+
},
|
|
72
|
+
deleteLockFile: isLockFileMaintenance,
|
|
73
|
+
run: () => exec(command, execOptions)
|
|
74
|
+
});
|
|
75
|
+
});
|
|
73
76
|
} catch (err) {
|
|
74
77
|
if (err.message === "temporary-error") throw err;
|
|
75
78
|
logger.warn({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":["hostRules\n
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":["hostRules\n .findAll"],"sources":["../../../../lib/modules/manager/deno/artifacts.ts"],"sourcesContent":["import { isEmptyArray } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport upath from 'upath';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport { readLocalFile } from '../../../util/fs/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { processHostRules } from '../npm/post-update/rules.ts';\nimport { withNpmrcHostRules } from '../npm/utils.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n artifactError,\n artifactErrorResult,\n resolveToolConstraint,\n updateLockFile,\n} from '../util.ts';\nimport type { DenoManagerData } from './types.ts';\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact<DenoManagerData>,\n): Promise<UpdateArtifactsResult[] | null> {\n const { packageFileName, updatedDeps, newPackageFileContent, config } =\n updateArtifact;\n logger.debug(`deno.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (isEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated deno deps - returning null');\n return null;\n }\n\n // falling back for lockFileMaintenance\n const lockFileName = updatedDeps[0]?.lockFiles?.[0] ?? config.lockFiles?.[0];\n\n if (!lockFileName) {\n logger.debug('No lock file found. Skipping artifact update.');\n return null;\n }\n\n const oldLockFileContent = await readLocalFile(lockFileName);\n if (!oldLockFileContent) {\n logger.debug(`Failed to read ${lockFileName}. Skipping artifact update.`);\n return [artifactError(lockFileName, `Failed to read \"${lockFileName}\"`)];\n }\n\n for (const updateDep of updatedDeps) {\n if (\n updateDep.depType === 'tasks' ||\n updateDep.depType === 'tasks.command'\n ) {\n logger.warn(\n {\n depType: updateDep.depType,\n depName: updateDep.depName,\n lockFileName,\n },\n \"Dependency can't be updated with a lock file\",\n );\n return [\n artifactError(\n lockFileName,\n `depType: \"${updateDep.depType}\", depName: \"${updateDep.depName}\" can't be updated with a lock file: \"${lockFileName}\"`,\n ),\n ];\n }\n }\n\n const pkgFileDir = upath.dirname(packageFileName);\n const { additionalNpmrcContent } = processHostRules();\n\n try {\n return await withNpmrcHostRules(\n pkgFileDir,\n additionalNpmrcContent,\n async () => {\n // run from its referred deno.json/deno.jsonc location if import map is used\n const importMapReferrerDep = updatedDeps.find(\n (dep) => dep.managerData?.importMapReferrer,\n );\n const cwdFile =\n importMapReferrerDep?.managerData?.importMapReferrer ??\n packageFileName;\n\n const execOptions: ExecOptions = {\n cwdFile,\n docker: {},\n toolConstraints: [\n {\n toolName: 'deno',\n constraint: await resolveToolConstraint(config, 'deno'),\n },\n ],\n };\n\n // \"deno install\" don't execute lifecycle scripts of package.json by default\n // https://docs.deno.com/runtime/reference/cli/install/#native-node.js-addons\n // deno.json(c) could have the `lock.frozen` field\n // we should always override the `frozen` flag due to if it would be specified true\n let command = 'deno install --frozen=false';\n\n // defaults as per https://docs.deno.com/runtime/fundamentals/security/#importing-from-the-web\n const defaultImportHosts = [\n 'deno.land:443',\n 'esm.sh:443',\n 'jsr.io:443',\n 'cdn.jsdelivr.net:443',\n 'raw.githubusercontent.com:443',\n 'gist.githubusercontent.com:443',\n ];\n const additionalImportHosts = hostRules\n .findAll({ hostType: 'npm' })\n .filter((rule) => rule.resolvedHost)\n .map((rule) => rule.resolvedHost);\n\n if (additionalImportHosts.length > 0) {\n // combine default and additional import hosts, removing duplicates\n const importHosts = [\n ...new Set([...defaultImportHosts, ...additionalImportHosts]),\n ].join(',');\n\n command += ` --allow-import=${quote(importHosts)}`;\n }\n\n // TODO: appending `--lockfile-only` is better to reduce disk usage\n // https://docs.deno.com/runtime/reference/cli/install/#options-lockfile-only\n return await updateLockFile({\n lockFileName,\n existingLockFileContent: oldLockFileContent,\n packageFile: {\n path: packageFileName,\n contents: newPackageFileContent,\n },\n deleteLockFile: isLockFileMaintenance,\n run: () => exec(command, execOptions),\n });\n },\n );\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.warn({ lockfile: lockFileName, err }, `Failed to update lock file`);\n return artifactErrorResult(lockFileName, err);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,eAAsB,gBACpB,gBACyC;CACzC,MAAM,EAAE,iBAAiB,aAAa,uBAAuB,WAC3D;CACF,OAAO,MAAM,wBAAwB,gBAAgB,EAAE;CACvD,MAAM,EAAE,0BAA0B;CAElC,IAAI,aAAa,WAAW,KAAK,CAAC,uBAAuB;EACvD,OAAO,MAAM,uCAAuC;EACpD,OAAO;CACT;CAGA,MAAM,eAAe,YAAY,EAAE,EAAE,YAAY,MAAM,OAAO,YAAY;CAE1E,IAAI,CAAC,cAAc;EACjB,OAAO,MAAM,+CAA+C;EAC5D,OAAO;CACT;CAEA,MAAM,qBAAqB,MAAM,cAAc,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F;CACF,SAAS,KAAK;EACZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,OAAO,KAAK;GAAE,UAAU;GAAc;EAAI,GAAG,4BAA4B;EACzE,OAAO,oBAAoB,cAAc,GAAG;CAC9C;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger } from "../../../logger/index.js";
|
|
2
2
|
import { getSiblingFileName, readLocalFile } from "../../../util/fs/index.js";
|
|
3
3
|
import { exec } from "../../../util/exec/index.js";
|
|
4
|
-
import { artifactErrorResult,
|
|
4
|
+
import { artifactErrorResult, resolveToolConstraint, updateLockFile } from "../util.js";
|
|
5
5
|
import { isNonEmptyArray } from "@sindresorhus/is";
|
|
6
6
|
import { quote } from "shlex";
|
|
7
7
|
import semver from "semver";
|
|
@@ -47,11 +47,11 @@ async function updateArtifacts({ config, packageFileName, updatedDeps }) {
|
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
try {
|
|
50
|
-
await
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
return await updateLockFile({
|
|
51
|
+
lockFileName,
|
|
52
|
+
existingLockFileContent: oldLockFileContent,
|
|
53
|
+
run: () => exec(cmd, execOptions)
|
|
54
|
+
});
|
|
55
55
|
} catch (err) {
|
|
56
56
|
logger.warn({ err }, "Error updating devbox.lock");
|
|
57
57
|
return artifactErrorResult(lockFileName, err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/devbox/artifacts.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport semver from 'semver';\nimport { quote } from 'shlex';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport { getSiblingFileName, readLocalFile } from '../../../util/fs/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n artifactErrorResult,\n
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/devbox/artifacts.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport semver from 'semver';\nimport { quote } from 'shlex';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport { getSiblingFileName, readLocalFile } from '../../../util/fs/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n artifactErrorResult,\n resolveToolConstraint,\n updateLockFile,\n} from '../util.ts';\n\nexport async function updateArtifacts({\n config,\n packageFileName,\n updatedDeps,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n const lockFileName = getSiblingFileName(packageFileName, 'devbox.lock');\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug('No devbox.lock found');\n return null;\n }\n\n const nixConstraint = await resolveToolConstraint(config, 'nix');\n const devboxConstraint = await resolveToolConstraint(config, 'devbox');\n\n const supportsNoInstall = devboxConstraint\n ? semver.intersects(devboxConstraint, '>=0.14.0')\n : true;\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n toolConstraints: [\n // we are required to install nix because devbox spawns nix commands internally\n // https://github.com/renovatebot/renovate/discussions/35382\n // https://github.com/jetify-com/devbox/issues/2585\n {\n toolName: 'nix',\n constraint: nixConstraint,\n },\n {\n toolName: 'devbox',\n constraint: devboxConstraint,\n },\n ],\n docker: {},\n };\n\n const cmd: string[] = [];\n if (config.isLockFileMaintenance) {\n cmd.push(\n supportsNoInstall ? 'devbox update --no-install' : 'devbox update',\n );\n } else if (isNonEmptyArray(updatedDeps)) {\n if (supportsNoInstall) {\n const updateCommands: string[] = updatedDeps\n .map(\n (dep) =>\n dep.depName && `devbox update ${quote(dep.depName)} --no-install`,\n )\n .filter((dep): dep is string => Boolean(dep));\n if (updateCommands.length) {\n cmd.push(...updateCommands);\n } else {\n logger.trace('No updated devbox packages - returning null');\n return null;\n }\n } else {\n cmd.push('devbox install');\n }\n } else {\n logger.trace('No updated devbox packages - returning null');\n return null;\n }\n\n const oldLockFileContent = await readLocalFile(lockFileName);\n if (!oldLockFileContent) {\n logger.trace(`No ${lockFileName} found`);\n return null;\n }\n\n try {\n return await updateLockFile({\n lockFileName,\n existingLockFileContent: oldLockFileContent,\n run: () => exec(cmd, execOptions),\n });\n } catch (err) {\n logger.warn({ err }, 'Error updating devbox.lock');\n return artifactErrorResult(lockFileName, err);\n }\n}\n"],"mappings":";;;;;;;;AAcA,eAAsB,gBAAgB,EACpC,QACA,iBACA,eAC0D;CAC1D,MAAM,eAAe,mBAAmB,iBAAiB,aAAa;CAEtE,IAAI,CAAC,MADiC,cAAc,cAAc,MAAM,GAC1C;EAC5B,OAAO,MAAM,sBAAsB;EACnC,OAAO;CACT;CAEA,MAAM,gBAAgB,MAAM,sBAAsB,QAAQ,KAAK;CAC/D,MAAM,mBAAmB,MAAM,sBAAsB,QAAQ,QAAQ;CAErE,MAAM,oBAAoB,mBACtB,OAAO,WAAW,kBAAkB,UAAU,IAC9C;CAEJ,MAAM,cAA2B;EAC/B,SAAS;EACT,iBAAiB,CAIf;GACE,UAAU;GACV,YAAY;EACd,GACA;GACE,UAAU;GACV,YAAY;EACd,CACF;EACA,QAAQ,CAAC;CACX;CAEA,MAAM,MAAgB,CAAC;CACvB,IAAI,OAAO,uBACT,IAAI,KACF,oBAAoB,+BAA+B,eACrD;MACK,IAAI,gBAAgB,WAAW,GAAG;EACvC,IAAI,mBAAmB;GACrB,MAAM,iBAA2B,YAC9B,KACE,QACC,IAAI,WAAW,iBAAiB,MAAM,IAAI,OAAO,EAAE,cACvD,CAAC,CACA,QAAQ,QAAuB,QAAQ,GAAG,CAAC;GAC9C,IAAI,eAAe,QACjB,IAAI,KAAK,GAAG,cAAc;QACrB;IACL,OAAO,MAAM,6CAA6C;IAC1D,OAAO;GACT;EACF,OACE,IAAI,KAAK,gBAAgB;CAE7B,OAAO;EACL,OAAO,MAAM,6CAA6C;EAC1D,OAAO;CACT;CAEA,MAAM,qBAAqB,MAAM,cAAc,YAAY;CAC3D,IAAI,CAAC,oBAAoB;EACvB,OAAO,MAAM,MAAM,aAAa,OAAO;EACvC,OAAO;CACT;CAEA,IAAI;EACF,OAAO,MAAM,eAAe;GAC1B;GACA,yBAAyB;GACzB,WAAW,KAAK,KAAK,WAAW;EAClC,CAAC;CACH,SAAS,KAAK;EACZ,OAAO,KAAK,EAAE,IAAI,GAAG,4BAA4B;EACjD,OAAO,oBAAoB,cAAc,GAAG;CAC9C;AACF"}
|
|
@@ -17,7 +17,7 @@ hashMap.set("bitbucket-pipelines", "59c0503494ab1442b127914503c01b97ac17b6742b19
|
|
|
17
17
|
hashMap.set("bitrise", "478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42");
|
|
18
18
|
hashMap.set("buildkite", "b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c");
|
|
19
19
|
hashMap.set("buildpacks", "6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f");
|
|
20
|
-
hashMap.set("bun", "
|
|
20
|
+
hashMap.set("bun", "5820cfb6ebe018b8c336d481ea9ae319daaee6a2e368c45196fc8bc67cb3e755");
|
|
21
21
|
hashMap.set("bun-version", "df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4");
|
|
22
22
|
hashMap.set("bundler", "6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5");
|
|
23
23
|
hashMap.set("cake", "9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad");
|
|
@@ -32,7 +32,7 @@ hashMap.set("copier", "10ae4d7f8ff35faf3a3f9f25bf4c969ea960e19aaf8c012aee11f93f4
|
|
|
32
32
|
hashMap.set("cpanfile", "07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3");
|
|
33
33
|
hashMap.set("crossplane", "5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40");
|
|
34
34
|
hashMap.set("crow", "eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0");
|
|
35
|
-
hashMap.set("deno", "
|
|
35
|
+
hashMap.set("deno", "05e7ab60494a20a5e7477f06a9e723e443d37643b6e1d9ba8d3d87126a051175");
|
|
36
36
|
hashMap.set("deps-edn", "06783dbc8b9c7bb84e162d1f75b7db56dfa021cc6f809dfd2314cee8b64af08d");
|
|
37
37
|
hashMap.set("devbox", "a40050cc61bd9b5d500ec111abb17bb15d5f82ab5b7699f66f628307ba8382c9");
|
|
38
38
|
hashMap.set("devcontainer", "24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.generated.js","names":[],"sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"sourcesContent":["export const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','a52394a36ac5517f7330473c31d93aa05b2ce607c5e951b48f25a4693cd20a81');\nhashMap.set('ansible-galaxy','0a264d6be73953d801510fdeff271e4071c274339569c6dab4e2a128eaf4869f');\nhashMap.set('ant','2df5943cf0ed19a21b94df13729dbb925655548130caf37e3e22bebaed518e17');\nhashMap.set('apm','bdb6931cc03f4ac02ebfdb56c4b3483bb6c5250fa952545f1a25584d502bbffd');\nhashMap.set('argocd','cff9cd22257bc460ae4b9936570bf0ed5585f280a55d26629deaeeb0bfee8eb5');\nhashMap.set('asdf','430eb99b58171700c8a59c78b9e648575e9b176b781d90dd10a710f7b69015bb');\nhashMap.set('azure-pipelines','a051fe5e7e4fef8208b5864131a2b52b4ae319936f1dd8ee5a4e1ef11359ec09');\nhashMap.set('batect','375d39b432013bedb1330cf40a2199dd822751b28578214f219e7bab98594b8d');\nhashMap.set('batect-wrapper','d999355511ea7f4053325a18b8cfc8d2b586c61e6760c35e557d383a673e3939');\nhashMap.set('bazel','c31bc0a0e23d32726bcc09aa67533ebc5058124bf89c88e09c837419f550801a');\nhashMap.set('bazel-module','9fbba0339f9f7785d52ab85c5f0f6385003093c063483c13feccba13ae438bef');\nhashMap.set('bazelisk','770f75a746dc6ba90c518788d5987d7df4243ef9eee122d1bb0556a93d6e1b11');\nhashMap.set('bicep','7246e0bfc06e0e28cbb03ac088c5591f648956b086e106aeb251fe5d628329db');\nhashMap.set('bitbucket-pipelines','59c0503494ab1442b127914503c01b97ac17b6742b19c632292d5aa24de115cd');\nhashMap.set('bitrise','478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42');\nhashMap.set('buildkite','b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c');\nhashMap.set('buildpacks','6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f');\nhashMap.set('bun','8ec4c3c8080a55e93b741cfa97779b47291734dc24d80529c887d3b2b823fc44');\nhashMap.set('bun-version','df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4');\nhashMap.set('bundler','6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5');\nhashMap.set('cake','9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad');\nhashMap.set('cargo','fe8136135c895dd08819f91a60cf105f8b951251b057092700101ace991ae1d7');\nhashMap.set('cdnurl','9a81c8e3c6ad6c788498c99fc1067ffdfcd92a427c3afaf8c0130975d83131f2');\nhashMap.set('circleci','91cbeb33ea20f9838e2c81a1195eb806f0b38fa282bc3679f62552f20575ca85');\nhashMap.set('cloudbuild','f4e40388944652c8a19f8518771ac8d3f3c4ccf81ddef0e68b463aca833cb73c');\nhashMap.set('cocoapods','f832e2beef885bb3fd697ed9bb3e8cd742926bfec37ff41212edd2dbb4edb3ba');\nhashMap.set('composer','f1294fb3866ff65a75d98fdef80b1df3d3a8856535b8c690d1799e1205e4b639');\nhashMap.set('conan','8d46e9a30ae628e26118aea10a98d1b846f7c5d96d51ce24693437d555f6d125');\nhashMap.set('copier','10ae4d7f8ff35faf3a3f9f25bf4c969ea960e19aaf8c012aee11f93f4d10533e');\nhashMap.set('cpanfile','07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3');\nhashMap.set('crossplane','5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40');\nhashMap.set('crow','eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0');\nhashMap.set('deno','917fdbfbad58fd7f57933646a760d91768368df563ce5eaf34a2bba165164a12');\nhashMap.set('deps-edn','06783dbc8b9c7bb84e162d1f75b7db56dfa021cc6f809dfd2314cee8b64af08d');\nhashMap.set('devbox','a40050cc61bd9b5d500ec111abb17bb15d5f82ab5b7699f66f628307ba8382c9');\nhashMap.set('devcontainer','24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec');\nhashMap.set('docker-compose','fba87b82cb0f2bfd66526631fbe928b8153e7ca701a5790d02b944df17417bb9');\nhashMap.set('dockerfile','78cb1e8b58653289dd4b73425c45495a4c4b41badd3614b8345aaf8ab73de09c');\nhashMap.set('droneci','661d2a2d7295af8dd7a1234c7090c42a89306bd574c3adf1fc67782efaad3998');\nhashMap.set('fleet','4942d52e82f35c41e2d46cf76f426e2d91b350338cfc0bbcb97e8aaae2a1ac0b');\nhashMap.set('flux','aad8c786c4a2b5820663027452eeb8fe84c3af8c8399261e85f0eade2e484fe8');\nhashMap.set('fvm','9b161df0f14bc6e536368952adf373e343630097121a913cea60ee284027fb90');\nhashMap.set('git-submodules','df8bb92b2906d8cddda2d4b302ee503f8002e3554d32d74cef2f584fe891f38f');\nhashMap.set('github-actions','7adddc8e590786084855ffe53292bff3098ac672f91c21cc39d45bcf0af2271f');\nhashMap.set('gitlabci','a5e1e66ef461e1c1e71062f85f35a212417e23627f4b002810f9a98295d6e672');\nhashMap.set('gitlabci-include','8860a15ab516fde00694f9bd9bf56fce4addafe5a55b5ddb9a4ec477d301d351');\nhashMap.set('glasskube','93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30');\nhashMap.set('gleam','5e9b9f5f914afe5ed7b526c06c65111e3716d2dea9b0cbe7907bbc96db1064a3');\nhashMap.set('gomod','de042f3b5a900346c5f2df41f793f1716dc12145c38705c3064c6a7150b49495');\nhashMap.set('gradle','9e3ff52ce4ad2555929acdd4d32c417c4ef8714c23a92f2893ecc580fa4d6064');\nhashMap.set('gradle-wrapper','73ba30c34955fab7737454b5cff9aca6d1b5607d53c17c9e13d8ad96f6eaae87');\nhashMap.set('haskell-cabal','f158b7725e3143dfd2950e3de0bbccc2a61cd7eba87f7a54c5057e01252348e2');\nhashMap.set('helm-requirements','7ee9dace4c036dfe113c0c0e46369d8b83a739caa831660142ca98d3236a180a');\nhashMap.set('helm-values','0aa79bb0257d0d72e54dfd2653e59bfef63b97e46c035b7443593bdf6e6382aa');\nhashMap.set('helmfile','28572dd24b6746ca7065ee467aa13bbc8c3e8c0f88ae48e33bce88468c600100');\nhashMap.set('helmsman','951deeb3355da751ef39c9e932b26ea749450e32e75759e4b5fc29359e100b37');\nhashMap.set('helmv3','4a3cf47072978eb131d70cd13f3d0bbd4408b0290be2a798a4cbf6103189269b');\nhashMap.set('hermit','0fb25b7766c3a264fbb765ff75b1542b24136c4c9f933696d4a5aecfed637071');\nhashMap.set('homeassistant-manifest','05043c6db870cffbb6f8f3e351c025e3de227eaae0b24134b796aec46f84b65f');\nhashMap.set('homebrew','dffe954a4e18c2dc4bfdaa12222fe8ddc3395869afd5afa603fc2b6264747984');\nhashMap.set('html','81fa6c2bf2b868596584a48b949645207a2aa3081951ed99183ee50b70b77d5f');\nhashMap.set('jenkins','7fda0e7e0f3d5e18088ccb3594f727f4cfc48b064706bdaaf1a0a075b6a2cff5');\nhashMap.set('jsonnet-bundler','4cedeb0394e5c38361d1868ff45b4f34747ab8c492378b6e63dcaf1f4f3c024d');\nhashMap.set('kotlin-script','95ebc844c040ca047321b207d525220e29774a2a1fe06f9639e8353c66908564');\nhashMap.set('kubernetes','321e7d77fb3600dd4c00a86eaa1294927e7f92300b74fa2977d813dcaa3bb4de');\nhashMap.set('kustomize','aa830c27302555e12d7f04e342c96125d68c231028a2d3c459c4431516382584');\nhashMap.set('leiningen','c8397e376f1717c2f771ae9ea3ba6b720d2422b133cf937e762c44e42be146a2');\nhashMap.set('maven','c110b99291c2a5bc82cf7a69330275e9bbd7dc8ba3e9e987611dfcffbe002d8d');\nhashMap.set('maven-wrapper','6e53b6e4abf1d20b75094c7a70d66b4a5ac39954f009aa401f5e55dada8be4d0');\nhashMap.set('meteor','4636a47ba4dcfff19fe662572ef7a40d17146be3c966e00ef437e1fc8de92776');\nhashMap.set('mint','248fe4f1ea5c985921c286785792c97e06fc41f402b2d45df82f6aecd17f710e');\nhashMap.set('mise','279da4690751c3abee10badd12eb4ac6ef31d824c6bd3ada824859eca3109ebe');\nhashMap.set('mix','0f79163dc2a1c896599d152be635c23beaf16812ae3d8fbfffec98c7bd0de872');\nhashMap.set('nix','0f80f0b81f2197a7e588be5c115a32a826fc184593f4e879f7b60fafd97a977e');\nhashMap.set('nodenv','ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8');\nhashMap.set('npm','30c78bc1c29eeecbdedb4eacc52bd93eedfb07279fd385f893193dcac6196466');\nhashMap.set('nuget','b81fb0ca6cfeb86b004592b38ce176673e056d6a2ed41a9807afb0eb7ad405d2');\nhashMap.set('nvm','3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322');\nhashMap.set('ocb','032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca');\nhashMap.set('osgi','d6567a733ef3983112b46fdccd7ceebfcd48411104e0c6b6e714d4310db48024');\nhashMap.set('pep621','52450676f8b0e05134b3e8947b832195ef40bcaec1ce43d71351a2f797b80d75');\nhashMap.set('pep723','77022a0eae6a3cbb74a1e6d596db1276e379768e40448192b3fa81edd14ca73f');\nhashMap.set('pip-compile','7e418b8bdaeed38c1372eb19e0ae1c64999000e128d8754e37368638037b4c5c');\nhashMap.set('pip_requirements','bf3a407f72abf711230247bef94ba5dc84c08a35107b0f017912fad66afa716a');\nhashMap.set('pip_setup','df18fba2bdcf48f3ca12a8f7e5cd28df31e2368d5528127277038ef4206eca79');\nhashMap.set('pipenv','cd974eadd649ba8c9c2e3c7b564a49c8bb2ce95d6df043a7e942364f574c7613');\nhashMap.set('pixi','e31c397982ffa34222b061f23f3b3683f42523dd5dca45ecce2448b0ebc55ea2');\nhashMap.set('poetry','b2b917c200d25e01a3a198deb3bf33353535f27430142111cfab816c03bb966d');\nhashMap.set('pre-commit','760f2c291ae084db889f722390798a0e2d431ccdc3bc676e73b14901ebea19ac');\nhashMap.set('proto','412053d4550026b4ace490b46e970915b87ec1abf0b0a0c6c8c58ccf1fc16843');\nhashMap.set('pub','8e7c65dfd1999de4f7c44392e949a4d8f4701eb86df59d550e4657feb06b1872');\nhashMap.set('puppet','ba58ab689e44acc8f61c3569ab8b40fde01b8a9d3aad712708e2a419e57d8b45');\nhashMap.set('pyenv','9ede8becc97774f9040b40f4472d3e933534b596e04c360bfe0f3c6f95f25182');\nhashMap.set('quadlet','e1fc88a4e14cd595e89bb3d79b4adf2add3ce5eb80f75276e712c32598cca53d');\nhashMap.set('renovate-config','dfaf3f03ddaf70c332f7916106648f36dbfa6a36dd76d15dd27fa116ab3c174c');\nhashMap.set('ruby-version','2db2140d9eee8c555e729a4de0396fa2d78846d3149890ee12fa515bd654be97');\nhashMap.set('runtime-version','b582b168c0cc595e39010feb10f4b97a82683eb269e9598216fbb11cc186e160');\nhashMap.set('rust-toolchain','6ace53db02874d73620d2d872291839820a512a9529c42d174358c692e5db720');\nhashMap.set('sbt','e1eb5c7f0171a9bb1b6bd4a36a91039a31b6c84e0983d91d930be31a69506d9e');\nhashMap.set('scalafmt','9d36159b56835e96498af026a1fb0543200db0581681ef95ec54988f411e180f');\nhashMap.set('setup-cfg','4a3a7c812d34739c07685691e7e64c7d3127f9d7d4aff99dc45a25df97ed9745');\nhashMap.set('smithy','9641b91d065ffb63be0dd888139a0402dba41e550f8b44c592db9daf52109100');\nhashMap.set('sveltos','60dd75bb53ace31217211100d622fdb65068c6162758b6ae7103a6ce8bdc9f90');\nhashMap.set('swift','6932c904b0d18ad4845c46ce3f7d4c54dd8e411e16c31a782b399fe0b7dc550b');\nhashMap.set('tekton','33948f5bdf7553909fa63744adb26da97ddf366e9499bccab1250879570267c9');\nhashMap.set('terraform','5b0037e4a88e06efe6f006eff15c24d9e1fefdda40d282aa99f54c2637d21c4d');\nhashMap.set('terraform-version','ec8f786b9731d47f2c2fe0307caf64d7ddd83046fe7ff1f7d8423239f8b0f2aa');\nhashMap.set('terragrunt','300f8fb3c09667654412d2f5dd8ab4882e0f5d1d7a8bc39794993d2e7e58d1b7');\nhashMap.set('terragrunt-version','eea6087b33717d22ede2fc68c2f64df8390b75abe82110ed831a180648feb51d');\nhashMap.set('tflint-plugin','f423bfa2b42a2bfc0e38a33ebd4f9d452473e7ed4e7ad6384a99eb9a35d97479');\nhashMap.set('travis','f3e2f38e699c390b00ff481be5e91dceaa81609e93caf9a4214933de759c84fc');\nhashMap.set('typst','d080a79fbd961c6e21fcc505d544b7e0ff2126142acb1dcabdf6abbcd9339248');\nhashMap.set('unity3d','f13e25e115e3443f4e16cf31578acffa78fb1a5e23339680a92d8d6de6052920');\nhashMap.set('velaci','fda00ddb7cc23e9a37e0a8a253151df0a6930b4276d3e4f78cc54b9ac09af7de');\nhashMap.set('vendir','7db907b3b77ef5f3465f3c4339fbab56bbcdfd1bf34b3d33e4c178d2e07e23e7');\nhashMap.set('woodpecker','6110d3bec33aaeb3511d4bbfa896cec3c8e02fb04a6cff50c9ba81061c851045');\nhashMap.set('xcodegen','dad511d88a9ce1dbdde8b9731f3da7f2bdaa4ca8a083294ee58d56da62ab1683');\nhashMap.set('jsonata','416b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,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,qBAAoB,kEAAkE;AAClG,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,sBAAqB,kEAAkE;AACnG,QAAQ,IAAI,iBAAgB,kEAAkE;AAC9F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE"}
|
|
1
|
+
{"version":3,"file":"fingerprint.generated.js","names":[],"sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"sourcesContent":["export const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','a52394a36ac5517f7330473c31d93aa05b2ce607c5e951b48f25a4693cd20a81');\nhashMap.set('ansible-galaxy','0a264d6be73953d801510fdeff271e4071c274339569c6dab4e2a128eaf4869f');\nhashMap.set('ant','2df5943cf0ed19a21b94df13729dbb925655548130caf37e3e22bebaed518e17');\nhashMap.set('apm','bdb6931cc03f4ac02ebfdb56c4b3483bb6c5250fa952545f1a25584d502bbffd');\nhashMap.set('argocd','cff9cd22257bc460ae4b9936570bf0ed5585f280a55d26629deaeeb0bfee8eb5');\nhashMap.set('asdf','430eb99b58171700c8a59c78b9e648575e9b176b781d90dd10a710f7b69015bb');\nhashMap.set('azure-pipelines','a051fe5e7e4fef8208b5864131a2b52b4ae319936f1dd8ee5a4e1ef11359ec09');\nhashMap.set('batect','375d39b432013bedb1330cf40a2199dd822751b28578214f219e7bab98594b8d');\nhashMap.set('batect-wrapper','d999355511ea7f4053325a18b8cfc8d2b586c61e6760c35e557d383a673e3939');\nhashMap.set('bazel','c31bc0a0e23d32726bcc09aa67533ebc5058124bf89c88e09c837419f550801a');\nhashMap.set('bazel-module','9fbba0339f9f7785d52ab85c5f0f6385003093c063483c13feccba13ae438bef');\nhashMap.set('bazelisk','770f75a746dc6ba90c518788d5987d7df4243ef9eee122d1bb0556a93d6e1b11');\nhashMap.set('bicep','7246e0bfc06e0e28cbb03ac088c5591f648956b086e106aeb251fe5d628329db');\nhashMap.set('bitbucket-pipelines','59c0503494ab1442b127914503c01b97ac17b6742b19c632292d5aa24de115cd');\nhashMap.set('bitrise','478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42');\nhashMap.set('buildkite','b8b404f53cd5d61c39153fddf93945e621471c4ac6aa9960c881cd868922bb4c');\nhashMap.set('buildpacks','6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f');\nhashMap.set('bun','5820cfb6ebe018b8c336d481ea9ae319daaee6a2e368c45196fc8bc67cb3e755');\nhashMap.set('bun-version','df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4');\nhashMap.set('bundler','6e4784dd98c1f86ef64cc8cbf3128df48aebf920032d7792b54fdedd3dd9d4d5');\nhashMap.set('cake','9ebd8b481220b30a8860121d26184540a1a2fcc05ef780df9295dea39b386fad');\nhashMap.set('cargo','fe8136135c895dd08819f91a60cf105f8b951251b057092700101ace991ae1d7');\nhashMap.set('cdnurl','9a81c8e3c6ad6c788498c99fc1067ffdfcd92a427c3afaf8c0130975d83131f2');\nhashMap.set('circleci','91cbeb33ea20f9838e2c81a1195eb806f0b38fa282bc3679f62552f20575ca85');\nhashMap.set('cloudbuild','f4e40388944652c8a19f8518771ac8d3f3c4ccf81ddef0e68b463aca833cb73c');\nhashMap.set('cocoapods','f832e2beef885bb3fd697ed9bb3e8cd742926bfec37ff41212edd2dbb4edb3ba');\nhashMap.set('composer','f1294fb3866ff65a75d98fdef80b1df3d3a8856535b8c690d1799e1205e4b639');\nhashMap.set('conan','8d46e9a30ae628e26118aea10a98d1b846f7c5d96d51ce24693437d555f6d125');\nhashMap.set('copier','10ae4d7f8ff35faf3a3f9f25bf4c969ea960e19aaf8c012aee11f93f4d10533e');\nhashMap.set('cpanfile','07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3');\nhashMap.set('crossplane','5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40');\nhashMap.set('crow','eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0');\nhashMap.set('deno','05e7ab60494a20a5e7477f06a9e723e443d37643b6e1d9ba8d3d87126a051175');\nhashMap.set('deps-edn','06783dbc8b9c7bb84e162d1f75b7db56dfa021cc6f809dfd2314cee8b64af08d');\nhashMap.set('devbox','a40050cc61bd9b5d500ec111abb17bb15d5f82ab5b7699f66f628307ba8382c9');\nhashMap.set('devcontainer','24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec');\nhashMap.set('docker-compose','fba87b82cb0f2bfd66526631fbe928b8153e7ca701a5790d02b944df17417bb9');\nhashMap.set('dockerfile','78cb1e8b58653289dd4b73425c45495a4c4b41badd3614b8345aaf8ab73de09c');\nhashMap.set('droneci','661d2a2d7295af8dd7a1234c7090c42a89306bd574c3adf1fc67782efaad3998');\nhashMap.set('fleet','4942d52e82f35c41e2d46cf76f426e2d91b350338cfc0bbcb97e8aaae2a1ac0b');\nhashMap.set('flux','aad8c786c4a2b5820663027452eeb8fe84c3af8c8399261e85f0eade2e484fe8');\nhashMap.set('fvm','9b161df0f14bc6e536368952adf373e343630097121a913cea60ee284027fb90');\nhashMap.set('git-submodules','df8bb92b2906d8cddda2d4b302ee503f8002e3554d32d74cef2f584fe891f38f');\nhashMap.set('github-actions','7adddc8e590786084855ffe53292bff3098ac672f91c21cc39d45bcf0af2271f');\nhashMap.set('gitlabci','a5e1e66ef461e1c1e71062f85f35a212417e23627f4b002810f9a98295d6e672');\nhashMap.set('gitlabci-include','8860a15ab516fde00694f9bd9bf56fce4addafe5a55b5ddb9a4ec477d301d351');\nhashMap.set('glasskube','93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30');\nhashMap.set('gleam','5e9b9f5f914afe5ed7b526c06c65111e3716d2dea9b0cbe7907bbc96db1064a3');\nhashMap.set('gomod','de042f3b5a900346c5f2df41f793f1716dc12145c38705c3064c6a7150b49495');\nhashMap.set('gradle','9e3ff52ce4ad2555929acdd4d32c417c4ef8714c23a92f2893ecc580fa4d6064');\nhashMap.set('gradle-wrapper','73ba30c34955fab7737454b5cff9aca6d1b5607d53c17c9e13d8ad96f6eaae87');\nhashMap.set('haskell-cabal','f158b7725e3143dfd2950e3de0bbccc2a61cd7eba87f7a54c5057e01252348e2');\nhashMap.set('helm-requirements','7ee9dace4c036dfe113c0c0e46369d8b83a739caa831660142ca98d3236a180a');\nhashMap.set('helm-values','0aa79bb0257d0d72e54dfd2653e59bfef63b97e46c035b7443593bdf6e6382aa');\nhashMap.set('helmfile','28572dd24b6746ca7065ee467aa13bbc8c3e8c0f88ae48e33bce88468c600100');\nhashMap.set('helmsman','951deeb3355da751ef39c9e932b26ea749450e32e75759e4b5fc29359e100b37');\nhashMap.set('helmv3','4a3cf47072978eb131d70cd13f3d0bbd4408b0290be2a798a4cbf6103189269b');\nhashMap.set('hermit','0fb25b7766c3a264fbb765ff75b1542b24136c4c9f933696d4a5aecfed637071');\nhashMap.set('homeassistant-manifest','05043c6db870cffbb6f8f3e351c025e3de227eaae0b24134b796aec46f84b65f');\nhashMap.set('homebrew','dffe954a4e18c2dc4bfdaa12222fe8ddc3395869afd5afa603fc2b6264747984');\nhashMap.set('html','81fa6c2bf2b868596584a48b949645207a2aa3081951ed99183ee50b70b77d5f');\nhashMap.set('jenkins','7fda0e7e0f3d5e18088ccb3594f727f4cfc48b064706bdaaf1a0a075b6a2cff5');\nhashMap.set('jsonnet-bundler','4cedeb0394e5c38361d1868ff45b4f34747ab8c492378b6e63dcaf1f4f3c024d');\nhashMap.set('kotlin-script','95ebc844c040ca047321b207d525220e29774a2a1fe06f9639e8353c66908564');\nhashMap.set('kubernetes','321e7d77fb3600dd4c00a86eaa1294927e7f92300b74fa2977d813dcaa3bb4de');\nhashMap.set('kustomize','aa830c27302555e12d7f04e342c96125d68c231028a2d3c459c4431516382584');\nhashMap.set('leiningen','c8397e376f1717c2f771ae9ea3ba6b720d2422b133cf937e762c44e42be146a2');\nhashMap.set('maven','c110b99291c2a5bc82cf7a69330275e9bbd7dc8ba3e9e987611dfcffbe002d8d');\nhashMap.set('maven-wrapper','6e53b6e4abf1d20b75094c7a70d66b4a5ac39954f009aa401f5e55dada8be4d0');\nhashMap.set('meteor','4636a47ba4dcfff19fe662572ef7a40d17146be3c966e00ef437e1fc8de92776');\nhashMap.set('mint','248fe4f1ea5c985921c286785792c97e06fc41f402b2d45df82f6aecd17f710e');\nhashMap.set('mise','279da4690751c3abee10badd12eb4ac6ef31d824c6bd3ada824859eca3109ebe');\nhashMap.set('mix','0f79163dc2a1c896599d152be635c23beaf16812ae3d8fbfffec98c7bd0de872');\nhashMap.set('nix','0f80f0b81f2197a7e588be5c115a32a826fc184593f4e879f7b60fafd97a977e');\nhashMap.set('nodenv','ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8');\nhashMap.set('npm','30c78bc1c29eeecbdedb4eacc52bd93eedfb07279fd385f893193dcac6196466');\nhashMap.set('nuget','b81fb0ca6cfeb86b004592b38ce176673e056d6a2ed41a9807afb0eb7ad405d2');\nhashMap.set('nvm','3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322');\nhashMap.set('ocb','032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca');\nhashMap.set('osgi','d6567a733ef3983112b46fdccd7ceebfcd48411104e0c6b6e714d4310db48024');\nhashMap.set('pep621','52450676f8b0e05134b3e8947b832195ef40bcaec1ce43d71351a2f797b80d75');\nhashMap.set('pep723','77022a0eae6a3cbb74a1e6d596db1276e379768e40448192b3fa81edd14ca73f');\nhashMap.set('pip-compile','7e418b8bdaeed38c1372eb19e0ae1c64999000e128d8754e37368638037b4c5c');\nhashMap.set('pip_requirements','bf3a407f72abf711230247bef94ba5dc84c08a35107b0f017912fad66afa716a');\nhashMap.set('pip_setup','df18fba2bdcf48f3ca12a8f7e5cd28df31e2368d5528127277038ef4206eca79');\nhashMap.set('pipenv','cd974eadd649ba8c9c2e3c7b564a49c8bb2ce95d6df043a7e942364f574c7613');\nhashMap.set('pixi','e31c397982ffa34222b061f23f3b3683f42523dd5dca45ecce2448b0ebc55ea2');\nhashMap.set('poetry','b2b917c200d25e01a3a198deb3bf33353535f27430142111cfab816c03bb966d');\nhashMap.set('pre-commit','760f2c291ae084db889f722390798a0e2d431ccdc3bc676e73b14901ebea19ac');\nhashMap.set('proto','412053d4550026b4ace490b46e970915b87ec1abf0b0a0c6c8c58ccf1fc16843');\nhashMap.set('pub','8e7c65dfd1999de4f7c44392e949a4d8f4701eb86df59d550e4657feb06b1872');\nhashMap.set('puppet','ba58ab689e44acc8f61c3569ab8b40fde01b8a9d3aad712708e2a419e57d8b45');\nhashMap.set('pyenv','9ede8becc97774f9040b40f4472d3e933534b596e04c360bfe0f3c6f95f25182');\nhashMap.set('quadlet','e1fc88a4e14cd595e89bb3d79b4adf2add3ce5eb80f75276e712c32598cca53d');\nhashMap.set('renovate-config','dfaf3f03ddaf70c332f7916106648f36dbfa6a36dd76d15dd27fa116ab3c174c');\nhashMap.set('ruby-version','2db2140d9eee8c555e729a4de0396fa2d78846d3149890ee12fa515bd654be97');\nhashMap.set('runtime-version','b582b168c0cc595e39010feb10f4b97a82683eb269e9598216fbb11cc186e160');\nhashMap.set('rust-toolchain','6ace53db02874d73620d2d872291839820a512a9529c42d174358c692e5db720');\nhashMap.set('sbt','e1eb5c7f0171a9bb1b6bd4a36a91039a31b6c84e0983d91d930be31a69506d9e');\nhashMap.set('scalafmt','9d36159b56835e96498af026a1fb0543200db0581681ef95ec54988f411e180f');\nhashMap.set('setup-cfg','4a3a7c812d34739c07685691e7e64c7d3127f9d7d4aff99dc45a25df97ed9745');\nhashMap.set('smithy','9641b91d065ffb63be0dd888139a0402dba41e550f8b44c592db9daf52109100');\nhashMap.set('sveltos','60dd75bb53ace31217211100d622fdb65068c6162758b6ae7103a6ce8bdc9f90');\nhashMap.set('swift','6932c904b0d18ad4845c46ce3f7d4c54dd8e411e16c31a782b399fe0b7dc550b');\nhashMap.set('tekton','33948f5bdf7553909fa63744adb26da97ddf366e9499bccab1250879570267c9');\nhashMap.set('terraform','5b0037e4a88e06efe6f006eff15c24d9e1fefdda40d282aa99f54c2637d21c4d');\nhashMap.set('terraform-version','ec8f786b9731d47f2c2fe0307caf64d7ddd83046fe7ff1f7d8423239f8b0f2aa');\nhashMap.set('terragrunt','300f8fb3c09667654412d2f5dd8ab4882e0f5d1d7a8bc39794993d2e7e58d1b7');\nhashMap.set('terragrunt-version','eea6087b33717d22ede2fc68c2f64df8390b75abe82110ed831a180648feb51d');\nhashMap.set('tflint-plugin','f423bfa2b42a2bfc0e38a33ebd4f9d452473e7ed4e7ad6384a99eb9a35d97479');\nhashMap.set('travis','f3e2f38e699c390b00ff481be5e91dceaa81609e93caf9a4214933de759c84fc');\nhashMap.set('typst','d080a79fbd961c6e21fcc505d544b7e0ff2126142acb1dcabdf6abbcd9339248');\nhashMap.set('unity3d','f13e25e115e3443f4e16cf31578acffa78fb1a5e23339680a92d8d6de6052920');\nhashMap.set('velaci','fda00ddb7cc23e9a37e0a8a253151df0a6930b4276d3e4f78cc54b9ac09af7de');\nhashMap.set('vendir','7db907b3b77ef5f3465f3c4339fbab56bbcdfd1bf34b3d33e4c178d2e07e23e7');\nhashMap.set('woodpecker','6110d3bec33aaeb3511d4bbfa896cec3c8e02fb04a6cff50c9ba81061c851045');\nhashMap.set('xcodegen','dad511d88a9ce1dbdde8b9731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kEAAkE;AAC1F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,qBAAoB,kEAAkE;AAClG,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,sBAAqB,kEAAkE;AACnG,QAAQ,IAAI,iBAAgB,kEAAkE;AAC9F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE"}
|
|
@@ -8,7 +8,7 @@ import { resolveToolConstraint } from "../util.js";
|
|
|
8
8
|
import { PNPM_CACHE_DIR, PNPM_STORE_DIR } from "./constants.js";
|
|
9
9
|
import { getNodeToolConstraint } from "./post-update/node-version.js";
|
|
10
10
|
import { processHostRules } from "./post-update/rules.js";
|
|
11
|
-
import {
|
|
11
|
+
import { withNpmrcHostRules } from "./utils.js";
|
|
12
12
|
import { lazyLoadPackageJson } from "./post-update/utils.js";
|
|
13
13
|
import { isEmptyArray, isNonEmptyObject, isString } from "@sindresorhus/is";
|
|
14
14
|
import { isScalar, isSeq, parseDocument } from "yaml";
|
|
@@ -37,7 +37,6 @@ async function handlePackageManagerUpdates(updateArtifactsConfig) {
|
|
|
37
37
|
await writeLocalFile(packageFileName, existingPackageFileContent);
|
|
38
38
|
const pkgFileDir = upath.dirname(packageFileName);
|
|
39
39
|
const { additionalNpmrcContent } = processHostRules();
|
|
40
|
-
const npmrcContent = await getNpmrcContent(pkgFileDir);
|
|
41
40
|
const lazyPkgJson = lazyLoadPackageJson(pkgFileDir);
|
|
42
41
|
const cmd = `corepack use ${quote(`${depName}@${newVersion}`)}`;
|
|
43
42
|
const nodeConstraints = await getNodeToolConstraint(config, updatedDeps, pkgFileDir, lazyPkgJson);
|
|
@@ -57,26 +56,25 @@ async function handlePackageManagerUpdates(updateArtifactsConfig) {
|
|
|
57
56
|
}],
|
|
58
57
|
docker: {}
|
|
59
58
|
};
|
|
60
|
-
await
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
59
|
+
return await withNpmrcHostRules(pkgFileDir, additionalNpmrcContent, async () => {
|
|
60
|
+
try {
|
|
61
|
+
await exec(cmd, execOptions);
|
|
62
|
+
const newPackageFileContent = await readLocalFile(packageFileName, "utf8");
|
|
63
|
+
if (!newPackageFileContent || existingPackageFileContent === newPackageFileContent) return null;
|
|
64
|
+
logger.debug("Returning updated package.json");
|
|
65
|
+
return { file: {
|
|
66
|
+
type: "addition",
|
|
67
|
+
path: packageFileName,
|
|
68
|
+
contents: newPackageFileContent
|
|
69
|
+
} };
|
|
70
|
+
} catch (err) {
|
|
71
|
+
logger.warn({ err }, "Error updating package.json");
|
|
72
|
+
return { artifactError: {
|
|
73
|
+
fileName: packageFileName,
|
|
74
|
+
stderr: err.message
|
|
75
|
+
} };
|
|
76
|
+
}
|
|
77
|
+
});
|
|
80
78
|
}
|
|
81
79
|
/**
|
|
82
80
|
* Update the minimumReleaseAgeExclude setting in pnpm-workspace.yaml if needed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/npm/artifacts.ts"],"sourcesContent":["import { isEmptyArray, isNonEmptyObject, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport upath from 'upath';\nimport type { Scalar, YAMLSeq } from 'yaml';\nimport { isScalar, isSeq, parseDocument } from 'yaml';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n ensureCacheDir,\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { matchRegexOrGlob } from '../../../util/string-match.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { PNPM_CACHE_DIR, PNPM_STORE_DIR } from './constants.ts';\nimport { getNodeToolConstraint } from './post-update/node-version.ts';\nimport { processHostRules } from './post-update/rules.ts';\nimport { lazyLoadPackageJson } from './post-update/utils.ts';\nimport {\n getNpmrcContent,\n resetNpmrcContent,\n updateNpmrcContent,\n} from './utils.ts';\n\n// eg. 8.15.5+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589\nconst versionWithHashRegString = '^(?<version>.*)\\\\+(?<hash>.*)';\n\n// Execute 'corepack use' command for npm manager updates\n// This step is necessary because Corepack recommends attaching a hash after the version\n// The hash is generated only after running 'corepack use' and cannot be fetched from the npm registry\nexport async function updateArtifacts(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`npm.updateArtifacts(${updateArtifactsConfig.packageFileName})`);\n let res: UpdateArtifactsResult[] = [];\n res.push(\n coerceObject(await handlePackageManagerUpdates(updateArtifactsConfig)),\n );\n res.push(coerceObject(await updatePnpmWorkspace(updateArtifactsConfig)));\n\n res = res.filter(isNonEmptyObject);\n if (res.length === 0) {\n return null;\n }\n\n return res;\n}\n\nasync function handlePackageManagerUpdates(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const {\n packageFileName,\n config,\n updatedDeps,\n newPackageFileContent: existingPackageFileContent,\n } = updateArtifactsConfig;\n const packageManagerUpdate = updatedDeps.find(\n (dep) => dep.depType === 'packageManager',\n );\n\n if (!packageManagerUpdate) {\n logger.debug('No packageManager updates - returning null');\n return null;\n }\n\n const { currentValue, depName, newVersion } = packageManagerUpdate;\n\n // Execute 'corepack use' command only if the currentValue already has hash in it\n if (!currentValue || !regEx(versionWithHashRegString).test(currentValue)) {\n return null;\n }\n\n // write old updates before executing corepack update so that they are not removed from package file\n await writeLocalFile(packageFileName, existingPackageFileContent);\n\n // Asumming that corepack only needs to modify the package.json file in the root folder\n // As it should not be regular practice to have different package managers in different workspaces\n const pkgFileDir = upath.dirname(packageFileName);\n const { additionalNpmrcContent } = processHostRules();\n const npmrcContent = await getNpmrcContent(pkgFileDir);\n const lazyPkgJson = lazyLoadPackageJson(pkgFileDir);\n const cmd = `corepack use ${quote(`${depName}@${newVersion}`)}`;\n\n const nodeConstraints = await getNodeToolConstraint(\n config,\n updatedDeps,\n pkgFileDir,\n lazyPkgJson,\n );\n\n const pnpmConfigCacheDir = await ensureCacheDir(PNPM_CACHE_DIR);\n const pnpmConfigStoreDir = await ensureCacheDir(PNPM_STORE_DIR);\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n // To make sure pnpm store location is consistent between \"corepack use\"\n // here and the pnpm commands in ./post-update/pnpm.ts. Check\n // ./post-update/pnpm.ts for more details.\n npm_config_cache_dir: pnpmConfigCacheDir,\n npm_config_store_dir: pnpmConfigStoreDir,\n pnpm_config_cache_dir: pnpmConfigCacheDir,\n pnpm_config_store_dir: pnpmConfigStoreDir,\n },\n toolConstraints: [\n nodeConstraints,\n {\n toolName: 'corepack',\n constraint: await resolveToolConstraint(config, 'corepack'),\n },\n ],\n docker: {},\n };\n\n await updateNpmrcContent(pkgFileDir, npmrcContent, additionalNpmrcContent);\n try {\n await exec(cmd, execOptions);\n await resetNpmrcContent(pkgFileDir, npmrcContent);\n const newPackageFileContent = await readLocalFile(packageFileName, 'utf8');\n if (\n !newPackageFileContent ||\n existingPackageFileContent === newPackageFileContent\n ) {\n return null;\n }\n logger.debug('Returning updated package.json');\n return {\n file: {\n type: 'addition',\n path: packageFileName,\n contents: newPackageFileContent,\n },\n };\n } catch (err) {\n logger.warn({ err }, 'Error updating package.json');\n await resetNpmrcContent(pkgFileDir, npmrcContent);\n return {\n artifactError: {\n fileName: packageFileName,\n stderr: err.message,\n },\n };\n }\n}\n\n/**\n * Update the minimumReleaseAgeExclude setting in pnpm-workspace.yaml if needed\n */\nasync function updatePnpmWorkspace(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const upgrades = updateArtifactsConfig.updatedDeps.filter(\n (u) => u.isVulnerabilityAlert,\n );\n // return early if no security updates are present\n if (isEmptyArray(upgrades)) {\n return null;\n }\n\n const pnpmLockFile = upgrades[0].managerData?.pnpmLockFile;\n if (!isString(pnpmLockFile)) {\n logger.debug(\n 'No pnpm shrinkwrap found, not attempting to update pnpm-workspace.yaml',\n );\n return null;\n }\n const lockFileDir = upath.dirname(pnpmLockFile);\n const pnpmWorkspaceFilePath = upath.join(lockFileDir, 'pnpm-workspace.yaml');\n\n if (!(await localPathExists(pnpmWorkspaceFilePath))) {\n return null;\n }\n\n // use already-updated content when updating the workspace file itself\n const packageFileContent =\n updateArtifactsConfig.packageFileName === pnpmWorkspaceFilePath\n ? updateArtifactsConfig.newPackageFileContent\n : (await readLocalFile(pnpmWorkspaceFilePath, 'utf8'))!;\n const doc = parseDocument(packageFileContent);\n\n if (!doc.get('minimumReleaseAge')) {\n return null;\n }\n\n let updated = false;\n\n for (const upgrade of upgrades) {\n let excludeNode = doc.getIn(['minimumReleaseAgeExclude']) as YAMLSeq | null;\n // v8 ignore next -- TODO: add test #40625\n const newVersion = upgrade.newVersion ?? upgrade.newValue;\n // For pnpm overrides with range selectors (e.g. \"pkg@<=1.0.0\"), depName contains\n // the full key including the selector. Use packageName (bare package name) for\n // minimumReleaseAgeExclude entries which require exact versions only.\n const excludeDepName = upgrade.packageName ?? upgrade.depName;\n\n /* v8 ignore if -- should not happen, adding for type narrowing*/\n if (excludeNode && !isSeq(excludeNode)) {\n return null;\n }\n\n if (!excludeNode) {\n logger.debug('Adding new exclude block');\n excludeNode = doc.createNode([]);\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n excludeNode.items.push(newItem);\n doc.set('minimumReleaseAgeExclude', excludeNode);\n updated = true;\n continue;\n }\n\n const {\n item: matchedItem,\n allExcluded,\n malformed,\n } = getMatchedItem(excludeDepName!, excludeNode.items);\n\n if (allExcluded) {\n // still clean up any malformed entries even when a wildcard covers the package\n } else if (malformed && isScalar<string>(matchedItem)) {\n logger.debug(\n { entry: matchedItem.value, excludeDepName, newVersion },\n 'Replacing malformed minimumReleaseAgeExclude entry',\n );\n matchedItem.value = `${excludeDepName}@${newVersion}`;\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n } else if (isScalar<string>(matchedItem)) {\n // if we have a comment before the list, which includes the dependency\n if (excludeNode?.commentBefore?.includes(`${excludeDepName}@`)) {\n // and it doesn't already have the version included in it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n excludeNode.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // then append it\n\n // normalize value (no quote handling needed)\n excludeNode.commentBefore = `${excludeNode.commentBefore} || ${newVersion}`;\n updated = true;\n }\n }\n // otherwise, if it's in our matched item's comment\n else if (matchedItem.commentBefore) {\n // add it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // normalize value (no quote handling needed)\n matchedItem.commentBefore = `${matchedItem.commentBefore} || ${newVersion}`;\n updated = true;\n }\n } else {\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n }\n\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.value,\n excludeDepName,\n newVersion,\n )\n ) {\n matchedItem.value = `${matchedItem.value} || ${newVersion}`;\n updated = true;\n }\n } else {\n // add new entry\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n\n excludeNode.items.push(newItem);\n updated = true;\n }\n\n // Remove any malformed entries for the same package left over from the prior bug\n for (let i = excludeNode.items.length - 1; i >= 0; i--) {\n const item = excludeNode.items[i];\n if (\n item !== matchedItem &&\n isScalar(item) &&\n isString(item.value) &&\n item.value.startsWith(`${excludeDepName}@`) &&\n !isValidMinimumReleaseAgeExcludeEntry(item.value, excludeDepName!)\n ) {\n excludeNode.items.splice(i, 1);\n updated = true;\n }\n }\n }\n\n if (!updated) {\n return null;\n }\n\n const newContent = doc.toString();\n await writeLocalFile(pnpmWorkspaceFilePath, newContent);\n\n return {\n file: {\n type: 'addition',\n path: pnpmWorkspaceFilePath,\n contents: newContent,\n },\n };\n}\n\nfunction getMatchedItem(\n depName: string,\n items: unknown[],\n): {\n item: Scalar | null;\n allExcluded: boolean;\n malformed?: boolean;\n} {\n let malformedItem: Scalar | null = null;\n\n for (const item of items) {\n /* v8 ignore if -- should not happen */\n if (!isScalar(item) || !isString(item.value)) {\n continue;\n }\n\n if (item.value.startsWith(`${depName}@`)) {\n if (isValidMinimumReleaseAgeExcludeEntry(item.value, depName)) {\n return {\n allExcluded: false,\n item,\n };\n }\n malformedItem ??= item;\n continue;\n }\n\n if (item.value === depName || matchRegexOrGlob(depName, item.value)) {\n return {\n allExcluded: true,\n item,\n };\n }\n }\n\n if (malformedItem) {\n return {\n allExcluded: false,\n item: malformedItem,\n malformed: true,\n };\n }\n\n return {\n item: null,\n allExcluded: false,\n };\n}\n\n/** pnpm requires package@version entries without range selectors or extra @ in the version part */\nfunction isValidMinimumReleaseAgeExcludeEntry(\n value: string,\n packageName: string,\n): boolean {\n return !value.slice(`${packageName}@`.length).includes('@');\n}\n\n/** determine whether a comment or a list item contains the depName at a given newVersion */\nfunction minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n line: string,\n depName: string | undefined,\n newVersion: string | undefined,\n): boolean {\n if (line.includes(`${depName}@${newVersion}`)) {\n return true;\n }\n\n if (line.includes(`|| ${newVersion}`)) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,MAAM,2BAA2B;AAKjC,eAAsB,gBACpB,uBACyC;CACzC,OAAO,MAAM,uBAAuB,sBAAsB,gBAAgB,EAAE;CAC5E,IAAI,MAA+B,CAAC;CACpC,IAAI,KACF,aAAa,MAAM,4BAA4B,qBAAqB,CAAC,CACvE;CACA,IAAI,KAAK,aAAa,MAAM,oBAAoB,qBAAqB,CAAC,CAAC;CAEvE,MAAM,IAAI,OAAO,gBAAgB;CACjC,IAAI,IAAI,WAAW,GACjB,OAAO;CAGT,OAAO;AACT;AAEA,eAAe,4BACb,uBACuC;CACvC,MAAM,EACJ,iBACA,QACA,aACA,uBAAuB,+BACrB;CACJ,MAAM,uBAAuB,YAAY,MACtC,QAAQ,IAAI,YAAY,gBAC3B;CAEA,IAAI,CAAC,sBAAsB;EACzB,OAAO,MAAM,4CAA4C;EACzD,OAAO;CACT;CAEA,MAAM,EAAE,cAAc,SAAS,eAAe;CAG9C,IAAI,CAAC,gBAAgB,CAAC,MAAM,wBAAwB,CAAC,CAAC,KAAK,YAAY,GACrE,OAAO;CAIT,MAAM,eAAe,iBAAiB,0BAA0B;CAIhE,MAAM,aAAa,MAAM,QAAQ,eAAe;CAChD,MAAM,EAAE,2BAA2B,iBAAiB;CACpD,MAAM,eAAe,MAAM,gBAAgB,UAAU;CACrD,MAAM,cAAc,oBAAoB,UAAU;CAClD,MAAM,MAAM,gBAAgB,MAAM,GAAG,QAAQ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;CAEJ;CAEA,IAAI,eACF,OAAO;EACL,aAAa;EACb,MAAM;EACN,WAAW;CACb;CAGF,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;;AAGA,SAAS,qCACP,OACA,aACS;CACT,OAAO,CAAC,MAAM,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC,SAAS,GAAG;AAC5D;;AAGA,SAAS,kDACP,MACA,SACA,YACS;CACT,IAAI,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,GAC1C,OAAO;CAGT,IAAI,KAAK,SAAS,MAAM,YAAY,GAClC,OAAO;CAGT,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/npm/artifacts.ts"],"sourcesContent":["import { isEmptyArray, isNonEmptyObject, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport upath from 'upath';\nimport type { Scalar, YAMLSeq } from 'yaml';\nimport { isScalar, isSeq, parseDocument } from 'yaml';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n ensureCacheDir,\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { matchRegexOrGlob } from '../../../util/string-match.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { PNPM_CACHE_DIR, PNPM_STORE_DIR } from './constants.ts';\nimport { getNodeToolConstraint } from './post-update/node-version.ts';\nimport { processHostRules } from './post-update/rules.ts';\nimport { lazyLoadPackageJson } from './post-update/utils.ts';\nimport { withNpmrcHostRules } from './utils.ts';\n\n// eg. 8.15.5+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589\nconst versionWithHashRegString = '^(?<version>.*)\\\\+(?<hash>.*)';\n\n// Execute 'corepack use' command for npm manager updates\n// This step is necessary because Corepack recommends attaching a hash after the version\n// The hash is generated only after running 'corepack use' and cannot be fetched from the npm registry\nexport async function updateArtifacts(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`npm.updateArtifacts(${updateArtifactsConfig.packageFileName})`);\n let res: UpdateArtifactsResult[] = [];\n res.push(\n coerceObject(await handlePackageManagerUpdates(updateArtifactsConfig)),\n );\n res.push(coerceObject(await updatePnpmWorkspace(updateArtifactsConfig)));\n\n res = res.filter(isNonEmptyObject);\n if (res.length === 0) {\n return null;\n }\n\n return res;\n}\n\nasync function handlePackageManagerUpdates(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const {\n packageFileName,\n config,\n updatedDeps,\n newPackageFileContent: existingPackageFileContent,\n } = updateArtifactsConfig;\n const packageManagerUpdate = updatedDeps.find(\n (dep) => dep.depType === 'packageManager',\n );\n\n if (!packageManagerUpdate) {\n logger.debug('No packageManager updates - returning null');\n return null;\n }\n\n const { currentValue, depName, newVersion } = packageManagerUpdate;\n\n // Execute 'corepack use' command only if the currentValue already has hash in it\n if (!currentValue || !regEx(versionWithHashRegString).test(currentValue)) {\n return null;\n }\n\n // write old updates before executing corepack update so that they are not removed from package file\n await writeLocalFile(packageFileName, existingPackageFileContent);\n\n // Asumming that corepack only needs to modify the package.json file in the root folder\n // As it should not be regular practice to have different package managers in different workspaces\n const pkgFileDir = upath.dirname(packageFileName);\n const { additionalNpmrcContent } = processHostRules();\n const lazyPkgJson = lazyLoadPackageJson(pkgFileDir);\n const cmd = `corepack use ${quote(`${depName}@${newVersion}`)}`;\n\n const nodeConstraints = await getNodeToolConstraint(\n config,\n updatedDeps,\n pkgFileDir,\n lazyPkgJson,\n );\n\n const pnpmConfigCacheDir = await ensureCacheDir(PNPM_CACHE_DIR);\n const pnpmConfigStoreDir = await ensureCacheDir(PNPM_STORE_DIR);\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n // To make sure pnpm store location is consistent between \"corepack use\"\n // here and the pnpm commands in ./post-update/pnpm.ts. Check\n // ./post-update/pnpm.ts for more details.\n npm_config_cache_dir: pnpmConfigCacheDir,\n npm_config_store_dir: pnpmConfigStoreDir,\n pnpm_config_cache_dir: pnpmConfigCacheDir,\n pnpm_config_store_dir: pnpmConfigStoreDir,\n },\n toolConstraints: [\n nodeConstraints,\n {\n toolName: 'corepack',\n constraint: await resolveToolConstraint(config, 'corepack'),\n },\n ],\n docker: {},\n };\n\n return await withNpmrcHostRules(\n pkgFileDir,\n additionalNpmrcContent,\n async () => {\n try {\n await exec(cmd, execOptions);\n const newPackageFileContent = await readLocalFile(\n packageFileName,\n 'utf8',\n );\n if (\n !newPackageFileContent ||\n existingPackageFileContent === newPackageFileContent\n ) {\n return null;\n }\n logger.debug('Returning updated package.json');\n return {\n file: {\n type: 'addition',\n path: packageFileName,\n contents: newPackageFileContent,\n },\n };\n } catch (err) {\n logger.warn({ err }, 'Error updating package.json');\n return {\n artifactError: {\n fileName: packageFileName,\n stderr: err.message,\n },\n };\n }\n },\n );\n}\n\n/**\n * Update the minimumReleaseAgeExclude setting in pnpm-workspace.yaml if needed\n */\nasync function updatePnpmWorkspace(\n updateArtifactsConfig: UpdateArtifact,\n): Promise<UpdateArtifactsResult | null> {\n const upgrades = updateArtifactsConfig.updatedDeps.filter(\n (u) => u.isVulnerabilityAlert,\n );\n // return early if no security updates are present\n if (isEmptyArray(upgrades)) {\n return null;\n }\n\n const pnpmLockFile = upgrades[0].managerData?.pnpmLockFile;\n if (!isString(pnpmLockFile)) {\n logger.debug(\n 'No pnpm shrinkwrap found, not attempting to update pnpm-workspace.yaml',\n );\n return null;\n }\n const lockFileDir = upath.dirname(pnpmLockFile);\n const pnpmWorkspaceFilePath = upath.join(lockFileDir, 'pnpm-workspace.yaml');\n\n if (!(await localPathExists(pnpmWorkspaceFilePath))) {\n return null;\n }\n\n // use already-updated content when updating the workspace file itself\n const packageFileContent =\n updateArtifactsConfig.packageFileName === pnpmWorkspaceFilePath\n ? updateArtifactsConfig.newPackageFileContent\n : (await readLocalFile(pnpmWorkspaceFilePath, 'utf8'))!;\n const doc = parseDocument(packageFileContent);\n\n if (!doc.get('minimumReleaseAge')) {\n return null;\n }\n\n let updated = false;\n\n for (const upgrade of upgrades) {\n let excludeNode = doc.getIn(['minimumReleaseAgeExclude']) as YAMLSeq | null;\n // v8 ignore next -- TODO: add test #40625\n const newVersion = upgrade.newVersion ?? upgrade.newValue;\n // For pnpm overrides with range selectors (e.g. \"pkg@<=1.0.0\"), depName contains\n // the full key including the selector. Use packageName (bare package name) for\n // minimumReleaseAgeExclude entries which require exact versions only.\n const excludeDepName = upgrade.packageName ?? upgrade.depName;\n\n /* v8 ignore if -- should not happen, adding for type narrowing*/\n if (excludeNode && !isSeq(excludeNode)) {\n return null;\n }\n\n if (!excludeNode) {\n logger.debug('Adding new exclude block');\n excludeNode = doc.createNode([]);\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n excludeNode.items.push(newItem);\n doc.set('minimumReleaseAgeExclude', excludeNode);\n updated = true;\n continue;\n }\n\n const {\n item: matchedItem,\n allExcluded,\n malformed,\n } = getMatchedItem(excludeDepName!, excludeNode.items);\n\n if (allExcluded) {\n // still clean up any malformed entries even when a wildcard covers the package\n } else if (malformed && isScalar<string>(matchedItem)) {\n logger.debug(\n { entry: matchedItem.value, excludeDepName, newVersion },\n 'Replacing malformed minimumReleaseAgeExclude entry',\n );\n matchedItem.value = `${excludeDepName}@${newVersion}`;\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n } else if (isScalar<string>(matchedItem)) {\n // if we have a comment before the list, which includes the dependency\n if (excludeNode?.commentBefore?.includes(`${excludeDepName}@`)) {\n // and it doesn't already have the version included in it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n excludeNode.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // then append it\n\n // normalize value (no quote handling needed)\n excludeNode.commentBefore = `${excludeNode.commentBefore} || ${newVersion}`;\n updated = true;\n }\n }\n // otherwise, if it's in our matched item's comment\n else if (matchedItem.commentBefore) {\n // add it\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.commentBefore,\n excludeDepName,\n newVersion,\n )\n ) {\n // normalize value (no quote handling needed)\n matchedItem.commentBefore = `${matchedItem.commentBefore} || ${newVersion}`;\n updated = true;\n }\n } else {\n matchedItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n updated = true;\n }\n\n if (\n !minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n matchedItem.value,\n excludeDepName,\n newVersion,\n )\n ) {\n matchedItem.value = `${matchedItem.value} || ${newVersion}`;\n updated = true;\n }\n } else {\n // add new entry\n const newItem = doc.createNode(`${excludeDepName}@${newVersion}`);\n newItem.commentBefore = ` Renovate security update: ${excludeDepName}@${newVersion}`;\n\n excludeNode.items.push(newItem);\n updated = true;\n }\n\n // Remove any malformed entries for the same package left over from the prior bug\n for (let i = excludeNode.items.length - 1; i >= 0; i--) {\n const item = excludeNode.items[i];\n if (\n item !== matchedItem &&\n isScalar(item) &&\n isString(item.value) &&\n item.value.startsWith(`${excludeDepName}@`) &&\n !isValidMinimumReleaseAgeExcludeEntry(item.value, excludeDepName!)\n ) {\n excludeNode.items.splice(i, 1);\n updated = true;\n }\n }\n }\n\n if (!updated) {\n return null;\n }\n\n const newContent = doc.toString();\n await writeLocalFile(pnpmWorkspaceFilePath, newContent);\n\n return {\n file: {\n type: 'addition',\n path: pnpmWorkspaceFilePath,\n contents: newContent,\n },\n };\n}\n\nfunction getMatchedItem(\n depName: string,\n items: unknown[],\n): {\n item: Scalar | null;\n allExcluded: boolean;\n malformed?: boolean;\n} {\n let malformedItem: Scalar | null = null;\n\n for (const item of items) {\n /* v8 ignore if -- should not happen */\n if (!isScalar(item) || !isString(item.value)) {\n continue;\n }\n\n if (item.value.startsWith(`${depName}@`)) {\n if (isValidMinimumReleaseAgeExcludeEntry(item.value, depName)) {\n return {\n allExcluded: false,\n item,\n };\n }\n malformedItem ??= item;\n continue;\n }\n\n if (item.value === depName || matchRegexOrGlob(depName, item.value)) {\n return {\n allExcluded: true,\n item,\n };\n }\n }\n\n if (malformedItem) {\n return {\n allExcluded: false,\n item: malformedItem,\n malformed: true,\n };\n }\n\n return {\n item: null,\n allExcluded: false,\n };\n}\n\n/** pnpm requires package@version entries without range selectors or extra @ in the version part */\nfunction isValidMinimumReleaseAgeExcludeEntry(\n value: string,\n packageName: string,\n): boolean {\n return !value.slice(`${packageName}@`.length).includes('@');\n}\n\n/** determine whether a comment or a list item contains the depName at a given newVersion */\nfunction minimumReleaseAgeExcludeIncludesDepNameAndVersion(\n line: string,\n depName: string | undefined,\n newVersion: string | undefined,\n): boolean {\n if (line.includes(`${depName}@${newVersion}`)) {\n return true;\n }\n\n if (line.includes(`|| ${newVersion}`)) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,MAAM,2BAA2B;AAKjC,eAAsB,gBACpB,uBACyC;CACzC,OAAO,MAAM,uBAAuB,sBAAsB,gBAAgB,EAAE;CAC5E,IAAI,MAA+B,CAAC;CACpC,IAAI,KACF,aAAa,MAAM,4BAA4B,qBAAqB,CAAC,CACvE;CACA,IAAI,KAAK,aAAa,MAAM,oBAAoB,qBAAqB,CAAC,CAAC;CAEvE,MAAM,IAAI,OAAO,gBAAgB;CACjC,IAAI,IAAI,WAAW,GACjB,OAAO;CAGT,OAAO;AACT;AAEA,eAAe,4BACb,uBACuC;CACvC,MAAM,EACJ,iBACA,QACA,aACA,uBAAuB,+BACrB;CACJ,MAAM,uBAAuB,YAAY,MACtC,QAAQ,IAAI,YAAY,gBAC3B;CAEA,IAAI,CAAC,sBAAsB;EACzB,OAAO,MAAM,4CAA4C;EACzD,OAAO;C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,GACzC;EAGF,IAAI,KAAK,MAAM,WAAW,GAAG,QAAQ,EAAE,GAAG;GACxC,IAAI,qCAAqC,KAAK,OAAO,OAAO,GAC1D,OAAO;IACL,aAAa;IACb;GACF;GAEF,kBAAkB;GAClB;EACF;EAEA,IAAI,KAAK,UAAU,WAAW,iBAAiB,SAAS,KAAK,KAAK,GAChE,OAAO;GACL,aAAa;GACb;EACF;CAEJ;CAEA,IAAI,eACF,OAAO;EACL,aAAa;EACb,MAAM;EACN,WAAW;CACb;CAGF,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;;AAGA,SAAS,qCACP,OACA,aACS;CACT,OAAO,CAAC,MAAM,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC,SAAS,GAAG;AAC5D;;AAGA,SAAS,kDACP,MACA,SACA,YACS;CACT,IAAI,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,GAC1C,OAAO;CAGT,IAAI,KAAK,SAAS,MAAM,YAAY,GAClC,OAAO;CAGT,OAAO;AACT"}
|
|
@@ -11,7 +11,7 @@ import { NpmDatasource } from "../../../datasource/npm/index.js";
|
|
|
11
11
|
import { artifactErrorMessageFromExecError } from "../../util.js";
|
|
12
12
|
import { PNPM_CACHE_BASE_DIR, YARN_CACHE_DIR, YARN_GLOBAL_DIR } from "../constants.js";
|
|
13
13
|
import { processHostRules } from "./rules.js";
|
|
14
|
-
import { composeLockFile,
|
|
14
|
+
import { composeLockFile, parseLockFile, withNpmrcHostRules } from "../utils.js";
|
|
15
15
|
import { getZeroInstallPaths } from "../extract/yarn.js";
|
|
16
16
|
import { scm } from "../../../platform/scm.js";
|
|
17
17
|
import { generateLockFile } from "./npm.js";
|
|
@@ -309,141 +309,138 @@ async function getAdditionalFilesInner(config, packageFiles, originalNpmrcFiles)
|
|
|
309
309
|
const tokenRe = regEx(`${token ?? ""}`, "g", false);
|
|
310
310
|
for (const npmLock of dirs.npmLockDirs) {
|
|
311
311
|
const lockFileDir = upath.dirname(npmLock);
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
312
|
+
await withNpmrcHostRules(lockFileDir, additionalNpmrcContent, async (npmrcContent) => {
|
|
313
|
+
const fileName = upath.basename(npmLock);
|
|
314
|
+
logger.debug(`Generating ${fileName} for ${lockFileDir}`);
|
|
315
|
+
const upgrades = config.upgrades.filter((upgrade) => upgrade.managerData?.npmLock === npmLock);
|
|
316
|
+
const res = await generateLockFile(lockFileDir, env, fileName, config, upgrades, npmrcContent);
|
|
317
|
+
if (res.error) {
|
|
318
|
+
/* v8 ignore next -- needs test */
|
|
319
|
+
if (res.stderr?.includes("No matching version found for")) {
|
|
320
|
+
for (const upgrade of config.upgrades) if (res.stderr.includes(`No matching version found for ${upgrade.depName}`)) {
|
|
321
|
+
logger.debug({
|
|
322
|
+
dependency: upgrade.depName,
|
|
323
|
+
type: "npm"
|
|
324
|
+
}, "lock file failed for the dependency being updated - skipping branch creation");
|
|
325
|
+
throw new ExternalHostError(/* @__PURE__ */ new Error("lock file failed for the dependency being updated - skipping branch creation"), NpmDatasource.id);
|
|
326
|
+
}
|
|
327
327
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
stderr: res.stderr
|
|
332
|
-
});
|
|
333
|
-
} else if (res.lockFile) {
|
|
334
|
-
if (res.beforeFallback) {
|
|
335
|
-
const message = "npm `--before` could not be enforced because existing locked packages were published after the `minimumReleaseAge` cutoff. This will resolve after the next lock file maintenance run.";
|
|
336
|
-
logger.warn({ npmLock }, message);
|
|
337
|
-
artifactNotices.push({
|
|
338
|
-
file: npmLock,
|
|
339
|
-
message
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
const existingContent = await getFile(npmLock, config.reuseExistingBranch ? config.branchName : config.baseBranch);
|
|
343
|
-
if (res.lockFile === existingContent) logger.debug(`${npmLock} hasn't changed`);
|
|
344
|
-
else {
|
|
345
|
-
logger.debug(`${npmLock} needs updating`);
|
|
346
|
-
updatedArtifacts.push({
|
|
347
|
-
type: "addition",
|
|
348
|
-
path: npmLock,
|
|
349
|
-
contents: res.lockFile.replace(tokenRe, "")
|
|
328
|
+
artifactErrors.push({
|
|
329
|
+
fileName: npmLock,
|
|
330
|
+
stderr: res.stderr
|
|
350
331
|
});
|
|
332
|
+
} else if (res.lockFile) {
|
|
333
|
+
if (res.beforeFallback) {
|
|
334
|
+
const message = "npm `--before` could not be enforced because existing locked packages were published after the `minimumReleaseAge` cutoff. This will resolve after the next lock file maintenance run.";
|
|
335
|
+
logger.warn({ npmLock }, message);
|
|
336
|
+
artifactNotices.push({
|
|
337
|
+
file: npmLock,
|
|
338
|
+
message
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
const existingContent = await getFile(npmLock, config.reuseExistingBranch ? config.branchName : config.baseBranch);
|
|
342
|
+
if (res.lockFile === existingContent) logger.debug(`${npmLock} hasn't changed`);
|
|
343
|
+
else {
|
|
344
|
+
logger.debug(`${npmLock} needs updating`);
|
|
345
|
+
updatedArtifacts.push({
|
|
346
|
+
type: "addition",
|
|
347
|
+
path: npmLock,
|
|
348
|
+
contents: res.lockFile.replace(tokenRe, "")
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
351
|
}
|
|
352
|
-
}
|
|
353
|
-
await resetNpmrcContent(lockFileDir, npmrcContent);
|
|
352
|
+
});
|
|
354
353
|
}
|
|
355
354
|
for (const yarnLock of dirs.yarnLockDirs) {
|
|
356
355
|
const lockFileDir = upath.dirname(yarnLock);
|
|
357
|
-
const npmrcContent = await getNpmrcContent(lockFileDir);
|
|
358
|
-
await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);
|
|
359
356
|
let yarnRcYmlFilename;
|
|
360
357
|
let existingYarnrcYmlContent;
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
logger.debug(`Generating yarn.lock for ${lockFileDir}`);
|
|
375
|
-
const lockFileName = upath.join(lockFileDir, "yarn.lock");
|
|
376
|
-
const upgrades = config.upgrades.filter((upgrade) => upgrade.managerData?.yarnLock === yarnLock);
|
|
377
|
-
const res = await generateLockFile$2(lockFileDir, env, config, upgrades);
|
|
378
|
-
if (res.error) {
|
|
379
|
-
/* v8 ignore next -- needs test */
|
|
380
|
-
if (res.stderr?.includes(`Couldn't find any versions for`)) {
|
|
381
|
-
for (const upgrade of config.upgrades) if (res.stderr.includes(`Couldn't find any versions for \\"${upgrade.depName}\\"`)) {
|
|
382
|
-
logger.debug({
|
|
383
|
-
dependency: upgrade.depName,
|
|
384
|
-
type: "yarn"
|
|
385
|
-
}, "lock file failed for the dependency being updated - skipping branch creation");
|
|
386
|
-
throw new ExternalHostError(/* @__PURE__ */ new Error("lock file failed for the dependency being updated - skipping branch creation"), NpmDatasource.id);
|
|
358
|
+
await withNpmrcHostRules(lockFileDir, additionalNpmrcContent, async () => {
|
|
359
|
+
if (additionalYarnRcYml) {
|
|
360
|
+
yarnRcYmlFilename = getSiblingFileName(yarnLock, ".yarnrc.yml");
|
|
361
|
+
existingYarnrcYmlContent = await readLocalFile(yarnRcYmlFilename, "utf8");
|
|
362
|
+
// v8 ignore else -- TODO: add test #40625
|
|
363
|
+
if (existingYarnrcYmlContent) try {
|
|
364
|
+
const existingYarnrRcYml = parseSingleYaml(existingYarnrcYmlContent);
|
|
365
|
+
const updatedYarnYrcYml = merge(existingYarnrRcYml, fuzzyMatchAdditionalYarnrcYml(additionalYarnRcYml, existingYarnrRcYml));
|
|
366
|
+
await writeLocalFile(yarnRcYmlFilename, dump(updatedYarnYrcYml));
|
|
367
|
+
logger.debug("Added authentication to .yarnrc.yml");
|
|
368
|
+
} catch (err) {
|
|
369
|
+
logger.warn({ err }, "Error appending .yarnrc.yml content");
|
|
387
370
|
}
|
|
388
371
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
372
|
+
logger.debug(`Generating yarn.lock for ${lockFileDir}`);
|
|
373
|
+
const lockFileName = upath.join(lockFileDir, "yarn.lock");
|
|
374
|
+
const upgrades = config.upgrades.filter((upgrade) => upgrade.managerData?.yarnLock === yarnLock);
|
|
375
|
+
const res = await generateLockFile$2(lockFileDir, env, config, upgrades);
|
|
376
|
+
if (res.error) {
|
|
377
|
+
/* v8 ignore next -- needs test */
|
|
378
|
+
if (res.stderr?.includes(`Couldn't find any versions for`)) {
|
|
379
|
+
for (const upgrade of config.upgrades) if (res.stderr.includes(`Couldn't find any versions for \\"${upgrade.depName}\\"`)) {
|
|
380
|
+
logger.debug({
|
|
381
|
+
dependency: upgrade.depName,
|
|
382
|
+
type: "yarn"
|
|
383
|
+
}, "lock file failed for the dependency being updated - skipping branch creation");
|
|
384
|
+
throw new ExternalHostError(/* @__PURE__ */ new Error("lock file failed for the dependency being updated - skipping branch creation"), NpmDatasource.id);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
artifactErrors.push({
|
|
388
|
+
fileName: yarnLock,
|
|
389
|
+
stderr: artifactErrorMessageFromExecError(res, "")
|
|
402
390
|
});
|
|
403
|
-
|
|
391
|
+
} else {
|
|
392
|
+
const existingContent = await getFile(lockFileName, config.reuseExistingBranch ? config.branchName : config.baseBranch);
|
|
393
|
+
if (res.lockFile === existingContent) logger.debug("yarn.lock hasn't changed");
|
|
394
|
+
else {
|
|
395
|
+
logger.debug("yarn.lock needs updating");
|
|
396
|
+
updatedArtifacts.push({
|
|
397
|
+
type: "addition",
|
|
398
|
+
path: lockFileName,
|
|
399
|
+
contents: res.lockFile
|
|
400
|
+
});
|
|
401
|
+
await updateYarnOffline(lockFileDir, updatedArtifacts);
|
|
402
|
+
}
|
|
403
|
+
/* v8 ignore next -- needs test */
|
|
404
|
+
if (upgrades.some(isYarnUpdate)) existingYarnrcYmlContent = await updateYarnBinary(lockFileDir, updatedArtifacts, existingYarnrcYmlContent);
|
|
404
405
|
}
|
|
405
|
-
|
|
406
|
-
if (upgrades.some(isYarnUpdate)) existingYarnrcYmlContent = await updateYarnBinary(lockFileDir, updatedArtifacts, existingYarnrcYmlContent);
|
|
407
|
-
}
|
|
408
|
-
await resetNpmrcContent(lockFileDir, npmrcContent);
|
|
406
|
+
});
|
|
409
407
|
/* v8 ignore next -- needs test */
|
|
410
408
|
if (existingYarnrcYmlContent) await writeLocalFile(yarnRcYmlFilename, existingYarnrcYmlContent);
|
|
411
409
|
}
|
|
412
410
|
for (const pnpmLockFile of dirs.pnpmLockFileDirs) {
|
|
413
411
|
const lockFileDir = upath.dirname(pnpmLockFile);
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
412
|
+
await withNpmrcHostRules(lockFileDir, additionalNpmrcContent, async () => {
|
|
413
|
+
logger.debug(`Generating pnpm-lock.yaml for ${lockFileDir}`);
|
|
414
|
+
const upgrades = config.upgrades.filter((upgrade) => upgrade.managerData?.pnpmLockFile === pnpmLockFile);
|
|
415
|
+
const res = await generateLockFile$1(lockFileDir, env, config, upgrades);
|
|
416
|
+
if (res.error) {
|
|
417
|
+
/* v8 ignore next -- needs test */
|
|
418
|
+
if (res.stdout?.includes(`No compatible version found:`)) {
|
|
419
|
+
for (const upgrade of config.upgrades) if (res.stdout.includes(`No compatible version found: ${upgrade.depName}`)) {
|
|
420
|
+
logger.debug({
|
|
421
|
+
dependency: upgrade.depName,
|
|
422
|
+
type: "pnpm"
|
|
423
|
+
}, "lock file failed for the dependency being updated - skipping branch creation");
|
|
424
|
+
throw new ExternalHostError(Error("lock file failed for the dependency being updated - skipping branch creation"), NpmDatasource.id);
|
|
425
|
+
}
|
|
428
426
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
stderr: artifactErrorMessageFromExecError(res, "")
|
|
433
|
-
});
|
|
434
|
-
} else {
|
|
435
|
-
const existingContent = await getFile(pnpmLockFile, config.reuseExistingBranch ? config.branchName : config.baseBranch);
|
|
436
|
-
if (res.lockFile === existingContent) logger.debug("pnpm-lock.yaml hasn't changed");
|
|
437
|
-
else {
|
|
438
|
-
logger.debug("pnpm-lock.yaml needs updating");
|
|
439
|
-
updatedArtifacts.push({
|
|
440
|
-
type: "addition",
|
|
441
|
-
path: pnpmLockFile,
|
|
442
|
-
contents: res.lockFile
|
|
427
|
+
artifactErrors.push({
|
|
428
|
+
fileName: pnpmLockFile,
|
|
429
|
+
stderr: artifactErrorMessageFromExecError(res, "")
|
|
443
430
|
});
|
|
431
|
+
} else {
|
|
432
|
+
const existingContent = await getFile(pnpmLockFile, config.reuseExistingBranch ? config.branchName : config.baseBranch);
|
|
433
|
+
if (res.lockFile === existingContent) logger.debug("pnpm-lock.yaml hasn't changed");
|
|
434
|
+
else {
|
|
435
|
+
logger.debug("pnpm-lock.yaml needs updating");
|
|
436
|
+
updatedArtifacts.push({
|
|
437
|
+
type: "addition",
|
|
438
|
+
path: pnpmLockFile,
|
|
439
|
+
contents: res.lockFile
|
|
440
|
+
});
|
|
441
|
+
}
|
|
444
442
|
}
|
|
445
|
-
}
|
|
446
|
-
await resetNpmrcContent(lockFileDir, npmrcContent);
|
|
443
|
+
});
|
|
447
444
|
}
|
|
448
445
|
return {
|
|
449
446
|
artifactErrors,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["hostRules.find","npm.generateLockFile","deepmerge","yarn.fuzzyMatchAdditionalYarnrcYml","yarn.generateLockFile","yarn.isYarnUpdate","pnpm.generateLockFile"],"sources":["../../../../../lib/modules/manager/npm/post-update/index.ts"],"sourcesContent":["// TODO: types (#22198)\nimport { isNonEmptyStringAndNotWhitespace, isString } from '@sindresorhus/is';\nimport deepmerge from 'deepmerge';\nimport upath from 'upath';\nimport { logger } from '../../../../logger/index.ts';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error.ts';\nimport { getEnv } from '../../../../util/env.ts';\nimport {\n ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs/index.ts';\nimport { getFile, getRepoStatus } from '../../../../util/git/index.ts';\nimport type { FileChange } from '../../../../util/git/types.ts';\nimport * as hostRules from '../../../../util/host-rules.ts';\nimport { newlineRegex, regEx } from '../../../../util/regex.ts';\nimport { ensureTrailingSlash } from '../../../../util/url.ts';\nimport { dump, parseSingleYaml } from '../../../../util/yaml.ts';\nimport { NpmDatasource } from '../../../datasource/npm/index.ts';\nimport { scm } from '../../../platform/scm.ts';\nimport type {\n ArtifactError,\n ArtifactNotice,\n PackageFile,\n PostUpdateConfig,\n Upgrade,\n} from '../../types.ts';\nimport { artifactErrorMessageFromExecError } from '../../util.ts';\nimport {\n NPM_CACHE_DIR,\n PNPM_CACHE_BASE_DIR,\n YARN_CACHE_DIR,\n YARN_GLOBAL_DIR,\n} from '../constants.ts';\nimport { getZeroInstallPaths } from '../extract/yarn.ts';\nimport type { NpmManagerData } from '../types.ts';\nimport {\n composeLockFile,\n getNpmrcContent,\n parseLockFile,\n resetNpmrcContent,\n updateNpmrcContent,\n} from '../utils.ts';\nimport * as npm from './npm.ts';\nimport * as pnpm from './pnpm.ts';\nimport { processHostRules } from './rules.ts';\nimport type {\n AdditionalPackageFiles,\n DetermineLockFileDirsResult,\n WriteExistingFilesResult,\n YarnRcYmlFile,\n} from './types.ts';\nimport * as yarn from './yarn.ts';\n\n// Strips empty values, deduplicates, and returns the directories from filenames\nfunction getDirs(arr: (string | null | undefined)[]): string[] {\n return Array.from(new Set(arr.filter(isString)));\n}\n\nexport function determineLockFileDirs(\n config: PostUpdateConfig,\n packageFiles: AdditionalPackageFiles,\n): DetermineLockFileDirsResult {\n const npmLockDirs: (string | undefined)[] = [];\n const yarnLockDirs: (string | undefined)[] = [];\n const pnpmLockFileDirs: (string | undefined)[] = [];\n\n for (const upgrade of config.upgrades) {\n // v8 ignore else -- TODO: add test #40625\n if (\n upgrade.updateType === 'lockFileMaintenance' ||\n upgrade.isRemediation === true ||\n upgrade.isLockfileUpdate === true\n ) {\n yarnLockDirs.push(upgrade.managerData?.yarnLock);\n npmLockDirs.push(upgrade.managerData?.npmLock);\n pnpmLockFileDirs.push(upgrade.managerData?.pnpmLockFile);\n }\n }\n\n if (\n config.upgrades.every(\n (upgrade: Upgrade) =>\n upgrade.updateType === 'lockFileMaintenance' ||\n upgrade.isLockfileUpdate,\n )\n ) {\n return {\n yarnLockDirs: getDirs(yarnLockDirs),\n npmLockDirs: getDirs(npmLockDirs),\n pnpmLockFileDirs: getDirs(pnpmLockFileDirs),\n };\n }\n\n function getPackageFile(\n fileName: string,\n ): Partial<PackageFile<NpmManagerData>> {\n logger.trace(`Looking for packageFile: ${fileName}`);\n\n for (const packageFile of packageFiles.npm!) {\n if (packageFile.packageFile === fileName) {\n logger.trace({ packageFile }, 'Found packageFile');\n return packageFile;\n }\n logger.trace('No match');\n }\n return {};\n }\n\n // TODO #22198\n for (const p of config.updatedPackageFiles!) {\n logger.trace(`Checking ${String(p.path)} for lock files`);\n const packageFile = getPackageFile(p.path);\n /* v8 ignore next -- needs test */\n if (!packageFile.managerData) {\n continue;\n }\n // push full lock file names and convert them later\n yarnLockDirs.push(packageFile.managerData.yarnLock);\n npmLockDirs.push(packageFile.managerData.npmLock);\n pnpmLockFileDirs.push(packageFile.managerData.pnpmLockFile);\n }\n\n return {\n yarnLockDirs: getDirs(yarnLockDirs),\n npmLockDirs: getDirs(npmLockDirs),\n pnpmLockFileDirs: getDirs(pnpmLockFileDirs),\n };\n}\n\nexport async function writeExistingFiles(\n config: PostUpdateConfig,\n packageFiles: AdditionalPackageFiles,\n originalNpmrcFiles = new Map<string, string>(),\n): Promise<void> {\n if (!packageFiles.npm) {\n return;\n }\n const npmFiles = packageFiles.npm;\n logger.debug(\n { packageFiles: npmFiles.map((n) => n.packageFile) },\n 'Writing package.json files',\n );\n for (const packageFile of npmFiles) {\n /* v8 ignore if -- TODO: add test #40625 */\n if (!packageFile.managerData) {\n continue;\n }\n // TODO #22198\n const basedir = upath.dirname(packageFile.packageFile!);\n const npmrc = packageFile.npmrc;\n const npmrcFilename = upath.join(basedir, '.npmrc');\n // Write out the file unless the npmrc came from the workspace\n // npmrcFilename will be set whenever the file was read from disk during extract\n if (\n isString(npmrc) &&\n (npmrcFilename === packageFile.managerData.npmrcFileName ||\n !packageFile.managerData.npmrcFileName)\n ) {\n try {\n if (!originalNpmrcFiles.has(npmrcFilename)) {\n const originalNpmrc = await readLocalFile(npmrcFilename, 'utf8');\n if (isString(originalNpmrc)) {\n originalNpmrcFiles.set(npmrcFilename, originalNpmrc);\n }\n }\n await writeLocalFile(npmrcFilename, npmrc.replace(regEx(/\\n?$/), '\\n'));\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn({ npmrcFilename, err }, 'Error writing .npmrc');\n }\n }\n const npmLock = packageFile.managerData.npmLock;\n if (npmLock) {\n const npmLockPath = npmLock;\n logger.debug(`Writing ${npmLock}`);\n let existingNpmLock: string;\n try {\n existingNpmLock = (await getFile(npmLock)) ?? '';\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn({ err }, 'Error reading npm lock file');\n existingNpmLock = '';\n }\n const { detectedIndent, lockFileParsed: npmLockParsed } =\n parseLockFile(existingNpmLock);\n if (npmLockParsed) {\n const packageNames =\n 'packages' in npmLockParsed\n ? Object.keys(npmLockParsed.packages)\n : [];\n const widens: string[] = [];\n let lockFileChanged = false;\n for (const upgrade of config.upgrades) {\n if (upgrade.lockFiles && !upgrade.lockFiles.includes(npmLock)) {\n continue;\n }\n if (!upgrade.managerData) {\n continue;\n }\n if (\n upgrade.rangeStrategy === 'widen' &&\n upgrade.managerData.npmLock === npmLock\n ) {\n // TODO #22198\n widens.push(upgrade.depName!);\n }\n const { depName } = upgrade;\n const oldVersion = upgrade.lockedVersion ?? upgrade.currentVersion;\n if ('packages' in npmLockParsed) {\n for (const packageName of packageNames) {\n if (\n packageName === `node_modules/${depName}` ||\n packageName.startsWith(`node_modules/${depName}/`)\n ) {\n logger.trace({ packageName }, 'Massaging out package name');\n lockFileChanged = true;\n delete npmLockParsed.packages[packageName];\n continue;\n }\n if (\n !depName ||\n !oldVersion ||\n // Workspace entries (e.g. `packages/app`) and the root entry\n // are link targets: `node_modules/<name>` points at them with\n // `link: true`, so deleting one breaks npm with EMISSINGTARGET.\n !packageName.startsWith('node_modules/')\n ) {\n continue;\n }\n // Lockstep monorepo siblings (e.g. vue -> @vue/server-renderer)\n // pin the updated dep to its exact old version. Left in the lock\n // they cannot resolve against the new version and npm fails with\n // ERESOLVE, so massage them out too and let npm re-resolve them.\n const entry = npmLockParsed.packages[packageName];\n const pinned =\n entry?.peerDependencies?.[depName] === oldVersion ||\n entry?.dependencies?.[depName] === oldVersion ||\n entry?.optionalDependencies?.[depName] === oldVersion;\n if (pinned) {\n logger.trace(\n { packageName, depName, oldVersion },\n 'Massaging out lockstep sibling',\n );\n lockFileChanged = true;\n delete npmLockParsed.packages[packageName];\n }\n }\n }\n }\n // v8 ignore else -- TODO: add test #40625\n if (widens.length) {\n logger.debug(\n `Removing ${String(widens)} from ${npmLock} to force an update`,\n );\n lockFileChanged = true;\n try {\n if ('dependencies' in npmLockParsed && npmLockParsed.dependencies) {\n widens.forEach((depName) => {\n // TODO #22198\n delete npmLockParsed.dependencies![depName];\n });\n }\n } catch /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn(\n { npmLock },\n 'Error massaging package-lock.json for widen',\n );\n }\n }\n // v8 ignore else -- TODO: add test #40625\n if (lockFileChanged) {\n logger.debug('Massaging npm lock file before writing to disk');\n existingNpmLock = composeLockFile(npmLockParsed, detectedIndent);\n }\n await writeLocalFile(npmLockPath, existingNpmLock);\n }\n }\n }\n}\n\nasync function restoreNpmrcFiles(\n originalNpmrcFiles: Map<string, string>,\n): Promise<void> {\n for (const [npmrcFilename, originalNpmrc] of originalNpmrcFiles) {\n try {\n await writeLocalFile(npmrcFilename, originalNpmrc);\n } catch (err) {\n logger.warn({ npmrcFilename, err }, 'Error restoring .npmrc');\n }\n }\n}\n\nexport async function writeUpdatedPackageFiles(\n config: PostUpdateConfig,\n): Promise<void> {\n logger.trace({ config }, 'writeUpdatedPackageFiles');\n logger.debug('Writing any updated package files');\n if (!config.updatedPackageFiles) {\n logger.debug('No files found');\n return;\n }\n // prefer artifact content when it updates the same file (e.g. pnpm-workspace.yaml)\n const artifactContents = new Map<string, string>();\n if (config.updatedArtifacts) {\n for (const artifact of config.updatedArtifacts) {\n if (artifact.type === 'addition' && artifact.contents) {\n artifactContents.set(artifact.path, artifact.contents.toString());\n }\n }\n }\n const supportedLockFiles = ['package-lock.json', 'yarn.lock'];\n for (const packageFile of config.updatedPackageFiles) {\n if (packageFile.type !== 'addition') {\n continue;\n }\n if (\n supportedLockFiles.some((fileName) => packageFile.path.endsWith(fileName))\n ) {\n logger.debug(`Writing lock file: ${packageFile.path}`);\n // TODO #22198\n\n await writeLocalFile(packageFile.path, packageFile.contents!);\n continue;\n }\n if (!(\n packageFile.path.endsWith('package.json') ||\n packageFile.path.endsWith('pnpm-workspace.yaml') ||\n packageFile.path.endsWith('.yarnrc.yml')\n )) {\n continue;\n }\n const contents =\n artifactContents.get(packageFile.path) ?? packageFile.contents!;\n logger.debug(`Writing ${packageFile.path}`);\n await writeLocalFile(packageFile.path, contents);\n }\n}\n\n/* v8 ignore next -- needs test */\nasync function updateYarnOffline(\n lockFileDir: string,\n updatedArtifacts: FileChange[],\n): Promise<void> {\n try {\n const resolvedPaths: string[] = [];\n const yarnrcYml = await getFile(upath.join(lockFileDir, '.yarnrc.yml'));\n const yarnrc = await getFile(upath.join(lockFileDir, '.yarnrc'));\n\n // As .yarnrc.yml overrides .yarnrc in Yarn 1 (https://git.io/JUcco)\n // both files may exist, so check for .yarnrc.yml first\n if (yarnrcYml) {\n // Yarn 2 (offline cache and zero-installs)\n const paths = getZeroInstallPaths(yarnrcYml);\n resolvedPaths.push(...paths.map((p) => upath.join(lockFileDir, p)));\n } else if (yarnrc) {\n // Yarn 1 (offline mirror)\n const mirrorLine = yarnrc\n .split(newlineRegex)\n .find((line) => line.startsWith('yarn-offline-mirror '));\n if (mirrorLine) {\n const mirrorPath = ensureTrailingSlash(\n mirrorLine.split(' ')[1].replace(regEx(/\"/g), ''),\n );\n resolvedPaths.push(upath.join(lockFileDir, mirrorPath));\n }\n }\n logger.debug({ resolvedPaths }, 'updateYarnOffline resolvedPaths');\n\n if (resolvedPaths.length) {\n const status = await getRepoStatus();\n for (const f of status.modified.concat(status.not_added)) {\n if (resolvedPaths.some((p) => f.startsWith(p))) {\n updatedArtifacts.push({\n type: 'addition',\n path: f,\n contents: await readLocalFile(f),\n });\n }\n }\n for (const f of status.deleted || []) {\n if (resolvedPaths.some((p) => f.startsWith(p))) {\n updatedArtifacts.push({ type: 'deletion', path: f });\n }\n }\n }\n } catch (err) {\n logger.error({ err }, 'Error updating yarn offline packages');\n }\n}\n\n// TODO: move to ./yarn.ts\n// exported for testing\nexport async function updateYarnBinary(\n lockFileDir: string,\n updatedArtifacts: FileChange[],\n existingYarnrcYmlContent: string | undefined | null,\n): Promise<string | undefined | null> {\n let yarnrcYml = existingYarnrcYmlContent;\n try {\n const yarnrcYmlFilename = upath.join(lockFileDir, '.yarnrc.yml');\n yarnrcYml ??= (await getFile(yarnrcYmlFilename)) ?? undefined;\n const newYarnrcYml = await readLocalFile(yarnrcYmlFilename, 'utf8');\n if (!isString(yarnrcYml) || !isString(newYarnrcYml)) {\n return existingYarnrcYmlContent;\n }\n\n // TODO: use schema (#9610)\n const oldYarnPath = parseSingleYaml<YarnRcYmlFile>(yarnrcYml)?.yarnPath;\n const newYarnPath = parseSingleYaml<YarnRcYmlFile>(newYarnrcYml)?.yarnPath;\n if (\n !isNonEmptyStringAndNotWhitespace(oldYarnPath) ||\n !isNonEmptyStringAndNotWhitespace(newYarnPath)\n ) {\n return existingYarnrcYmlContent;\n }\n\n const oldYarnFullPath = upath.join(lockFileDir, oldYarnPath);\n const newYarnFullPath = upath.join(lockFileDir, newYarnPath);\n logger.debug({ oldYarnPath, newYarnPath }, 'Found updated Yarn binary');\n\n yarnrcYml = yarnrcYml.replace(oldYarnPath, newYarnPath);\n updatedArtifacts.push(\n {\n type: 'addition',\n path: yarnrcYmlFilename,\n contents: yarnrcYml,\n },\n {\n type: 'deletion',\n path: oldYarnFullPath,\n },\n {\n type: 'addition',\n path: newYarnFullPath,\n contents: await readLocalFile(newYarnFullPath, 'utf8'),\n isExecutable: true,\n },\n );\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.error({ err }, 'Error updating Yarn binary');\n }\n return existingYarnrcYmlContent && yarnrcYml;\n}\n\nasync function getAdditionalFilesInner(\n config: PostUpdateConfig<NpmManagerData>,\n packageFiles: AdditionalPackageFiles,\n originalNpmrcFiles: Map<string, string>,\n): Promise<WriteExistingFilesResult> {\n logger.trace({ config }, 'getAdditionalFiles');\n const artifactErrors: ArtifactError[] = [];\n const artifactNotices: ArtifactNotice[] = [];\n const updatedArtifacts: FileChange[] = [];\n if (!packageFiles.npm?.length) {\n return { artifactErrors, artifactNotices, updatedArtifacts };\n }\n if (config.skipArtifactsUpdate) {\n logger.debug('Skipping lock file generation');\n return { artifactErrors, artifactNotices, updatedArtifacts };\n }\n logger.debug('Getting updated lock files');\n if (\n config.isLockFileMaintenance &&\n config.reuseExistingBranch &&\n (await scm.branchExists(config.branchName))\n ) {\n logger.debug('Skipping lockFileMaintenance update');\n return { artifactErrors, artifactNotices, updatedArtifacts };\n }\n const dirs = determineLockFileDirs(config, packageFiles);\n logger.trace({ dirs }, 'lock file dirs');\n await writeExistingFiles(config, packageFiles, originalNpmrcFiles);\n await writeUpdatedPackageFiles(config);\n\n const { additionalNpmrcContent, additionalYarnRcYml } = processHostRules();\n\n // This isn't passed directly to the child process, so no need to filter.\n // But pass custom env and user vars.\n const env = {\n ...getEnv(),\n NPM_CONFIG_CACHE: await ensureCacheDir(NPM_CACHE_DIR),\n YARN_CACHE_FOLDER: await ensureCacheDir(YARN_CACHE_DIR),\n YARN_GLOBAL_FOLDER: await ensureCacheDir(YARN_GLOBAL_DIR),\n npm_config_store: await ensureCacheDir(PNPM_CACHE_BASE_DIR),\n NODE_ENV: 'dev',\n };\n\n let token: string | undefined;\n try {\n ({ token } = hostRules.find({\n hostType: 'github',\n url: 'https://api.github.com/',\n }));\n // v8 ignore next -- TODO: add test #40625\n token = token ? `${token}@` : token;\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn({ err }, 'Error getting token for packageFile');\n }\n const tokenRe = regEx(`${token ?? ''}`, 'g', false);\n for (const npmLock of dirs.npmLockDirs) {\n const lockFileDir = upath.dirname(npmLock);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n const fileName = upath.basename(npmLock);\n logger.debug(`Generating ${fileName} for ${lockFileDir}`);\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.npmLock === npmLock,\n );\n const res = await npm.generateLockFile(\n lockFileDir,\n env,\n fileName,\n config,\n upgrades,\n npmrcContent,\n );\n if (res.error) {\n /* v8 ignore next -- needs test */\n if (res.stderr?.includes('No matching version found for')) {\n for (const upgrade of config.upgrades) {\n if (\n res.stderr.includes(\n `No matching version found for ${upgrade.depName}`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'npm' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n const err = new Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(err, NpmDatasource.id);\n }\n }\n }\n\n artifactErrors.push({\n fileName: npmLock,\n stderr: res.stderr,\n });\n } else if (res.lockFile) {\n if (res.beforeFallback) {\n const message =\n 'npm `--before` could not be enforced because existing locked packages were published after the `minimumReleaseAge` cutoff. This will resolve after the next lock file maintenance run.';\n logger.warn({ npmLock }, message);\n artifactNotices.push({ file: npmLock, message });\n }\n const existingContent = await getFile(\n npmLock,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(`${npmLock} hasn't changed`);\n } else {\n logger.debug(`${npmLock} needs updating`);\n updatedArtifacts.push({\n type: 'addition',\n path: npmLock,\n // TODO: can this be undefined? (#22198)\n\n contents: res.lockFile.replace(tokenRe, ''),\n });\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n }\n\n for (const yarnLock of dirs.yarnLockDirs) {\n const lockFileDir = upath.dirname(yarnLock);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n let yarnRcYmlFilename: string | undefined;\n let existingYarnrcYmlContent: string | undefined | null;\n if (additionalYarnRcYml) {\n yarnRcYmlFilename = getSiblingFileName(yarnLock, '.yarnrc.yml');\n existingYarnrcYmlContent = await readLocalFile(yarnRcYmlFilename, 'utf8');\n // v8 ignore else -- TODO: add test #40625\n if (existingYarnrcYmlContent) {\n try {\n // TODO: use schema (#9610)\n const existingYarnrRcYml = parseSingleYaml<Record<string, unknown>>(\n existingYarnrcYmlContent,\n );\n\n const updatedYarnYrcYml = deepmerge(\n existingYarnrRcYml,\n yarn.fuzzyMatchAdditionalYarnrcYml(\n additionalYarnRcYml,\n existingYarnrRcYml,\n ),\n );\n\n await writeLocalFile(yarnRcYmlFilename, dump(updatedYarnYrcYml));\n logger.debug('Added authentication to .yarnrc.yml');\n } catch (err) {\n logger.warn({ err }, 'Error appending .yarnrc.yml content');\n }\n }\n }\n logger.debug(`Generating yarn.lock for ${lockFileDir}`);\n const lockFileName = upath.join(lockFileDir, 'yarn.lock');\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.yarnLock === yarnLock,\n );\n const res = await yarn.generateLockFile(lockFileDir, env, config, upgrades);\n if (res.error) {\n /* v8 ignore next -- needs test */\n if (res.stderr?.includes(`Couldn't find any versions for`)) {\n for (const upgrade of config.upgrades) {\n if (\n res.stderr.includes(\n `Couldn't find any versions for \\\\\"${upgrade.depName}\\\\\"`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'yarn' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(\n new Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n ),\n NpmDatasource.id,\n );\n }\n }\n }\n\n artifactErrors.push({\n fileName: yarnLock,\n stderr: artifactErrorMessageFromExecError(res, ''),\n });\n } else {\n const existingContent = await getFile(\n lockFileName,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(\"yarn.lock hasn't changed\");\n } else {\n logger.debug('yarn.lock needs updating');\n updatedArtifacts.push({\n type: 'addition',\n path: lockFileName,\n // TODO #22198\n contents: res.lockFile!,\n });\n await updateYarnOffline(lockFileDir, updatedArtifacts);\n }\n\n /* v8 ignore next -- needs test */\n if (upgrades.some(yarn.isYarnUpdate)) {\n existingYarnrcYmlContent = await updateYarnBinary(\n lockFileDir,\n updatedArtifacts,\n existingYarnrcYmlContent,\n );\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n /* v8 ignore next -- needs test */\n if (existingYarnrcYmlContent) {\n // TODO #22198\n await writeLocalFile(yarnRcYmlFilename!, existingYarnrcYmlContent);\n }\n }\n\n for (const pnpmLockFile of dirs.pnpmLockFileDirs) {\n const lockFileDir = upath.dirname(pnpmLockFile);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n logger.debug(`Generating pnpm-lock.yaml for ${lockFileDir}`);\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.pnpmLockFile === pnpmLockFile,\n );\n const res = await pnpm.generateLockFile(lockFileDir, env, config, upgrades);\n if (res.error) {\n /* v8 ignore next -- needs test */\n if (res.stdout?.includes(`No compatible version found:`)) {\n for (const upgrade of config.upgrades) {\n if (\n res.stdout.includes(\n `No compatible version found: ${upgrade.depName}`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'pnpm' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(\n Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n ),\n NpmDatasource.id,\n );\n }\n }\n }\n\n artifactErrors.push({\n fileName: pnpmLockFile,\n stderr: artifactErrorMessageFromExecError(res, ''),\n });\n } else {\n const existingContent = await getFile(\n pnpmLockFile,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(\"pnpm-lock.yaml hasn't changed\");\n } else {\n logger.debug('pnpm-lock.yaml needs updating');\n updatedArtifacts.push({\n type: 'addition',\n path: pnpmLockFile,\n // TODO: can be undefined? (#22198)\n contents: res.lockFile!,\n });\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n }\n\n return { artifactErrors, artifactNotices, updatedArtifacts };\n}\n\nexport async function getAdditionalFiles(\n config: PostUpdateConfig<NpmManagerData>,\n packageFiles: AdditionalPackageFiles,\n): Promise<WriteExistingFilesResult> {\n const originalNpmrcFiles = new Map<string, string>();\n try {\n return await getAdditionalFilesInner(\n config,\n packageFiles,\n originalNpmrcFiles,\n );\n } finally {\n await restoreNpmrcFiles(originalNpmrcFiles);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAS,QAAQ,KAA8C;CAC7D,OAAO,MAAM,KAAK,IAAI,IAAI,IAAI,OAAO,QAAQ,CAAC,C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;KACA,MAAM,IAAI,kBACR,MACE,8EACF,GACA,cAAc,EAChB;IACF;;GAIJ,eAAe,KAAK;IAClB,UAAU;IACV,QAAQ,kCAAkC,KAAK,EAAE;GACnD,CAAC;EACH,OAAO;GACL,MAAM,kBAAkB,MAAM,QAC5B,cACA,OAAO,sBAAsB,OAAO,aAAa,OAAO,UAC1D;GACA,IAAI,IAAI,aAAa,iBACnB,OAAO,MAAM,+BAA+B;QACvC;IACL,OAAO,MAAM,+BAA+B;IAC5C,iBAAiB,KAAK;KACpB,MAAM;KACN,MAAM;KAEN,UAAU,IAAI;IAChB,CAAC;GACH;EACF;EACA,MAAM,kBAAkB,aAAa,YAAY;CACnD;CAEA,OAAO;EAAE;EAAgB;EAAiB;CAAiB;AAC7D;AAEA,eAAsB,mBACpB,QACA,cACmC;CACnC,MAAM,qCAAqB,IAAI,IAAoB;CACnD,IAAI;EACF,OAAO,MAAM,wBACX,QACA,cACA,kBACF;CACF,UAAU;EACR,MAAM,kBAAkB,kBAAkB;CAC5C;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["hostRules.find","npm.generateLockFile","deepmerge","yarn.fuzzyMatchAdditionalYarnrcYml","yarn.generateLockFile","yarn.isYarnUpdate","pnpm.generateLockFile"],"sources":["../../../../../lib/modules/manager/npm/post-update/index.ts"],"sourcesContent":["// TODO: types (#22198)\nimport { isNonEmptyStringAndNotWhitespace, isString } from '@sindresorhus/is';\nimport deepmerge from 'deepmerge';\nimport upath from 'upath';\nimport { logger } from '../../../../logger/index.ts';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error.ts';\nimport { getEnv } from '../../../../util/env.ts';\nimport {\n ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs/index.ts';\nimport { getFile, getRepoStatus } from '../../../../util/git/index.ts';\nimport type { FileChange } from '../../../../util/git/types.ts';\nimport * as hostRules from '../../../../util/host-rules.ts';\nimport { newlineRegex, regEx } from '../../../../util/regex.ts';\nimport { ensureTrailingSlash } from '../../../../util/url.ts';\nimport { dump, parseSingleYaml } from '../../../../util/yaml.ts';\nimport { NpmDatasource } from '../../../datasource/npm/index.ts';\nimport { scm } from '../../../platform/scm.ts';\nimport type {\n ArtifactError,\n ArtifactNotice,\n PackageFile,\n PostUpdateConfig,\n Upgrade,\n} from '../../types.ts';\nimport { artifactErrorMessageFromExecError } from '../../util.ts';\nimport {\n NPM_CACHE_DIR,\n PNPM_CACHE_BASE_DIR,\n YARN_CACHE_DIR,\n YARN_GLOBAL_DIR,\n} from '../constants.ts';\nimport { getZeroInstallPaths } from '../extract/yarn.ts';\nimport type { NpmManagerData } from '../types.ts';\nimport {\n composeLockFile,\n parseLockFile,\n withNpmrcHostRules,\n} from '../utils.ts';\nimport * as npm from './npm.ts';\nimport * as pnpm from './pnpm.ts';\nimport { processHostRules } from './rules.ts';\nimport type {\n AdditionalPackageFiles,\n DetermineLockFileDirsResult,\n WriteExistingFilesResult,\n YarnRcYmlFile,\n} from './types.ts';\nimport * as yarn from './yarn.ts';\n\n// Strips empty values, deduplicates, and returns the directories from filenames\nfunction getDirs(arr: (string | null | undefined)[]): string[] {\n return Array.from(new Set(arr.filter(isString)));\n}\n\nexport function determineLockFileDirs(\n config: PostUpdateConfig,\n packageFiles: AdditionalPackageFiles,\n): DetermineLockFileDirsResult {\n const npmLockDirs: (string | undefined)[] = [];\n const yarnLockDirs: (string | undefined)[] = [];\n const pnpmLockFileDirs: (string | undefined)[] = [];\n\n for (const upgrade of config.upgrades) {\n // v8 ignore else -- TODO: add test #40625\n if (\n upgrade.updateType === 'lockFileMaintenance' ||\n upgrade.isRemediation === true ||\n upgrade.isLockfileUpdate === true\n ) {\n yarnLockDirs.push(upgrade.managerData?.yarnLock);\n npmLockDirs.push(upgrade.managerData?.npmLock);\n pnpmLockFileDirs.push(upgrade.managerData?.pnpmLockFile);\n }\n }\n\n if (\n config.upgrades.every(\n (upgrade: Upgrade) =>\n upgrade.updateType === 'lockFileMaintenance' ||\n upgrade.isLockfileUpdate,\n )\n ) {\n return {\n yarnLockDirs: getDirs(yarnLockDirs),\n npmLockDirs: getDirs(npmLockDirs),\n pnpmLockFileDirs: getDirs(pnpmLockFileDirs),\n };\n }\n\n function getPackageFile(\n fileName: string,\n ): Partial<PackageFile<NpmManagerData>> {\n logger.trace(`Looking for packageFile: ${fileName}`);\n\n for (const packageFile of packageFiles.npm!) {\n if (packageFile.packageFile === fileName) {\n logger.trace({ packageFile }, 'Found packageFile');\n return packageFile;\n }\n logger.trace('No match');\n }\n return {};\n }\n\n // TODO #22198\n for (const p of config.updatedPackageFiles!) {\n logger.trace(`Checking ${String(p.path)} for lock files`);\n const packageFile = getPackageFile(p.path);\n /* v8 ignore next -- needs test */\n if (!packageFile.managerData) {\n continue;\n }\n // push full lock file names and convert them later\n yarnLockDirs.push(packageFile.managerData.yarnLock);\n npmLockDirs.push(packageFile.managerData.npmLock);\n pnpmLockFileDirs.push(packageFile.managerData.pnpmLockFile);\n }\n\n return {\n yarnLockDirs: getDirs(yarnLockDirs),\n npmLockDirs: getDirs(npmLockDirs),\n pnpmLockFileDirs: getDirs(pnpmLockFileDirs),\n };\n}\n\nexport async function writeExistingFiles(\n config: PostUpdateConfig,\n packageFiles: AdditionalPackageFiles,\n originalNpmrcFiles = new Map<string, string>(),\n): Promise<void> {\n if (!packageFiles.npm) {\n return;\n }\n const npmFiles = packageFiles.npm;\n logger.debug(\n { packageFiles: npmFiles.map((n) => n.packageFile) },\n 'Writing package.json files',\n );\n for (const packageFile of npmFiles) {\n /* v8 ignore if -- TODO: add test #40625 */\n if (!packageFile.managerData) {\n continue;\n }\n // TODO #22198\n const basedir = upath.dirname(packageFile.packageFile!);\n const npmrc = packageFile.npmrc;\n const npmrcFilename = upath.join(basedir, '.npmrc');\n // Write out the file unless the npmrc came from the workspace\n // npmrcFilename will be set whenever the file was read from disk during extract\n if (\n isString(npmrc) &&\n (npmrcFilename === packageFile.managerData.npmrcFileName ||\n !packageFile.managerData.npmrcFileName)\n ) {\n try {\n if (!originalNpmrcFiles.has(npmrcFilename)) {\n const originalNpmrc = await readLocalFile(npmrcFilename, 'utf8');\n if (isString(originalNpmrc)) {\n originalNpmrcFiles.set(npmrcFilename, originalNpmrc);\n }\n }\n await writeLocalFile(npmrcFilename, npmrc.replace(regEx(/\\n?$/), '\\n'));\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn({ npmrcFilename, err }, 'Error writing .npmrc');\n }\n }\n const npmLock = packageFile.managerData.npmLock;\n if (npmLock) {\n const npmLockPath = npmLock;\n logger.debug(`Writing ${npmLock}`);\n let existingNpmLock: string;\n try {\n existingNpmLock = (await getFile(npmLock)) ?? '';\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn({ err }, 'Error reading npm lock file');\n existingNpmLock = '';\n }\n const { detectedIndent, lockFileParsed: npmLockParsed } =\n parseLockFile(existingNpmLock);\n if (npmLockParsed) {\n const packageNames =\n 'packages' in npmLockParsed\n ? Object.keys(npmLockParsed.packages)\n : [];\n const widens: string[] = [];\n let lockFileChanged = false;\n for (const upgrade of config.upgrades) {\n if (upgrade.lockFiles && !upgrade.lockFiles.includes(npmLock)) {\n continue;\n }\n if (!upgrade.managerData) {\n continue;\n }\n if (\n upgrade.rangeStrategy === 'widen' &&\n upgrade.managerData.npmLock === npmLock\n ) {\n // TODO #22198\n widens.push(upgrade.depName!);\n }\n const { depName } = upgrade;\n const oldVersion = upgrade.lockedVersion ?? upgrade.currentVersion;\n if ('packages' in npmLockParsed) {\n for (const packageName of packageNames) {\n if (\n packageName === `node_modules/${depName}` ||\n packageName.startsWith(`node_modules/${depName}/`)\n ) {\n logger.trace({ packageName }, 'Massaging out package name');\n lockFileChanged = true;\n delete npmLockParsed.packages[packageName];\n continue;\n }\n if (\n !depName ||\n !oldVersion ||\n // Workspace entries (e.g. `packages/app`) and the root entry\n // are link targets: `node_modules/<name>` points at them with\n // `link: true`, so deleting one breaks npm with EMISSINGTARGET.\n !packageName.startsWith('node_modules/')\n ) {\n continue;\n }\n // Lockstep monorepo siblings (e.g. vue -> @vue/server-renderer)\n // pin the updated dep to its exact old version. Left in the lock\n // they cannot resolve against the new version and npm fails with\n // ERESOLVE, so massage them out too and let npm re-resolve them.\n const entry = npmLockParsed.packages[packageName];\n const pinned =\n entry?.peerDependencies?.[depName] === oldVersion ||\n entry?.dependencies?.[depName] === oldVersion ||\n entry?.optionalDependencies?.[depName] === oldVersion;\n if (pinned) {\n logger.trace(\n { packageName, depName, oldVersion },\n 'Massaging out lockstep sibling',\n );\n lockFileChanged = true;\n delete npmLockParsed.packages[packageName];\n }\n }\n }\n }\n // v8 ignore else -- TODO: add test #40625\n if (widens.length) {\n logger.debug(\n `Removing ${String(widens)} from ${npmLock} to force an update`,\n );\n lockFileChanged = true;\n try {\n if ('dependencies' in npmLockParsed && npmLockParsed.dependencies) {\n widens.forEach((depName) => {\n // TODO #22198\n delete npmLockParsed.dependencies![depName];\n });\n }\n } catch /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn(\n { npmLock },\n 'Error massaging package-lock.json for widen',\n );\n }\n }\n // v8 ignore else -- TODO: add test #40625\n if (lockFileChanged) {\n logger.debug('Massaging npm lock file before writing to disk');\n existingNpmLock = composeLockFile(npmLockParsed, detectedIndent);\n }\n await writeLocalFile(npmLockPath, existingNpmLock);\n }\n }\n }\n}\n\nasync function restoreNpmrcFiles(\n originalNpmrcFiles: Map<string, string>,\n): Promise<void> {\n for (const [npmrcFilename, originalNpmrc] of originalNpmrcFiles) {\n try {\n await writeLocalFile(npmrcFilename, originalNpmrc);\n } catch (err) {\n logger.warn({ npmrcFilename, err }, 'Error restoring .npmrc');\n }\n }\n}\n\nexport async function writeUpdatedPackageFiles(\n config: PostUpdateConfig,\n): Promise<void> {\n logger.trace({ config }, 'writeUpdatedPackageFiles');\n logger.debug('Writing any updated package files');\n if (!config.updatedPackageFiles) {\n logger.debug('No files found');\n return;\n }\n // prefer artifact content when it updates the same file (e.g. pnpm-workspace.yaml)\n const artifactContents = new Map<string, string>();\n if (config.updatedArtifacts) {\n for (const artifact of config.updatedArtifacts) {\n if (artifact.type === 'addition' && artifact.contents) {\n artifactContents.set(artifact.path, artifact.contents.toString());\n }\n }\n }\n const supportedLockFiles = ['package-lock.json', 'yarn.lock'];\n for (const packageFile of config.updatedPackageFiles) {\n if (packageFile.type !== 'addition') {\n continue;\n }\n if (\n supportedLockFiles.some((fileName) => packageFile.path.endsWith(fileName))\n ) {\n logger.debug(`Writing lock file: ${packageFile.path}`);\n // TODO #22198\n\n await writeLocalFile(packageFile.path, packageFile.contents!);\n continue;\n }\n if (!(\n packageFile.path.endsWith('package.json') ||\n packageFile.path.endsWith('pnpm-workspace.yaml') ||\n packageFile.path.endsWith('.yarnrc.yml')\n )) {\n continue;\n }\n const contents =\n artifactContents.get(packageFile.path) ?? packageFile.contents!;\n logger.debug(`Writing ${packageFile.path}`);\n await writeLocalFile(packageFile.path, contents);\n }\n}\n\n/* v8 ignore next -- needs test */\nasync function updateYarnOffline(\n lockFileDir: string,\n updatedArtifacts: FileChange[],\n): Promise<void> {\n try {\n const resolvedPaths: string[] = [];\n const yarnrcYml = await getFile(upath.join(lockFileDir, '.yarnrc.yml'));\n const yarnrc = await getFile(upath.join(lockFileDir, '.yarnrc'));\n\n // As .yarnrc.yml overrides .yarnrc in Yarn 1 (https://git.io/JUcco)\n // both files may exist, so check for .yarnrc.yml first\n if (yarnrcYml) {\n // Yarn 2 (offline cache and zero-installs)\n const paths = getZeroInstallPaths(yarnrcYml);\n resolvedPaths.push(...paths.map((p) => upath.join(lockFileDir, p)));\n } else if (yarnrc) {\n // Yarn 1 (offline mirror)\n const mirrorLine = yarnrc\n .split(newlineRegex)\n .find((line) => line.startsWith('yarn-offline-mirror '));\n if (mirrorLine) {\n const mirrorPath = ensureTrailingSlash(\n mirrorLine.split(' ')[1].replace(regEx(/\"/g), ''),\n );\n resolvedPaths.push(upath.join(lockFileDir, mirrorPath));\n }\n }\n logger.debug({ resolvedPaths }, 'updateYarnOffline resolvedPaths');\n\n if (resolvedPaths.length) {\n const status = await getRepoStatus();\n for (const f of status.modified.concat(status.not_added)) {\n if (resolvedPaths.some((p) => f.startsWith(p))) {\n updatedArtifacts.push({\n type: 'addition',\n path: f,\n contents: await readLocalFile(f),\n });\n }\n }\n for (const f of status.deleted || []) {\n if (resolvedPaths.some((p) => f.startsWith(p))) {\n updatedArtifacts.push({ type: 'deletion', path: f });\n }\n }\n }\n } catch (err) {\n logger.error({ err }, 'Error updating yarn offline packages');\n }\n}\n\n// TODO: move to ./yarn.ts\n// exported for testing\nexport async function updateYarnBinary(\n lockFileDir: string,\n updatedArtifacts: FileChange[],\n existingYarnrcYmlContent: string | undefined | null,\n): Promise<string | undefined | null> {\n let yarnrcYml = existingYarnrcYmlContent;\n try {\n const yarnrcYmlFilename = upath.join(lockFileDir, '.yarnrc.yml');\n yarnrcYml ??= (await getFile(yarnrcYmlFilename)) ?? undefined;\n const newYarnrcYml = await readLocalFile(yarnrcYmlFilename, 'utf8');\n if (!isString(yarnrcYml) || !isString(newYarnrcYml)) {\n return existingYarnrcYmlContent;\n }\n\n // TODO: use schema (#9610)\n const oldYarnPath = parseSingleYaml<YarnRcYmlFile>(yarnrcYml)?.yarnPath;\n const newYarnPath = parseSingleYaml<YarnRcYmlFile>(newYarnrcYml)?.yarnPath;\n if (\n !isNonEmptyStringAndNotWhitespace(oldYarnPath) ||\n !isNonEmptyStringAndNotWhitespace(newYarnPath)\n ) {\n return existingYarnrcYmlContent;\n }\n\n const oldYarnFullPath = upath.join(lockFileDir, oldYarnPath);\n const newYarnFullPath = upath.join(lockFileDir, newYarnPath);\n logger.debug({ oldYarnPath, newYarnPath }, 'Found updated Yarn binary');\n\n yarnrcYml = yarnrcYml.replace(oldYarnPath, newYarnPath);\n updatedArtifacts.push(\n {\n type: 'addition',\n path: yarnrcYmlFilename,\n contents: yarnrcYml,\n },\n {\n type: 'deletion',\n path: oldYarnFullPath,\n },\n {\n type: 'addition',\n path: newYarnFullPath,\n contents: await readLocalFile(newYarnFullPath, 'utf8'),\n isExecutable: true,\n },\n );\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.error({ err }, 'Error updating Yarn binary');\n }\n return existingYarnrcYmlContent && yarnrcYml;\n}\n\nasync function getAdditionalFilesInner(\n config: PostUpdateConfig<NpmManagerData>,\n packageFiles: AdditionalPackageFiles,\n originalNpmrcFiles: Map<string, string>,\n): Promise<WriteExistingFilesResult> {\n logger.trace({ config }, 'getAdditionalFiles');\n const artifactErrors: ArtifactError[] = [];\n const artifactNotices: ArtifactNotice[] = [];\n const updatedArtifacts: FileChange[] = [];\n if (!packageFiles.npm?.length) {\n return { artifactErrors, artifactNotices, updatedArtifacts };\n }\n if (config.skipArtifactsUpdate) {\n logger.debug('Skipping lock file generation');\n return { artifactErrors, artifactNotices, updatedArtifacts };\n }\n logger.debug('Getting updated lock files');\n if (\n config.isLockFileMaintenance &&\n config.reuseExistingBranch &&\n (await scm.branchExists(config.branchName))\n ) {\n logger.debug('Skipping lockFileMaintenance update');\n return { artifactErrors, artifactNotices, updatedArtifacts };\n }\n const dirs = determineLockFileDirs(config, packageFiles);\n logger.trace({ dirs }, 'lock file dirs');\n await writeExistingFiles(config, packageFiles, originalNpmrcFiles);\n await writeUpdatedPackageFiles(config);\n\n const { additionalNpmrcContent, additionalYarnRcYml } = processHostRules();\n\n // This isn't passed directly to the child process, so no need to filter.\n // But pass custom env and user vars.\n const env = {\n ...getEnv(),\n NPM_CONFIG_CACHE: await ensureCacheDir(NPM_CACHE_DIR),\n YARN_CACHE_FOLDER: await ensureCacheDir(YARN_CACHE_DIR),\n YARN_GLOBAL_FOLDER: await ensureCacheDir(YARN_GLOBAL_DIR),\n npm_config_store: await ensureCacheDir(PNPM_CACHE_BASE_DIR),\n NODE_ENV: 'dev',\n };\n\n let token: string | undefined;\n try {\n ({ token } = hostRules.find({\n hostType: 'github',\n url: 'https://api.github.com/',\n }));\n // v8 ignore next -- TODO: add test #40625\n token = token ? `${token}@` : token;\n } catch (err) /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn({ err }, 'Error getting token for packageFile');\n }\n const tokenRe = regEx(`${token ?? ''}`, 'g', false);\n for (const npmLock of dirs.npmLockDirs) {\n const lockFileDir = upath.dirname(npmLock);\n await withNpmrcHostRules(\n lockFileDir,\n additionalNpmrcContent,\n async (npmrcContent) => {\n const fileName = upath.basename(npmLock);\n logger.debug(`Generating ${fileName} for ${lockFileDir}`);\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.npmLock === npmLock,\n );\n const res = await npm.generateLockFile(\n lockFileDir,\n env,\n fileName,\n config,\n upgrades,\n npmrcContent,\n );\n if (res.error) {\n /* v8 ignore next -- needs test */\n if (res.stderr?.includes('No matching version found for')) {\n for (const upgrade of config.upgrades) {\n if (\n res.stderr.includes(\n `No matching version found for ${upgrade.depName}`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'npm' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n const err = new Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(err, NpmDatasource.id);\n }\n }\n }\n\n artifactErrors.push({\n fileName: npmLock,\n stderr: res.stderr,\n });\n } else if (res.lockFile) {\n if (res.beforeFallback) {\n const message =\n 'npm `--before` could not be enforced because existing locked packages were published after the `minimumReleaseAge` cutoff. This will resolve after the next lock file maintenance run.';\n logger.warn({ npmLock }, message);\n artifactNotices.push({ file: npmLock, message });\n }\n const existingContent = await getFile(\n npmLock,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(`${npmLock} hasn't changed`);\n } else {\n logger.debug(`${npmLock} needs updating`);\n updatedArtifacts.push({\n type: 'addition',\n path: npmLock,\n // TODO: can this be undefined? (#22198)\n\n contents: res.lockFile.replace(tokenRe, ''),\n });\n }\n }\n },\n );\n }\n\n for (const yarnLock of dirs.yarnLockDirs) {\n const lockFileDir = upath.dirname(yarnLock);\n let yarnRcYmlFilename: string | undefined;\n let existingYarnrcYmlContent: string | undefined | null;\n await withNpmrcHostRules(lockFileDir, additionalNpmrcContent, async () => {\n if (additionalYarnRcYml) {\n yarnRcYmlFilename = getSiblingFileName(yarnLock, '.yarnrc.yml');\n existingYarnrcYmlContent = await readLocalFile(\n yarnRcYmlFilename,\n 'utf8',\n );\n // v8 ignore else -- TODO: add test #40625\n if (existingYarnrcYmlContent) {\n try {\n // TODO: use schema (#9610)\n const existingYarnrRcYml = parseSingleYaml<Record<string, unknown>>(\n existingYarnrcYmlContent,\n );\n\n const updatedYarnYrcYml = deepmerge(\n existingYarnrRcYml,\n yarn.fuzzyMatchAdditionalYarnrcYml(\n additionalYarnRcYml,\n existingYarnrRcYml,\n ),\n );\n\n await writeLocalFile(yarnRcYmlFilename, dump(updatedYarnYrcYml));\n logger.debug('Added authentication to .yarnrc.yml');\n } catch (err) {\n logger.warn({ err }, 'Error appending .yarnrc.yml content');\n }\n }\n }\n logger.debug(`Generating yarn.lock for ${lockFileDir}`);\n const lockFileName = upath.join(lockFileDir, 'yarn.lock');\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.yarnLock === yarnLock,\n );\n const res = await yarn.generateLockFile(\n lockFileDir,\n env,\n config,\n upgrades,\n );\n if (res.error) {\n /* v8 ignore next -- needs test */\n if (res.stderr?.includes(`Couldn't find any versions for`)) {\n for (const upgrade of config.upgrades) {\n if (\n res.stderr.includes(\n `Couldn't find any versions for \\\\\"${upgrade.depName}\\\\\"`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'yarn' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(\n new Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n ),\n NpmDatasource.id,\n );\n }\n }\n }\n\n artifactErrors.push({\n fileName: yarnLock,\n stderr: artifactErrorMessageFromExecError(res, ''),\n });\n } else {\n const existingContent = await getFile(\n lockFileName,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(\"yarn.lock hasn't changed\");\n } else {\n logger.debug('yarn.lock needs updating');\n updatedArtifacts.push({\n type: 'addition',\n path: lockFileName,\n // TODO #22198\n contents: res.lockFile!,\n });\n await updateYarnOffline(lockFileDir, updatedArtifacts);\n }\n\n /* v8 ignore next -- needs test */\n if (upgrades.some(yarn.isYarnUpdate)) {\n existingYarnrcYmlContent = await updateYarnBinary(\n lockFileDir,\n updatedArtifacts,\n existingYarnrcYmlContent,\n );\n }\n }\n });\n /* v8 ignore next -- needs test */\n if (existingYarnrcYmlContent) {\n // TODO #22198\n await writeLocalFile(yarnRcYmlFilename!, existingYarnrcYmlContent);\n }\n }\n\n for (const pnpmLockFile of dirs.pnpmLockFileDirs) {\n const lockFileDir = upath.dirname(pnpmLockFile);\n await withNpmrcHostRules(lockFileDir, additionalNpmrcContent, async () => {\n logger.debug(`Generating pnpm-lock.yaml for ${lockFileDir}`);\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.pnpmLockFile === pnpmLockFile,\n );\n const res = await pnpm.generateLockFile(\n lockFileDir,\n env,\n config,\n upgrades,\n );\n if (res.error) {\n /* v8 ignore next -- needs test */\n if (res.stdout?.includes(`No compatible version found:`)) {\n for (const upgrade of config.upgrades) {\n if (\n res.stdout.includes(\n `No compatible version found: ${upgrade.depName}`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'pnpm' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(\n Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n ),\n NpmDatasource.id,\n );\n }\n }\n }\n\n artifactErrors.push({\n fileName: pnpmLockFile,\n stderr: artifactErrorMessageFromExecError(res, ''),\n });\n } else {\n const existingContent = await getFile(\n pnpmLockFile,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(\"pnpm-lock.yaml hasn't changed\");\n } else {\n logger.debug('pnpm-lock.yaml needs updating');\n updatedArtifacts.push({\n type: 'addition',\n path: pnpmLockFile,\n // TODO: can be undefined? (#22198)\n contents: res.lockFile!,\n });\n }\n }\n });\n }\n\n return { artifactErrors, artifactNotices, updatedArtifacts };\n}\n\nexport async function getAdditionalFiles(\n config: PostUpdateConfig<NpmManagerData>,\n packageFiles: AdditionalPackageFiles,\n): Promise<WriteExistingFilesResult> {\n const originalNpmrcFiles = new Map<string, string>();\n try {\n return await getAdditionalFilesInner(\n config,\n packageFiles,\n originalNpmrcFiles,\n );\n } finally {\n await restoreNpmrcFiles(originalNpmrcFiles);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAS,QAAQ,KAA8C;CAC7D,OAAO,MAAM,KAAK,IAAI,IAAI,IAAI,OAAO,QAAQ,CAAC,CAAC;AACjD;AAEA,SAAgB,sBACd,QACA,cAC6B;CAC7B,MAAM,cAAsC,CAAC;CAC7C,MAAM,eAAuC,CAAC;CAC9C,MAAM,mBAA2C,CAAC;CAElD,KAAK,MAAM,WAAW,OAAO;;CAE3B,IACE,QAAQ,eAAe,yBACvB,QAAQ,kBAAkB,QAC1B,QAAQ,qBAAqB,MAC7B;EACA,aAAa,KAAK,QAAQ,aAAa,QAAQ;EAC/C,YAAY,KAAK,QAAQ,aAAa,OAAO;EAC7C,iBAAiB,KAAK,QAAQ,aAAa,YAAY;CACzD;CAGF,IACE,OAAO,SAAS,OACb,YACC,QAAQ,eAAe,yBACvB,QAAQ,gBACZ,GAEA,OAAO;EACL,cAAc,QAAQ,YAAY;EAClC,aAAa,QAAQ,WAAW;EAChC,kBAAkB,QAAQ,gBAAgB;CAC5C;CAGF,SAAS,eACP,UACsC;EACtC,OAAO,MAAM,4BAA4B,UAAU;EAEnD,KAAK,MAAM,eAAe,aAAa,KAAM;GAC3C,IAAI,YAAY,gBAAgB,UAAU;IACxC,OAAO,MAAM,EAAE,YAAY,GAAG,mBAAmB;IACjD,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AiC,aAAa;GAC3D,MAAM,WAAW,OAAO,SAAS,QAC9B,YAAY,QAAQ,aAAa,iBAAiB,YACrD;GACA,MAAM,MAAM,MAAMC,mBAChB,aACA,KACA,QACA,QACF;GACA,IAAI,IAAI,OAAO;;IAEb,IAAI,IAAI,QAAQ,SAAS,8BAA8B,GAChD;UAAA,MAAM,WAAW,OAAO,UAC3B,IACE,IAAI,OAAO,SACT,gCAAgC,QAAQ,SAC1C,GACA;MACA,OAAO,MACL;OAAE,YAAY,QAAQ;OAAS,MAAM;MAAO,GAC5C,8EACF;MACA,MAAM,IAAI,kBACR,MACE,8EACF,GACA,cAAc,EAChB;KACF;;IAIJ,eAAe,KAAK;KAClB,UAAU;KACV,QAAQ,kCAAkC,KAAK,EAAE;IACnD,CAAC;GACH,OAAO;IACL,MAAM,kBAAkB,MAAM,QAC5B,cACA,OAAO,sBAAsB,OAAO,aAAa,OAAO,UAC1D;IACA,IAAI,IAAI,aAAa,iBACnB,OAAO,MAAM,+BAA+B;SACvC;KACL,OAAO,MAAM,+BAA+B;KAC5C,iBAAiB,KAAK;MACpB,MAAM;MACN,MAAM;MAEN,UAAU,IAAI;KAChB,CAAC;IACH;GACF;EACF,CAAC;CACH;CAEA,OAAO;EAAE;EAAgB;EAAiB;CAAiB;AAC7D;AAEA,eAAsB,mBACpB,QACA,cACmC;CACnC,MAAM,qCAAqB,IAAI,IAAoB;CACnD,IAAI;EACF,OAAO,MAAM,wBACX,QACA,cACA,kBACF;CACF,UAAU;EACR,MAAM,kBAAkB,kBAAkB;CAC5C;AACF"}
|
|
@@ -58,6 +58,20 @@ async function resetNpmrcContent(dir, originalContent) {
|
|
|
58
58
|
logger.warn("Unable to delete custom npmrc");
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Add the host-rule lines to the `.npmrc` in `dir`, run `fn`, and restore the original `.npmrc` afterwards.
|
|
63
|
+
*
|
|
64
|
+
* The restore runs in a `finally`, so a package manager that throws cannot leave the injected credentials behind in the working tree.
|
|
65
|
+
*/
|
|
66
|
+
async function withNpmrcHostRules(dir, additionalLines, fn) {
|
|
67
|
+
const originalContent = await getNpmrcContent(dir);
|
|
68
|
+
await updateNpmrcContent(dir, originalContent, additionalLines);
|
|
69
|
+
try {
|
|
70
|
+
return await fn(originalContent);
|
|
71
|
+
} finally {
|
|
72
|
+
await resetNpmrcContent(dir, originalContent);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
61
75
|
async function loadPackageJson(parentDir) {
|
|
62
76
|
const json = await readLocalFile(upath.join(parentDir, "package.json"), "utf8");
|
|
63
77
|
const res = PackageJson.safeParse(json);
|
|
@@ -65,6 +79,6 @@ async function loadPackageJson(parentDir) {
|
|
|
65
79
|
return {};
|
|
66
80
|
}
|
|
67
81
|
//#endregion
|
|
68
|
-
export { composeLockFile, getNpmrcContent, loadPackageJson, parseLockFile, resetNpmrcContent, updateNpmrcContent };
|
|
82
|
+
export { composeLockFile, getNpmrcContent, loadPackageJson, parseLockFile, resetNpmrcContent, updateNpmrcContent, withNpmrcHostRules };
|
|
69
83
|
|
|
70
84
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../../lib/modules/manager/npm/utils.ts"],"sourcesContent":["import detectIndent from 'detect-indent';\nimport upath from 'upath';\nimport { logger } from '../../../logger/index.ts';\nimport {\n deleteLocalFile,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\n\nimport { PackageJson } from './schema.ts';\nimport type { LockFile, ParseLockFileResult } from './types.ts';\n\nexport function parseLockFile(lockFile: string): ParseLockFileResult {\n const detectedIndent = detectIndent(lockFile).indent || ' ';\n\n let lockFileParsed: LockFile | undefined;\n try {\n lockFileParsed = JSON.parse(lockFile);\n } catch (err) {\n logger.warn({ err }, 'Error parsing npm lock file');\n }\n\n return { detectedIndent, lockFileParsed };\n}\n\nexport function composeLockFile(lockFile: LockFile, indent: string): string {\n return `${JSON.stringify(lockFile, null, indent)}\\n`;\n}\n\nexport async function getNpmrcContent(dir: string): Promise<string | null> {\n const npmrcFilePath = upath.join(dir, '.npmrc');\n let originalNpmrcContent: string | null = null;\n try {\n originalNpmrcContent = await readLocalFile(npmrcFilePath, 'utf8');\n } catch {\n /* v8 ignore next -- needs test */\n originalNpmrcContent = null;\n }\n if (originalNpmrcContent) {\n logger.debug(`npmrc file ${npmrcFilePath} found in repository`);\n }\n return originalNpmrcContent;\n}\n\nexport async function updateNpmrcContent(\n dir: string,\n originalContent: string | null,\n additionalLines: string[],\n): Promise<void> {\n const npmrcFilePath = upath.join(dir, '.npmrc');\n const newNpmrc = originalContent\n ? [originalContent, ...additionalLines]\n : additionalLines;\n try {\n const newContent = newNpmrc.length ? newNpmrc.join('\\n') : null;\n if (newContent !== originalContent) {\n logger.debug(`Writing updated .npmrc file to ${npmrcFilePath}`);\n await writeLocalFile(npmrcFilePath, `${newContent}\\n`);\n }\n } catch /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn('Unable to write custom npmrc file');\n }\n}\n\nexport async function resetNpmrcContent(\n dir: string,\n originalContent: string | null,\n): Promise<void> {\n const npmrcFilePath = upath.join(dir, '.npmrc');\n if (originalContent) {\n try {\n await writeLocalFile(npmrcFilePath, originalContent);\n } catch /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn('Unable to reset npmrc to original contents');\n }\n } else {\n try {\n await deleteLocalFile(npmrcFilePath);\n } catch /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn('Unable to delete custom npmrc');\n }\n }\n}\n\nexport async function loadPackageJson(parentDir: string): Promise<PackageJson> {\n const json = await readLocalFile(\n upath.join(parentDir, 'package.json'),\n 'utf8',\n );\n const res = PackageJson.safeParse(json);\n if (res.success) {\n return res.data;\n }\n return {};\n}\n"],"mappings":";;;;;;AAYA,SAAgB,cAAc,UAAuC;CACnE,MAAM,iBAAiB,aAAa,QAAQ,CAAC,CAAC,UAAU;CAExD,IAAI;CACJ,I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MAAM,YAAY,UAAU,IAAI;CACtC,IAAI,IAAI,SACN,OAAO,IAAI;CAEb,OAAO,CAAC;AACV"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../../lib/modules/manager/npm/utils.ts"],"sourcesContent":["import detectIndent from 'detect-indent';\nimport upath from 'upath';\nimport { logger } from '../../../logger/index.ts';\nimport {\n deleteLocalFile,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\n\nimport { PackageJson } from './schema.ts';\nimport type { LockFile, ParseLockFileResult } from './types.ts';\n\nexport function parseLockFile(lockFile: string): ParseLockFileResult {\n const detectedIndent = detectIndent(lockFile).indent || ' ';\n\n let lockFileParsed: LockFile | undefined;\n try {\n lockFileParsed = JSON.parse(lockFile);\n } catch (err) {\n logger.warn({ err }, 'Error parsing npm lock file');\n }\n\n return { detectedIndent, lockFileParsed };\n}\n\nexport function composeLockFile(lockFile: LockFile, indent: string): string {\n return `${JSON.stringify(lockFile, null, indent)}\\n`;\n}\n\nexport async function getNpmrcContent(dir: string): Promise<string | null> {\n const npmrcFilePath = upath.join(dir, '.npmrc');\n let originalNpmrcContent: string | null = null;\n try {\n originalNpmrcContent = await readLocalFile(npmrcFilePath, 'utf8');\n } catch {\n /* v8 ignore next -- needs test */\n originalNpmrcContent = null;\n }\n if (originalNpmrcContent) {\n logger.debug(`npmrc file ${npmrcFilePath} found in repository`);\n }\n return originalNpmrcContent;\n}\n\nexport async function updateNpmrcContent(\n dir: string,\n originalContent: string | null,\n additionalLines: string[],\n): Promise<void> {\n const npmrcFilePath = upath.join(dir, '.npmrc');\n const newNpmrc = originalContent\n ? [originalContent, ...additionalLines]\n : additionalLines;\n try {\n const newContent = newNpmrc.length ? newNpmrc.join('\\n') : null;\n if (newContent !== originalContent) {\n logger.debug(`Writing updated .npmrc file to ${npmrcFilePath}`);\n await writeLocalFile(npmrcFilePath, `${newContent}\\n`);\n }\n } catch /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn('Unable to write custom npmrc file');\n }\n}\n\nexport async function resetNpmrcContent(\n dir: string,\n originalContent: string | null,\n): Promise<void> {\n const npmrcFilePath = upath.join(dir, '.npmrc');\n if (originalContent) {\n try {\n await writeLocalFile(npmrcFilePath, originalContent);\n } catch /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn('Unable to reset npmrc to original contents');\n }\n } else {\n try {\n await deleteLocalFile(npmrcFilePath);\n } catch /* v8 ignore next -- TODO: add test #40625 */ {\n logger.warn('Unable to delete custom npmrc');\n }\n }\n}\n\n/**\n * Add the host-rule lines to the `.npmrc` in `dir`, run `fn`, and restore the original `.npmrc` afterwards.\n *\n * The restore runs in a `finally`, so a package manager that throws cannot leave the injected credentials behind in the working tree.\n */\nexport async function withNpmrcHostRules<T>(\n dir: string,\n additionalLines: string[],\n fn: (originalNpmrcContent: string | null) => Promise<T>,\n): Promise<T> {\n const originalContent = await getNpmrcContent(dir);\n await updateNpmrcContent(dir, originalContent, additionalLines);\n try {\n return await fn(originalContent);\n } finally {\n await resetNpmrcContent(dir, originalContent);\n }\n}\n\nexport async function loadPackageJson(parentDir: string): Promise<PackageJson> {\n const json = await readLocalFile(\n upath.join(parentDir, 'package.json'),\n 'utf8',\n );\n const res = PackageJson.safeParse(json);\n if (res.success) {\n return res.data;\n }\n return {};\n}\n"],"mappings":";;;;;;AAYA,SAAgB,cAAc,UAAuC;CACnE,MAAM,iBAAiB,aAAa,QAAQ,CAAC,CAAC,UAAU;CAExD,IAAI;CACJ,IAAI;EACF,iBAAiB,KAAK,MAAM,QAAQ;CACtC,SAAS,KAAK;EACZ,OAAO,KAAK,EAAE,IAAI,GAAG,6BAA6B;CACpD;CAEA,OAAO;EAAE;EAAgB;CAAe;AAC1C;AAEA,SAAgB,gBAAgB,UAAoB,QAAwB;CAC1E,OAAO,GAAG,KAAK,UAAU,UAAU,MAAM,MAAM,EAAE;AACnD;AAEA,eAAsB,gBAAgB,KAAqC;CACzE,MAAM,gBAAgB,MAAM,KAAK,KAAK,Q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@@ -286,8 +286,12 @@ interface UpdateArtifact<T = Record<string, unknown>> {
|
|
|
286
286
|
interface UpdateLockFileConfig {
|
|
287
287
|
/** The lock file which the update regenerates. */
|
|
288
288
|
lockFileName: string;
|
|
289
|
-
/**
|
|
290
|
-
|
|
289
|
+
/**
|
|
290
|
+
* Content of the lock file before the update, null when it did not exist.
|
|
291
|
+
* Pass a Buffer for lock files which may be binary, the new content is then
|
|
292
|
+
* compared and returned as bytes as well.
|
|
293
|
+
*/
|
|
294
|
+
existingLockFileContent: string | Buffer | null;
|
|
291
295
|
/** Package file to rewrite before the update runs. */
|
|
292
296
|
packageFile?: {
|
|
293
297
|
path: string;
|
|
@@ -118,17 +118,24 @@ async function updateLockFile({ lockFileName, existingLockFileContent, packageFi
|
|
|
118
118
|
if (packageFile) await writeLocalFile(packageFile.path, packageFile.contents);
|
|
119
119
|
if (deleteLockFile) await deleteLocalFile(lockFileName);
|
|
120
120
|
await run();
|
|
121
|
-
const newLockFileContent = await
|
|
121
|
+
const newLockFileContent = await readLockFile(lockFileName, Buffer.isBuffer(existingLockFileContent));
|
|
122
122
|
if (!newLockFileContent) {
|
|
123
123
|
logger.debug(`No ${lockFileName} found`);
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
|
-
if (existingLockFileContent
|
|
126
|
+
if (isSameContent(existingLockFileContent, newLockFileContent)) {
|
|
127
127
|
logger.debug(`${lockFileName} is unchanged`);
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
130
|
return [fileAddition(lockFileName, newLockFileContent)];
|
|
131
131
|
}
|
|
132
|
+
function readLockFile(lockFileName, asBuffer) {
|
|
133
|
+
return asBuffer ? readLocalFile(lockFileName) : readLocalFile(lockFileName, "utf8");
|
|
134
|
+
}
|
|
135
|
+
function isSameContent(before, after) {
|
|
136
|
+
if (Buffer.isBuffer(before) && Buffer.isBuffer(after)) return before.equals(after);
|
|
137
|
+
return before === after;
|
|
138
|
+
}
|
|
132
139
|
//#endregion
|
|
133
140
|
export { applyGitSource, artifactError, artifactErrorMessageFromExecError, artifactErrorResult, fileAddition, fileChangesToArtifactResults, resolveToolConstraint, updateLockFile };
|
|
134
141
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":[],"sources":["../../../lib/modules/manager/util.ts"],"sourcesContent":["import { isNonEmptyString } from '@sindresorhus/is';\nimport { logger } from '../../logger/index.ts';\nimport type { MaybePromise } from '../../types/index.ts';\nimport { detectPlatform } from '../../util/common.ts';\nimport type { ExecError } from '../../util/exec/exec-error.ts';\nimport type { ConstraintName } from '../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n readLocalFile,\n writeLocalFile,\n} from '../../util/fs/index.ts';\nimport type { FileChange } from '../../util/git/types.ts';\nimport { parseGitUrl } from '../../util/git/url.ts';\nimport { GitRefsDatasource } from '../datasource/git-refs/index.ts';\nimport { GitTagsDatasource } from '../datasource/git-tags/index.ts';\nimport { GithubTagsDatasource } from '../datasource/github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../datasource/gitlab-tags/index.ts';\nimport type {\n PackageDependency,\n ToolConstraintsConfig,\n UpdateArtifactsResult,\n UpdateLockFileConfig,\n} from './types.ts';\n\nexport function applyGitSource(\n dep: PackageDependency,\n git: string,\n rev: string | undefined,\n tag: string | undefined,\n branch: string | undefined,\n): void {\n if (tag) {\n const platform = detectPlatform(git);\n if (platform === 'github' || platform === 'gitlab') {\n dep.datasource =\n platform === 'github'\n ? GithubTagsDatasource.id\n : GitlabTagsDatasource.id;\n const { host, full_name } = parseGitUrl(git);\n\n // Always use HTTPS for GitHub/GitLab API endpoints, even if the git URL protocol is SSH.\n dep.registryUrls = [`https://${host}`];\n dep.packageName = full_name;\n } else {\n dep.datasource = GitTagsDatasource.id;\n dep.packageName = git;\n }\n dep.currentValue = tag;\n dep.skipReason = undefined;\n } else if (rev) {\n dep.datasource = GitRefsDatasource.id;\n dep.packageName = git;\n dep.currentDigest = rev;\n dep.replaceString = rev;\n dep.skipReason = undefined;\n } else {\n dep.datasource = GitRefsDatasource.id;\n dep.packageName = git;\n dep.currentValue = branch;\n dep.skipReason = branch ? 'git-dependency' : 'unspecified-version';\n }\n}\n\n/**\n * Given an {@link ExecError}, retrieve the message which will be used for an {@link ArtifactError}.\n *\n * An `ExecError` always carries a `stderr` property, so nullish coalescing would keep an empty string and render an artifact error with no message at all.\n *\n */\nexport function artifactErrorMessageFromExecError(\n err: Partial<ExecError>,\n message: string,\n): string {\n if (err.stderr?.trim()) {\n return err.stderr;\n }\n\n if (err.stdout?.trim()) {\n return err.stdout;\n }\n\n return message;\n}\n\n/**\n * Wraps {@link FileChange}s, e.g. the result of `collectFileChanges()`, into the\n * result shape returned by `updateArtifacts()`.\n */\nexport function fileChangesToArtifactResults(\n changes: FileChange[],\n): UpdateArtifactsResult[] {\n return changes.map((file) => ({ file }));\n}\n\n/**\n * Resolve the constraint for a tool that `updateArtifacts()` has to run.\n *\n * The precedence is:\n *\n * 1. `constraints`, because the user asked for it explicitly\n * 2. `derive`, because it reads the package files as the branch changed them,\n * so it can be newer than what extraction saw\n * 3. `extractedConstraints`, as collected while extracting the base branch\n *\n * Managers that have no way to derive the constraint at artifact time can omit\n * `derive`. An empty string counts as \"not set\" at every step, so it never\n * shadows a value further down the list.\n *\n * This is the only place that reads `constraints` and `extractedConstraints`\n * from the config; the `renovate/prefer-resolve-tool-constraint` lint rule\n * keeps managers from reading them directly.\n */\nexport async function resolveToolConstraint(\n config: ToolConstraintsConfig,\n toolName: ConstraintName,\n derive?: () => MaybePromise<string | null | undefined>,\n): Promise<string | undefined> {\n const configured = config.constraints?.[toolName];\n if (isNonEmptyString(configured)) {\n return configured;\n }\n const derived = await derive?.();\n if (isNonEmptyString(derived)) {\n return derived;\n }\n const extracted = config.extractedConstraints?.[toolName];\n return isNonEmptyString(extracted) ? extracted : undefined;\n}\n\n/**\n * The result which reports `path` as created or updated.\n */\nexport function fileAddition(\n path: string,\n contents: string | Buffer | null,\n): UpdateArtifactsResult {\n return { file: { type: 'addition', path, contents } };\n}\n\n/**\n * The result which reports a failed artifact update to the user.\n */\nexport function artifactError(\n fileName: string | undefined,\n stderr: string,\n): UpdateArtifactsResult {\n return { artifactError: { fileName, stderr } };\n}\n\n/**\n * The result for an artifact update which threw, using the most informative\n * output the error carries. Callers are expected to have rethrown\n * `TEMPORARY_ERROR` and logged the error before calling this.\n */\nexport function artifactErrorResult(\n fileName: string | undefined,\n err: Error & Partial<ExecError>,\n): UpdateArtifactsResult[] {\n return [\n artifactError(\n fileName,\n artifactErrorMessageFromExecError(err, err.message),\n ),\n ];\n}\n\n/**\n * The skeleton shared by the managers which regenerate a single lock file:\n * rewrite the package file, optionally drop the lock file, run the package\n * manager and return the lock file when its content changed.\n *\n * Errors from `run()` are not handled here - callers keep their own logging and\n * pass the error to {@link artifactErrorResult}.\n */\nexport async function updateLockFile({\n lockFileName,\n existingLockFileContent,\n packageFile,\n deleteLockFile,\n run,\n}: UpdateLockFileConfig): Promise<UpdateArtifactsResult[] | null> {\n if (packageFile) {\n await writeLocalFile(packageFile.path, packageFile.contents);\n }\n\n if (deleteLockFile) {\n await deleteLocalFile(lockFileName);\n }\n\n await run();\n\n const newLockFileContent = await
|
|
1
|
+
{"version":3,"file":"util.js","names":[],"sources":["../../../lib/modules/manager/util.ts"],"sourcesContent":["import { isNonEmptyString } from '@sindresorhus/is';\nimport { logger } from '../../logger/index.ts';\nimport type { MaybePromise } from '../../types/index.ts';\nimport { detectPlatform } from '../../util/common.ts';\nimport type { ExecError } from '../../util/exec/exec-error.ts';\nimport type { ConstraintName } from '../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n readLocalFile,\n writeLocalFile,\n} from '../../util/fs/index.ts';\nimport type { FileChange } from '../../util/git/types.ts';\nimport { parseGitUrl } from '../../util/git/url.ts';\nimport { GitRefsDatasource } from '../datasource/git-refs/index.ts';\nimport { GitTagsDatasource } from '../datasource/git-tags/index.ts';\nimport { GithubTagsDatasource } from '../datasource/github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../datasource/gitlab-tags/index.ts';\nimport type {\n PackageDependency,\n ToolConstraintsConfig,\n UpdateArtifactsResult,\n UpdateLockFileConfig,\n} from './types.ts';\n\nexport function applyGitSource(\n dep: PackageDependency,\n git: string,\n rev: string | undefined,\n tag: string | undefined,\n branch: string | undefined,\n): void {\n if (tag) {\n const platform = detectPlatform(git);\n if (platform === 'github' || platform === 'gitlab') {\n dep.datasource =\n platform === 'github'\n ? GithubTagsDatasource.id\n : GitlabTagsDatasource.id;\n const { host, full_name } = parseGitUrl(git);\n\n // Always use HTTPS for GitHub/GitLab API endpoints, even if the git URL protocol is SSH.\n dep.registryUrls = [`https://${host}`];\n dep.packageName = full_name;\n } else {\n dep.datasource = GitTagsDatasource.id;\n dep.packageName = git;\n }\n dep.currentValue = tag;\n dep.skipReason = undefined;\n } else if (rev) {\n dep.datasource = GitRefsDatasource.id;\n dep.packageName = git;\n dep.currentDigest = rev;\n dep.replaceString = rev;\n dep.skipReason = undefined;\n } else {\n dep.datasource = GitRefsDatasource.id;\n dep.packageName = git;\n dep.currentValue = branch;\n dep.skipReason = branch ? 'git-dependency' : 'unspecified-version';\n }\n}\n\n/**\n * Given an {@link ExecError}, retrieve the message which will be used for an {@link ArtifactError}.\n *\n * An `ExecError` always carries a `stderr` property, so nullish coalescing would keep an empty string and render an artifact error with no message at all.\n *\n */\nexport function artifactErrorMessageFromExecError(\n err: Partial<ExecError>,\n message: string,\n): string {\n if (err.stderr?.trim()) {\n return err.stderr;\n }\n\n if (err.stdout?.trim()) {\n return err.stdout;\n }\n\n return message;\n}\n\n/**\n * Wraps {@link FileChange}s, e.g. the result of `collectFileChanges()`, into the\n * result shape returned by `updateArtifacts()`.\n */\nexport function fileChangesToArtifactResults(\n changes: FileChange[],\n): UpdateArtifactsResult[] {\n return changes.map((file) => ({ file }));\n}\n\n/**\n * Resolve the constraint for a tool that `updateArtifacts()` has to run.\n *\n * The precedence is:\n *\n * 1. `constraints`, because the user asked for it explicitly\n * 2. `derive`, because it reads the package files as the branch changed them,\n * so it can be newer than what extraction saw\n * 3. `extractedConstraints`, as collected while extracting the base branch\n *\n * Managers that have no way to derive the constraint at artifact time can omit\n * `derive`. An empty string counts as \"not set\" at every step, so it never\n * shadows a value further down the list.\n *\n * This is the only place that reads `constraints` and `extractedConstraints`\n * from the config; the `renovate/prefer-resolve-tool-constraint` lint rule\n * keeps managers from reading them directly.\n */\nexport async function resolveToolConstraint(\n config: ToolConstraintsConfig,\n toolName: ConstraintName,\n derive?: () => MaybePromise<string | null | undefined>,\n): Promise<string | undefined> {\n const configured = config.constraints?.[toolName];\n if (isNonEmptyString(configured)) {\n return configured;\n }\n const derived = await derive?.();\n if (isNonEmptyString(derived)) {\n return derived;\n }\n const extracted = config.extractedConstraints?.[toolName];\n return isNonEmptyString(extracted) ? extracted : undefined;\n}\n\n/**\n * The result which reports `path` as created or updated.\n */\nexport function fileAddition(\n path: string,\n contents: string | Buffer | null,\n): UpdateArtifactsResult {\n return { file: { type: 'addition', path, contents } };\n}\n\n/**\n * The result which reports a failed artifact update to the user.\n */\nexport function artifactError(\n fileName: string | undefined,\n stderr: string,\n): UpdateArtifactsResult {\n return { artifactError: { fileName, stderr } };\n}\n\n/**\n * The result for an artifact update which threw, using the most informative\n * output the error carries. Callers are expected to have rethrown\n * `TEMPORARY_ERROR` and logged the error before calling this.\n */\nexport function artifactErrorResult(\n fileName: string | undefined,\n err: Error & Partial<ExecError>,\n): UpdateArtifactsResult[] {\n return [\n artifactError(\n fileName,\n artifactErrorMessageFromExecError(err, err.message),\n ),\n ];\n}\n\n/**\n * The skeleton shared by the managers which regenerate a single lock file:\n * rewrite the package file, optionally drop the lock file, run the package\n * manager and return the lock file when its content changed.\n *\n * Errors from `run()` are not handled here - callers keep their own logging and\n * pass the error to {@link artifactErrorResult}.\n */\nexport async function updateLockFile({\n lockFileName,\n existingLockFileContent,\n packageFile,\n deleteLockFile,\n run,\n}: UpdateLockFileConfig): Promise<UpdateArtifactsResult[] | null> {\n if (packageFile) {\n await writeLocalFile(packageFile.path, packageFile.contents);\n }\n\n if (deleteLockFile) {\n await deleteLocalFile(lockFileName);\n }\n\n await run();\n\n // A Buffer as the existing content means the lock file may be binary, so the\n // new content is read and compared as bytes as well.\n const newLockFileContent = await readLockFile(\n lockFileName,\n Buffer.isBuffer(existingLockFileContent),\n );\n if (!newLockFileContent) {\n logger.debug(`No ${lockFileName} found`);\n return null;\n }\n\n if (isSameContent(existingLockFileContent, newLockFileContent)) {\n logger.debug(`${lockFileName} is unchanged`);\n return null;\n }\n\n return [fileAddition(lockFileName, newLockFileContent)];\n}\n\nfunction readLockFile(\n lockFileName: string,\n asBuffer: boolean,\n): Promise<string | Buffer | null> {\n return asBuffer\n ? readLocalFile(lockFileName)\n : readLocalFile(lockFileName, 'utf8');\n}\n\nfunction isSameContent(\n before: string | Buffer | null,\n after: string | Buffer,\n): boolean {\n if (Buffer.isBuffer(before) && Buffer.isBuffer(after)) {\n return before.equals(after);\n }\n return before === after;\n}\n"],"mappings":";;;;;;;;;;AAwBA,SAAgB,eACd,KACA,KACA,KACA,KACA,QACM;CACN,IAAI,KAAK;EACP,MAAM,WAAW,eAAe,GAAG;EACnC,IAAI,aAAa,YAAY,aAAa,UAAU;GAClD,IAAI,aACF,aAAa,WACT,qBAAqB,KACrB,qBAAqB;GAC3B,MAAM,EAAE,MAAM,cAAc,YAAY,GAAG;GAG3C,IAAI,eAAe,CAAC,WAAW,MAAM;GACrC,IAAI,cAAc;EACpB,OAAO;GACL,IAAI,aAAa,kBAAkB;GACnC,IAAI,cAAc;EACpB;EACA,IAAI,eAAe;EACnB,IAAI,aAAa,KAAA;CACnB,OAAO,IAAI,KAAK;EACd,IAAI,aAAa,kBAAkB;EACnC,IAAI,cAAc;EAClB,IAAI,gBAAgB;EACpB,IAAI,gBAAgB;EACpB,IAAI,aAAa,KAAA;CACnB,OAAO;EACL,IAAI,aAAa,kBAAkB;EACnC,IAAI,cAAc;EAClB,IAAI,eAAe;EACnB,IAA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AAa,cAAc;EAC3C,OAAO;CACT;CAEA,OAAO,CAAC,aAAa,cAAc,kBAAkB,CAAC;AACxD;AAEA,SAAS,aACP,cACA,UACiC;CACjC,OAAO,WACH,cAAc,YAAY,IAC1B,cAAc,cAAc,MAAM;AACxC;AAEA,SAAS,cACP,QACA,OACS;CACT,IAAI,OAAO,SAAS,MAAM,KAAK,OAAO,SAAS,KAAK,GAClD,OAAO,OAAO,OAAO,KAAK;CAE5B,OAAO,WAAW;AACpB"}
|
package/package.json
CHANGED
package/renovate-schema.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$id": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"title": "JSON schema for Renovate 44.
|
|
3
|
+
"title": "JSON schema for Renovate 44.101.0 config files (https://renovatebot.com/)",
|
|
4
4
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
-
"x-renovate-version": "44.
|
|
5
|
+
"x-renovate-version": "44.101.0",
|
|
6
6
|
"allowComments": true,
|
|
7
7
|
"type": "object",
|
|
8
8
|
"definitions": {
|