@swell/cli 2.0.18 → 2.0.20
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.
|
@@ -3,6 +3,7 @@ import { Flags } from '@oclif/core';
|
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import * as semver from 'semver';
|
|
5
5
|
import config from '../../lib/config.js';
|
|
6
|
+
import { readRcFile } from '../../lib/app-config.js';
|
|
6
7
|
import { selectEnvironmentId, selectLoggedInStoreId, } from '../../lib/stores.js';
|
|
7
8
|
import style from '../../lib/style.js';
|
|
8
9
|
import { RemoteAppCommand } from '../../remote-app-command.js';
|
|
@@ -123,10 +124,20 @@ Without a store specified, install the app in the Live environment of the curren
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
async confirmRemoveDevelopmentApp(storeToInstall) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
let sourceAppId;
|
|
128
|
+
try {
|
|
129
|
+
const sourceApp = await readRcFile(this.swellRcPath());
|
|
130
|
+
sourceAppId = sourceApp?.id;
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
// noop
|
|
134
|
+
}
|
|
135
|
+
const existingSourcedApps = sourceAppId
|
|
136
|
+
? await this.api.get({ adminPath: `/client/apps` }, {
|
|
137
|
+
query: { source_id: sourceAppId },
|
|
138
|
+
})
|
|
139
|
+
: null;
|
|
140
|
+
if (existingSourcedApps?.results[0]?.id) {
|
|
130
141
|
const continueInstall = await confirm({
|
|
131
142
|
default: false,
|
|
132
143
|
message: `${style.storeId(storeToInstall)} has a development version of ${style.appConfigValue(this.app.name)}. Do you want to replace it with an installed instance?`,
|
|
@@ -200,6 +200,11 @@ export class RemoteAppCommand extends AppCommand {
|
|
|
200
200
|
existingDevApp = await this.api.get({
|
|
201
201
|
adminPath: `/apps/${this.swellConfig.store.id}`,
|
|
202
202
|
});
|
|
203
|
+
// Check if existing dev app is owned by the current store
|
|
204
|
+
const currentStore = localConfig.getDefaultStore();
|
|
205
|
+
if (existingDevApp?.client_id !== currentStore) {
|
|
206
|
+
existingDevApp = null;
|
|
207
|
+
}
|
|
203
208
|
}
|
|
204
209
|
catch {
|
|
205
210
|
// noop
|
|
@@ -311,7 +316,7 @@ export class RemoteAppCommand extends AppCommand {
|
|
|
311
316
|
return this.api.post({ adminPath: `/client/apps` }, {
|
|
312
317
|
body: { app_id: this.app.id, version },
|
|
313
318
|
onAsyncGetPath: (response) => ({
|
|
314
|
-
adminPath: `/client/app-async-status/${response.
|
|
319
|
+
adminPath: `/client/app-async-status/${response.app_id}`,
|
|
315
320
|
}),
|
|
316
321
|
spinner,
|
|
317
322
|
});
|
|
@@ -599,7 +604,7 @@ export class RemoteAppCommand extends AppCommand {
|
|
|
599
604
|
await this.api.put({ adminPath: `/client/apps/${this.app.id}` }, {
|
|
600
605
|
body: { version },
|
|
601
606
|
onAsyncGetPath: (response) => ({
|
|
602
|
-
adminPath: `/client/app-async-status/${response.
|
|
607
|
+
adminPath: `/client/app-async-status/${response.app_id}`,
|
|
603
608
|
}),
|
|
604
609
|
spinner,
|
|
605
610
|
});
|
package/oclif.manifest.json
CHANGED