Skip to content

Commit

Permalink
Fix mock.shop notification (#1992)
Browse files Browse the repository at this point in the history
* Fix notification about mock.shop + customer-account-push flag

* Changesets
  • Loading branch information
frandiox committed Apr 15, 2024
1 parent ffa57bd commit 9723eaf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-impalas-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-hydrogen': patch
---

Fix a warning when combining mock.shop and customer-account-push
4 changes: 2 additions & 2 deletions packages/cli/src/commands/hydrogen/dev-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export async function runViteDev({
cliCommand,
});

const {logInjectedVariables, localVariables} = await envPromise;
const {logInjectedVariables, allVariables} = await envPromise;

logInjectedVariables();
console.log('');
Expand Down Expand Up @@ -308,7 +308,7 @@ export async function runViteDev({
displayDevUpgradeNotice({targetPath: root});
}

if (customerAccountPushFlag && isMockShop(localVariables)) {
if (customerAccountPushFlag && isMockShop(allVariables)) {
notifyIssueWithTunnelAndMockShop(cliCommand);
}

Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/commands/hydrogen/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ export async function runDev({
async function safeStartMiniOxygen() {
if (miniOxygen) return;

const {allVariables, localVariables, logInjectedVariables} =
await envPromise;
const {allVariables, logInjectedVariables} = await envPromise;

miniOxygen = await startMiniOxygen(
{
Expand Down Expand Up @@ -316,7 +315,7 @@ export async function runDev({
displayDevUpgradeNotice({targetPath: appPath});
}

if (customerAccountPushFlag && isMockShop(localVariables)) {
if (customerAccountPushFlag && isMockShop(allVariables)) {
notifyIssueWithTunnelAndMockShop(cliCommand);
}
}
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/src/lib/dev-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import {getGraphiQLUrl} from './graphiql-url.js';

export function isMockShop(envVariables: Record<string, string>) {
return (
envVariables.PUBLIC_STORE_DOMAIN &&
envVariables.PUBLIC_STORE_DOMAIN.includes('mock.shop')
// We fallback to mock.shop if the env var is not set
!envVariables.PUBLIC_STORE_DOMAIN ||
envVariables.PUBLIC_STORE_DOMAIN === 'mock.shop'
);
}

Expand Down

0 comments on commit 9723eaf

Please sign in to comment.