enablement-build-monorepo-version 8.3.0 → 8.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enablement-build-monorepo-version",
3
- "version": "8.3.0",
3
+ "version": "8.3.2",
4
4
  "description": "This detects changes in the children packages of a monorepo.",
5
5
  "type": "module",
6
6
  "module": "./src/index.mjs",
package/src/index.mjs CHANGED
@@ -3,6 +3,11 @@ import path from 'path';
3
3
  import { readFileSync, writeFileSync, existsSync, lstatSync } from "fs";
4
4
  import { exec } from "child_process";
5
5
 
6
+ const packageMetadata = JSON.parse(
7
+ readFileSync(new URL("../package.json", import.meta.url), "utf8"),
8
+ );
9
+ const packageVersion = packageMetadata.version;
10
+
6
11
  import { dependencyMap, compare, getCurrentVersion, updateVersion, retagToPackageNames, detectOldFormatTags, resolveWorkspaceChildren, excludeChildren, applyInitScripts, RELEASE_SCRIPTS, emitVariable, hashElement, resolveHashFilePath, ensureHashFileExists, loadHashFile, writeHashFile } from "./lib.mjs";
7
12
 
8
13
 
@@ -65,7 +70,8 @@ async function collectPackageEntries(prefixPath, scanFolder, packageFolder, hash
65
70
 
66
71
  const versionInfo = getCurrentVersion(prefixPath, scanFolder, name);
67
72
  if (versionInfo.fullName) {
68
- current[name] = { hash: child.hash, ...versionInfo, packageFolder };
73
+ const packageHash = await hashElement(childPath, hashOptions);
74
+ current[name] = { hash: packageHash.hash, ...versionInfo, packageFolder };
69
75
  continue;
70
76
  }
71
77
 
@@ -390,6 +396,7 @@ async function initPackage(options) {
390
396
 
391
397
  (async () => {
392
398
  try {
399
+ console.log(`enablement-build-monorepo-version v${packageVersion}`);
393
400
  if (options.init) {
394
401
  await initPackage(options);
395
402
  return;
@@ -228,11 +228,8 @@ describe("index CLI nested workspace roots", () => {
228
228
  "utf8",
229
229
  );
230
230
 
231
- const stdout = execFileSync(
232
- "node",
233
- [cliPath, "--hash", "--changed", "--children", "ux", "--prefixPath", root],
234
- { cwd: repoRoot, encoding: "utf8" },
235
- );
231
+ const args = [cliPath, "--hash", "--changed", "--children", "ux", "--prefixPath", root];
232
+ const stdout = execFileSync("node", args, { cwd: repoRoot, encoding: "utf8" });
236
233
 
237
234
  const changedMatch = stdout.match(/CHANGED - (\[[^\n]*\])/);
238
235
  expect(changedMatch).not.toBeNull();
@@ -241,6 +238,10 @@ describe("index CLI nested workspace roots", () => {
241
238
  const hashJson = JSON.parse(readFileSync(path.join(root, ".cicd", "hash.json"), "utf8"));
242
239
  expect(hashJson.hash["@scope/profile"]).toBeTruthy();
243
240
  expect(hashJson.hash.undefined).toBeUndefined();
241
+
242
+ const secondOutput = execFileSync("node", args, { cwd: repoRoot, encoding: "utf8" });
243
+ const secondChanged = secondOutput.match(/CHANGED - (\[[^\n]*\])/);
244
+ expect(JSON.parse(secondChanged[1])).toEqual([]);
244
245
  } finally {
245
246
  rmSync(root, { recursive: true, force: true });
246
247
  }