Skip to content

Commit

Permalink
fix(dev-env): demo code is displayed as [demo-image]
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jun 4, 2024
1 parent b81101c commit 8825c6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/dev-environment/dev-environment-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ interface LocalComponent {

interface ImageComponent {
mode: 'image';
tag: string;
tag: string | undefined;
}

export function processComponentOptionInput(
Expand All @@ -258,7 +258,7 @@ export function processComponentOptionInput(

return {
mode: 'image',
tag: param,
tag: param === 'demo' ? undefined : param,
};
}

Expand Down Expand Up @@ -412,10 +412,10 @@ async function processWordPress(
let result: WordPressConfig;
const allowLocal = false;
const defaultObject = defaultValue
? processComponentOptionInput( defaultValue, allowLocal )
? ( processComponentOptionInput( defaultValue, allowLocal ) as WordPressConfig )
: null;
if ( preselectedValue ) {
result = processComponentOptionInput( preselectedValue, allowLocal );
result = processComponentOptionInput( preselectedValue, allowLocal ) as WordPressConfig;
} else {
result = await promptForWordPress( defaultObject );
}
Expand Down
6 changes: 6 additions & 0 deletions src/lib/dev-environment/dev-environment-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ function parseComponentForInfo( component: ComponentConfig | WordPressConfig ):
if ( component.mode === 'local' ) {
return component.dir ?? '';
}

// Environments created by the old code will have `component.tag` set to `demo` instead of `undefined`.
if ( component.tag === 'demo' ) {
component.tag = undefined;
}

return component.tag ?? '[demo-image]';
}

Expand Down

0 comments on commit 8825c6d

Please sign in to comment.