@swell/cli 2.0.17 → 2.0.18
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/commands/app/version.js +16 -11
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -79,9 +79,9 @@ behavior by using the --no-git-tag option.`;
|
|
|
79
79
|
if (!(await this.ensureAppExists(undefined, false))) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
const
|
|
82
|
+
const localVersion = this.app.version;
|
|
83
83
|
if (amend) {
|
|
84
|
-
const amendVersion = nextVersion ||
|
|
84
|
+
const amendVersion = nextVersion || localVersion;
|
|
85
85
|
const appVersion = await this.getVersion(amendVersion);
|
|
86
86
|
if (appVersion) {
|
|
87
87
|
await this.updateVersion(amendVersion, {
|
|
@@ -93,21 +93,26 @@ behavior by using the --no-git-tag option.`;
|
|
|
93
93
|
}
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
+
const latestVersion = await this.getVersion();
|
|
97
|
+
const remoteVersion = latestVersion?.version;
|
|
98
|
+
// Suggest the next version if not provided
|
|
99
|
+
if (!nextVersion && semver.gt(localVersion, remoteVersion)) {
|
|
100
|
+
nextVersion = localVersion;
|
|
101
|
+
}
|
|
96
102
|
// If the user didn't specify a version, show the latest one
|
|
97
103
|
if (!nextVersion) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this.log(`${style.appConfigValue(this.app.name)} latest remote version is ${style.appConfigValue(latestVersion.version)}.`);
|
|
104
|
+
if (remoteVersion) {
|
|
105
|
+
this.log(`${style.appConfigValue(this.app.name)} latest remote version is ${style.appConfigValue(remoteVersion)}.`);
|
|
101
106
|
}
|
|
102
107
|
else {
|
|
103
|
-
nextVersion =
|
|
108
|
+
nextVersion = localVersion;
|
|
104
109
|
if (!nextVersion) {
|
|
105
110
|
this.error(`${style.appConfigValue(this.app.name)} has not been versioned yet.`);
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
return;
|
|
109
114
|
}
|
|
110
|
-
nextVersion = this.validateAndComputeVersion(nextVersion,
|
|
115
|
+
nextVersion = this.validateAndComputeVersion(nextVersion, localVersion);
|
|
111
116
|
await this.pushAppConfigs();
|
|
112
117
|
await this.deployAppFrontend(false, false);
|
|
113
118
|
if (!message) {
|
|
@@ -175,15 +180,15 @@ behavior by using the --no-git-tag option.`;
|
|
|
175
180
|
// tag the version in git
|
|
176
181
|
await git.spawn(['tag', tag], { cwd: process.cwd() });
|
|
177
182
|
}
|
|
178
|
-
validateAndComputeVersion(nextVersion,
|
|
183
|
+
validateAndComputeVersion(nextVersion, localVersion) {
|
|
179
184
|
let version = nextVersion;
|
|
180
185
|
// compute the value of the next version and check if it's valid
|
|
181
186
|
if (RELEASE_TYPES.includes(nextVersion)) {
|
|
182
187
|
// increment the version
|
|
183
|
-
version = semver.inc(
|
|
188
|
+
version = semver.inc(localVersion, version);
|
|
184
189
|
}
|
|
185
|
-
if (semver.lt(version,
|
|
186
|
-
this.error(`Version ${version} must be greater than the current version ${
|
|
190
|
+
if (semver.lt(version, localVersion)) {
|
|
191
|
+
this.error(`Version ${version} must be greater than the current version ${localVersion}.`);
|
|
187
192
|
}
|
|
188
193
|
return version;
|
|
189
194
|
}
|
package/oclif.manifest.json
CHANGED