enablement-build-monorepo-version 2.0.7 → 2.0.8
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 +1 -1
- package/src/index.mjs +3 -2
- package/tests/lib.test.mjs +59 -0
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -35,7 +35,7 @@ function buildHashesForCicd(current) {
|
|
|
35
35
|
hashData[entry.fullName] = {
|
|
36
36
|
hash: entry.hash,
|
|
37
37
|
version: entry.version,
|
|
38
|
-
|
|
38
|
+
name: entry.fullName,
|
|
39
39
|
packageFolder: entry.packageFolder
|
|
40
40
|
};
|
|
41
41
|
versions[entry.fullName] = entry.version;
|
|
@@ -319,7 +319,8 @@ async function main(options) {
|
|
|
319
319
|
if (!manifest.cicd) manifest.cicd = {};
|
|
320
320
|
if (!manifest.cicd[fullname]) manifest.cicd[fullname] = {};
|
|
321
321
|
manifest.cicd[fullname].hash = hashData[fullname].hash;
|
|
322
|
-
manifest.cicd[fullname].
|
|
322
|
+
manifest.cicd[fullname].name = hashData[fullname].name;
|
|
323
|
+
delete manifest.cicd[fullname].folderName;
|
|
323
324
|
manifest.cicd[fullname].packageFolder = hashData[fullname].packageFolder;
|
|
324
325
|
});
|
|
325
326
|
|
package/tests/lib.test.mjs
CHANGED
|
@@ -343,6 +343,65 @@ describe("version manifest precedence and updates", () => {
|
|
|
343
343
|
rmSync(root, { recursive: true, force: true });
|
|
344
344
|
});
|
|
345
345
|
|
|
346
|
+
it("reads current version and name from version.json when package.json is absent", () => {
|
|
347
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "monorepo-version-"));
|
|
348
|
+
const pkgDir = path.join(root, "packages", "gamma");
|
|
349
|
+
mkdirSync(pkgDir, { recursive: true });
|
|
350
|
+
|
|
351
|
+
writeFileSync(
|
|
352
|
+
path.join(pkgDir, "version.json"),
|
|
353
|
+
JSON.stringify({ name: "@s/gamma-version", version: "2.1.0" }, null, 2),
|
|
354
|
+
"utf8",
|
|
355
|
+
);
|
|
356
|
+
writeFileSync(
|
|
357
|
+
path.join(pkgDir, "pyproject.toml"),
|
|
358
|
+
'[project]\nname = "gamma-toml"\nversion = "3.0.0"\n',
|
|
359
|
+
"utf8",
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
const current = getCurrentVersion(root, "packages", "gamma");
|
|
363
|
+
expect(current.version).toBe("2.1.0");
|
|
364
|
+
expect(current.fullName).toBe("@s/gamma-version");
|
|
365
|
+
|
|
366
|
+
rmSync(root, { recursive: true, force: true });
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it("reads current version and name from pyproject.toml only when package.json and version.json are absent", () => {
|
|
370
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "monorepo-version-"));
|
|
371
|
+
const pkgDir = path.join(root, "packages", "delta");
|
|
372
|
+
mkdirSync(pkgDir, { recursive: true });
|
|
373
|
+
|
|
374
|
+
writeFileSync(
|
|
375
|
+
path.join(pkgDir, "pyproject.toml"),
|
|
376
|
+
'[project]\nname = "delta-toml"\nversion = "3.2.0"\n',
|
|
377
|
+
"utf8",
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
const current = getCurrentVersion(root, "packages", "delta");
|
|
381
|
+
expect(current.version).toBe("3.2.0");
|
|
382
|
+
expect(current.fullName).toBe("delta-toml");
|
|
383
|
+
|
|
384
|
+
rmSync(root, { recursive: true, force: true });
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it("does not fall back to folder name when no manifest name exists", () => {
|
|
388
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "monorepo-version-"));
|
|
389
|
+
const pkgDir = path.join(root, "packages", "epsilon");
|
|
390
|
+
mkdirSync(pkgDir, { recursive: true });
|
|
391
|
+
|
|
392
|
+
writeFileSync(
|
|
393
|
+
path.join(pkgDir, "package.json"),
|
|
394
|
+
JSON.stringify({ version: "1.0.0" }, null, 2),
|
|
395
|
+
"utf8",
|
|
396
|
+
);
|
|
397
|
+
|
|
398
|
+
const current = getCurrentVersion(root, "packages", "epsilon");
|
|
399
|
+
expect(current.version).toBe("1.0.0");
|
|
400
|
+
expect(current.fullName).toBeUndefined();
|
|
401
|
+
|
|
402
|
+
rmSync(root, { recursive: true, force: true });
|
|
403
|
+
});
|
|
404
|
+
|
|
346
405
|
it("updates all version manifests when package.json, version.json, and pyproject.toml exist", async () => {
|
|
347
406
|
const root = mkdtempSync(path.join(os.tmpdir(), "monorepo-version-"));
|
|
348
407
|
const pkgDir = path.join(root, "packages", "beta");
|