@swell/cli 2.5.5 → 2.5.6
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/dev.js +8 -2
- package/dist/commands/theme/dev.d.ts +1 -1
- package/dist/commands/theme/dev.js +4 -5
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/constants.js +2 -2
- package/dist/push-app-command.js +4 -2
- package/dist/remote-app-command.d.ts +1 -1
- package/dist/remote-app-command.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/dist/commands/app/dev.js
CHANGED
|
@@ -66,6 +66,10 @@ export default class AppDev extends PushAppCommand {
|
|
|
66
66
|
if (!noPush) {
|
|
67
67
|
await this.pushAppConfigs();
|
|
68
68
|
}
|
|
69
|
+
// Ensure storefront is resolved for local preview URL (may not be set with --no-push)
|
|
70
|
+
if (this.app.type === 'storefront' && !this.storefront) {
|
|
71
|
+
this.storefront = await this.getAppStorefront({});
|
|
72
|
+
}
|
|
69
73
|
this.saveCurrentStorefront();
|
|
70
74
|
const spinner = ora();
|
|
71
75
|
spinner.start(`Starting app dev server...\n`);
|
|
@@ -87,7 +91,7 @@ export default class AppDev extends PushAppCommand {
|
|
|
87
91
|
// Ignore errors during cleanup
|
|
88
92
|
}
|
|
89
93
|
this.log();
|
|
90
|
-
// eslint-disable-next-line no-process-exit
|
|
94
|
+
// eslint-disable-next-line no-process-exit, unicorn/no-process-exit
|
|
91
95
|
process.exit();
|
|
92
96
|
}
|
|
93
97
|
async runAppFrontendDevIfApplicable(frontendPort) {
|
|
@@ -100,7 +104,9 @@ export default class AppDev extends PushAppCommand {
|
|
|
100
104
|
// Store frontend port for function router to use for fallback routing
|
|
101
105
|
this.frontendPort = proxyPort;
|
|
102
106
|
this.argv.push('--proxy-port', String(proxyPort));
|
|
103
|
-
this.config
|
|
107
|
+
this.config
|
|
108
|
+
.runCommand('app:frontend:dev', this.argv)
|
|
109
|
+
.catch((error) => {
|
|
104
110
|
// SIGTERM/SIGINT during dev server shutdown is expected
|
|
105
111
|
if (error?.signal === 'SIGTERM' || error?.signal === 'SIGINT')
|
|
106
112
|
return;
|
|
@@ -13,7 +13,7 @@ export default class AppThemeDev extends PushAppCommand {
|
|
|
13
13
|
};
|
|
14
14
|
static summary: string;
|
|
15
15
|
appType: string;
|
|
16
|
-
logAppLocalUrl(storeId: string,
|
|
16
|
+
logAppLocalUrl(storeId: string, localId: string): void;
|
|
17
17
|
run(): Promise<void>;
|
|
18
18
|
private findAndInstallDependencies;
|
|
19
19
|
private findAndTryScriptCommands;
|
|
@@ -48,8 +48,8 @@ export default class AppThemeDev extends PushAppCommand {
|
|
|
48
48
|
};
|
|
49
49
|
static summary = `Run a theme in dev mode from your local machine.`;
|
|
50
50
|
appType = 'theme';
|
|
51
|
-
logAppLocalUrl(storeId,
|
|
52
|
-
this.log(`View it at ${style.link(this.localFrontendUrl(storeId,
|
|
51
|
+
logAppLocalUrl(storeId, localId) {
|
|
52
|
+
this.log(`View it at ${style.link(this.localFrontendUrl(storeId, localId))}\n`);
|
|
53
53
|
}
|
|
54
54
|
async run() {
|
|
55
55
|
const { flags } = await this.parse(AppThemeDev);
|
|
@@ -62,12 +62,11 @@ export default class AppThemeDev extends PushAppCommand {
|
|
|
62
62
|
if (!(await this.ensureAppExists(undefined, false))) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
+
await this.getStorefrontToPush(flags);
|
|
65
66
|
if (local) {
|
|
66
67
|
const currentStore = localConfig.getDefaultStore();
|
|
67
|
-
|
|
68
|
-
this.storefrontLocalUrl = this.localFrontendUrl(currentStore, sessionId);
|
|
68
|
+
this.storefrontLocalUrl = this.localFrontendUrl(currentStore, this.storefront.id);
|
|
69
69
|
}
|
|
70
|
-
await this.getStorefrontToPush(flags);
|
|
71
70
|
await this.logOrientation({ env: this.api.envId || 'live' });
|
|
72
71
|
this.logStorefrontConnected();
|
|
73
72
|
this.saveCurrentStorefront();
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export declare function getFrontendApiBaseUrl(storeId: string): any;
|
|
|
6
6
|
export declare function getLoginHost(storeId?: string): any;
|
|
7
7
|
export declare function getAppFrontendHost(storeId: string, installedAppId: string): any;
|
|
8
8
|
export declare function getStorefrontFrontendHost(storefrontSlug: string, branchId?: string): any;
|
|
9
|
-
export declare function getLocalFrontendHost(storeId: string,
|
|
9
|
+
export declare function getLocalFrontendHost(storeId: string, localId: string): any;
|
package/dist/lib/constants.js
CHANGED
|
@@ -35,8 +35,8 @@ export function getAppFrontendHost(storeId, installedAppId) {
|
|
|
35
35
|
export function getStorefrontFrontendHost(storefrontSlug, branchId) {
|
|
36
36
|
return STOREFRONT_FRONTEND_HOST.replace('${STOREFRONT_SLUG}', storefrontSlug).replace('${BRANCH_PREFIX}', branchId ? `${branchId}.` : '');
|
|
37
37
|
}
|
|
38
|
-
export function getLocalFrontendHost(storeId,
|
|
38
|
+
export function getLocalFrontendHost(storeId, localId) {
|
|
39
39
|
return APP_PAGES_HOST.replace('${STORE_ID}', storeId)
|
|
40
|
-
.replace('${APP_ID}',
|
|
40
|
+
.replace('${APP_ID}', localId)
|
|
41
41
|
.replace('${ENV}', 'local');
|
|
42
42
|
}
|
package/dist/push-app-command.js
CHANGED
|
@@ -784,11 +784,13 @@ export class PushAppCommand extends RemoteAppCommand {
|
|
|
784
784
|
return;
|
|
785
785
|
}
|
|
786
786
|
const currentStore = localConfig.getDefaultStore();
|
|
787
|
-
const
|
|
787
|
+
const localId = this.app.type === 'storefront' && this.storefront?.id
|
|
788
|
+
? this.storefront.id
|
|
789
|
+
: localConfig.getSessionId(currentStore);
|
|
788
790
|
const frontendAppRoute = this.app.type === 'storefront' && this.app.storefront?.external
|
|
789
791
|
? `/${this.app.private_id}`
|
|
790
792
|
: '';
|
|
791
|
-
this.log(`View it at ${style.link(`${this.localFrontendUrl(currentStore,
|
|
793
|
+
this.log(`View it at ${style.link(`${this.localFrontendUrl(currentStore, localId)}${frontendAppRoute}`)}\n`);
|
|
792
794
|
this.hasLoggedLocalPreviewUrl = true;
|
|
793
795
|
}
|
|
794
796
|
async setWatchingFiles() {
|
|
@@ -31,7 +31,7 @@ export declare abstract class RemoteAppCommand extends AppCommand {
|
|
|
31
31
|
init(): Promise<void>;
|
|
32
32
|
protected installApp(version: string, spinner?: any): Promise<any>;
|
|
33
33
|
isConfigDeprecated(config: AppConfig): boolean;
|
|
34
|
-
localFrontendUrl(storeId: string,
|
|
34
|
+
localFrontendUrl(storeId: string, localId: string): string;
|
|
35
35
|
logOrientation(orientation?: AppCommandOrientation): Promise<void>;
|
|
36
36
|
postConfigData(configJson: any): Promise<any>;
|
|
37
37
|
protected pullAppConfigs(force?: boolean, confirmRemove?: boolean): Promise<{
|
|
@@ -324,8 +324,8 @@ export class RemoteAppCommand extends AppCommand {
|
|
|
324
324
|
isConfigDeprecated(config) {
|
|
325
325
|
return !config.file_path;
|
|
326
326
|
}
|
|
327
|
-
localFrontendUrl(storeId,
|
|
328
|
-
return getLocalFrontendHost(storeId,
|
|
327
|
+
localFrontendUrl(storeId, localId) {
|
|
328
|
+
return getLocalFrontendHost(storeId, localId);
|
|
329
329
|
}
|
|
330
330
|
async logOrientation(orientation) {
|
|
331
331
|
const klass = this.ctor;
|
package/oclif.manifest.json
CHANGED