@virmator/publish 14.30.6 → 14.30.7
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/publish.d.ts +10 -0
- package/dist/publish.js +26 -2
- package/package.json +2 -2
package/dist/publish.d.ts
CHANGED
|
@@ -66,3 +66,13 @@ export declare function determineNextVersion({ latestVersion, changeMarkers, }:
|
|
|
66
66
|
latestVersion: SemVer | undefined;
|
|
67
67
|
changeMarkers: Readonly<Record<ChangeMarker, number>>;
|
|
68
68
|
}): string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Updates a package's version and every dependency map that references the given package.
|
|
71
|
+
*
|
|
72
|
+
* @category Internal
|
|
73
|
+
*/
|
|
74
|
+
export declare function updatePackageJsonVersions({ packageJsonContents, packageName, version, }: Readonly<{
|
|
75
|
+
packageJsonContents: string;
|
|
76
|
+
packageName: string;
|
|
77
|
+
version: string;
|
|
78
|
+
}>): string;
|
package/dist/publish.js
CHANGED
|
@@ -423,10 +423,34 @@ async function updateVersion({ version, packagePath, monoPackages, }) {
|
|
|
423
423
|
if (!packageName) {
|
|
424
424
|
throw new Error(`Missing package name in '${packagePath}'.`);
|
|
425
425
|
}
|
|
426
|
-
await writeFile(packageJsonPath,
|
|
426
|
+
await writeFile(packageJsonPath, updatePackageJsonVersions({
|
|
427
|
+
packageJsonContents,
|
|
428
|
+
packageName,
|
|
429
|
+
version,
|
|
430
|
+
}));
|
|
427
431
|
await awaitedBlockingMap(monoPackages, async (monoPackage) => {
|
|
428
432
|
const monoPackageJsonPath = join(monoPackage.fullPath, 'package.json');
|
|
429
433
|
const monoPackageJsonContents = (await readFile(monoPackageJsonPath)).toString();
|
|
430
|
-
await writeFile(monoPackageJsonPath,
|
|
434
|
+
await writeFile(monoPackageJsonPath, updatePackageJsonVersions({
|
|
435
|
+
packageJsonContents: monoPackageJsonContents,
|
|
436
|
+
packageName,
|
|
437
|
+
version,
|
|
438
|
+
}));
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Updates a package's version and every dependency map that references the given package.
|
|
443
|
+
*
|
|
444
|
+
* @category Internal
|
|
445
|
+
*/
|
|
446
|
+
export function updatePackageJsonVersions({ packageJsonContents, packageName, version, }) {
|
|
447
|
+
const packageNameMatcher = new RegExp(String.raw `("${escapeRegExp(packageName)}"\s*:\s*)"[^"]+"`);
|
|
448
|
+
return packageJsonContents
|
|
449
|
+
.replace(/"version"\s*:\s*"[^"]+"/, `"version": "${version}"`)
|
|
450
|
+
.replace(/"[^"]*dependencies"\s*:\s*\{[^{}]*}/gi, (dependencyPropertyContents) => {
|
|
451
|
+
return dependencyPropertyContents.replace(packageNameMatcher, `$1"^${version}"`);
|
|
431
452
|
});
|
|
432
453
|
}
|
|
454
|
+
function escapeRegExp(value) {
|
|
455
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, String.raw `\$&`);
|
|
456
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virmator/publish",
|
|
3
|
-
"version": "14.30.
|
|
3
|
+
"version": "14.30.7",
|
|
4
4
|
"description": "Default publish plugin for virmator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"virmator",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@augment-vir/assert": "^32.2.1",
|
|
38
38
|
"@augment-vir/common": "^32.2.1",
|
|
39
39
|
"@augment-vir/node": "^32.2.1",
|
|
40
|
-
"@virmator/core": "^14.30.
|
|
40
|
+
"@virmator/core": "^14.30.7",
|
|
41
41
|
"mri": "^1.2.0",
|
|
42
42
|
"semver": "^7.8.5",
|
|
43
43
|
"simple-git": "^3.36.0",
|