create-thally-docs 0.10.1 → 0.10.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/dist/starter-update.js +15 -3
- package/package.json +1 -1
package/dist/starter-update.js
CHANGED
|
@@ -56,13 +56,25 @@ function resolveStarterReleaseFromManifest(source, releases = SUPPORTED_SCAFFOLD
|
|
|
56
56
|
parseStarterReleaseManifest(source, matching[0]);
|
|
57
57
|
return matching[0];
|
|
58
58
|
}
|
|
59
|
-
function assertForwardRelease(previous, target) {
|
|
59
|
+
function assertForwardRelease(previous, target, releases) {
|
|
60
60
|
if (previous.source.repository !== target.source.repository || previous.source.manifestPath !== target.source.manifestPath) {
|
|
61
61
|
throw new Error("Starter updates cannot cross repository or manifest contracts.");
|
|
62
62
|
}
|
|
63
|
-
if (previous.source.commitSha
|
|
63
|
+
if (previous.source.commitSha === target.source.commitSha) return;
|
|
64
|
+
if (previous.starterVersion > target.starterVersion) {
|
|
64
65
|
throw new Error("The installed CLI does not contain a newer starter release.");
|
|
65
66
|
}
|
|
67
|
+
if (previous.starterVersion === target.starterVersion) {
|
|
68
|
+
const targetIndex = releases.findIndex(
|
|
69
|
+
(release) => release.source.commitSha === target.source.commitSha
|
|
70
|
+
);
|
|
71
|
+
const previousIndex = releases.findIndex(
|
|
72
|
+
(release) => release.source.commitSha === previous.source.commitSha
|
|
73
|
+
);
|
|
74
|
+
if (targetIndex === -1 || previousIndex === -1 || previousIndex <= targetIndex) {
|
|
75
|
+
throw new Error("The installed CLI does not contain a newer starter release.");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
66
78
|
}
|
|
67
79
|
async function updateStarterProject(options) {
|
|
68
80
|
const targetRelease = options.targetRelease ?? STABLE_SCAFFOLD_RELEASE;
|
|
@@ -73,7 +85,7 @@ async function updateStarterProject(options) {
|
|
|
73
85
|
downstreamManifest,
|
|
74
86
|
releases
|
|
75
87
|
);
|
|
76
|
-
assertForwardRelease(previousRelease, targetRelease);
|
|
88
|
+
assertForwardRelease(previousRelease, targetRelease, releases);
|
|
77
89
|
if (previousRelease.source.commitSha === targetRelease.source.commitSha) {
|
|
78
90
|
return {
|
|
79
91
|
previousRelease,
|