@scaleway/changesets-renovate 2.2.4 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3,6 +3,7 @@ import { handleCatalogChanges } from "./handle-catalog.js";
3
3
  import { handlePackageChanges } from "./handle-packages.js";
4
4
  import { env } from "node:process";
5
5
  import { simpleGit } from "simple-git";
6
+ //#region src/cli.ts
6
7
  async function run() {
7
8
  const branch = await simpleGit().branch();
8
9
  const branchPrefix = env["BRANCH_PREFIX"] ?? "renovate/";
@@ -33,4 +34,5 @@ async function run() {
33
34
  }
34
35
  }
35
36
  run().catch(console.error);
37
+ //#endregion
36
38
  export { run };
@@ -1,5 +1,6 @@
1
1
  import { env } from "node:process";
2
2
  import { writeFile } from "node:fs/promises";
3
+ //#region src/createChangeset.ts
3
4
  async function createChangeset(fileName, packageBumps, packages) {
4
5
  const messageLines = [];
5
6
  for (const [pkg, bump] of packageBumps) messageLines.push(`Updated dependency \`${pkg}\` to \`${bump}\`.`);
@@ -10,4 +11,5 @@ async function createChangeset(fileName, packageBumps, packages) {
10
11
  const message = messageLines.join("\n");
11
12
  await writeFile(fileName, `---\n${packages.map((pkg) => `'${pkg}': patch`).join("\n")}\n---\n\n${message.trim()}\n`);
12
13
  }
14
+ //#endregion
13
15
  export { createChangeset };
package/dist/git-utils.js CHANGED
@@ -3,7 +3,14 @@ import { simpleGit } from "simple-git";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import fg from "fast-glob";
5
5
  import { load } from "js-yaml";
6
+ //#region src/git-utils.ts
6
7
  var { globSync } = fg;
8
+ /**
9
+ * Load catalog from pnpm workspace file at specific git revision
10
+ * @param revision Git revision to load file from (default: HEAD)
11
+ * @param filePath Path to the pnpm workspace file (default: pnpm-workspace.yaml)
12
+ * @returns Catalog object or empty object if not found
13
+ */
7
14
  async function loadCatalogFromGit(revision = "HEAD", filePath = "pnpm-workspace.yaml") {
8
15
  try {
9
16
  if (!revision) return {};
@@ -12,6 +19,13 @@ async function loadCatalogFromGit(revision = "HEAD", filePath = "pnpm-workspace.
12
19
  return {};
13
20
  }
14
21
  }
22
+ /**
23
+ * Find changed dependencies between two git revisions of pnpm workspace
24
+ * @param oldRevision The previous git revision
25
+ * @param newRevision The current git revision (default: HEAD)
26
+ * @param filePath Path to the pnpm workspace file (default: pnpm-workspace.yaml)
27
+ * @returns Array of package names that have changed
28
+ */
15
29
  async function findChangedDependenciesFromGit(oldRevision, newRevision = "HEAD", filePath = "pnpm-workspace.yaml") {
16
30
  const oldCatalog = await loadCatalogFromGit(oldRevision, filePath);
17
31
  const newCatalog = await loadCatalogFromGit(newRevision, filePath);
@@ -32,6 +46,12 @@ async function getBumpsFromGit(files) {
32
46
  await Promise.all(promises);
33
47
  return bumps;
34
48
  }
49
+ /**
50
+ * Find packages affected by dependency changes
51
+ * @param changedDeps Array of changed dependency names
52
+ * @param packageJsonGlob Glob pattern to find package.json files
53
+ * @returns Set of package names that are affected by the changes
54
+ */
35
55
  async function findAffectedPackages(changedDeps, packageJsonGlob = "packages/*/package.json") {
36
56
  if (changedDeps.length === 0) return /* @__PURE__ */ new Set();
37
57
  const packageJsonPaths = globSync(packageJsonGlob);
@@ -57,4 +77,5 @@ async function handleChangesetFile(fileName) {
57
77
  await simpleGit().push();
58
78
  }
59
79
  }
80
+ //#endregion
60
81
  export { findAffectedPackages, findChangedDependenciesFromGit, getBumpsFromGit, handleChangesetFile };
@@ -1,6 +1,10 @@
1
1
  import { createChangeset } from "./createChangeset.js";
2
2
  import { simpleGit } from "simple-git";
3
+ //#region src/handle-catalog.ts
3
4
  var { findChangedDependenciesFromGit, findAffectedPackages, handleChangesetFile } = await import("./git-utils.js");
5
+ /**
6
+ * Handle pnpm workspace catalog changes
7
+ */
4
8
  async function handleCatalogChanges(diffFiles) {
5
9
  if (diffFiles.filter((file) => file.includes("pnpm-workspace.yaml")).length === 0) return;
6
10
  console.log("šŸ” Detected pnpm workspace changes, checking for catalog updates...");
@@ -25,4 +29,5 @@ async function handleCatalogChanges(diffFiles) {
25
29
  await handleChangesetFile(fileName);
26
30
  console.log("\nāœ… Done creating changesets.");
27
31
  }
32
+ //#endregion
28
33
  export { handleCatalogChanges };
@@ -2,6 +2,10 @@ import { createChangeset } from "./createChangeset.js";
2
2
  import { getBumpsFromGit, handleChangesetFile } from "./git-utils.js";
3
3
  import { getPackagesNames } from "./utils.js";
4
4
  import { simpleGit } from "simple-git";
5
+ //#region src/handle-packages.ts
6
+ /**
7
+ * Handle package.json changes (original Renovate flow)
8
+ */
5
9
  async function handlePackageChanges(diffFiles) {
6
10
  const files = diffFiles.filter((file) => file.includes("package.json"));
7
11
  if (files.length === 0) {
@@ -17,4 +21,5 @@ async function handlePackageChanges(diffFiles) {
17
21
  await createChangeset(fileName, await getBumpsFromGit(files), packageNames);
18
22
  await handleChangesetFile(fileName);
19
23
  }
24
+ //#endregion
20
25
  export { handlePackageChanges };
package/dist/utils.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import fg from "fast-glob";
3
- import { load } from "js-yaml";
3
+ import "js-yaml";
4
+ //#region src/utils.ts
4
5
  var { globSync } = fg;
5
6
  function shouldIgnorePackage(packageName, ignoredPackages) {
6
7
  return ignoredPackages.some((ignoredPackage) => {
@@ -22,4 +23,5 @@ async function getPackagesNames(files) {
22
23
  await Promise.all(promises);
23
24
  return packages;
24
25
  }
26
+ //#endregion
25
27
  export { getPackagesNames };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/changesets-renovate",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "description": "Automatically create changesets for Renovate and pnpm catalogs",
5
5
  "type": "module",
6
6
  "module": "./dist/cli.js",
@@ -41,7 +41,7 @@
41
41
  "@types/js-yaml": "4.0.9",
42
42
  "fast-glob": "3.3.3",
43
43
  "js-yaml": "4.1.1",
44
- "simple-git": "3.30.0"
44
+ "simple-git": "3.33.0"
45
45
  },
46
46
  "scripts": {
47
47
  "prebuild": "shx rm -rf dist",