Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!(dev-env): remove support for MailHog; use Mailpit instead #1813

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __fixtures__/dev-env-e2e/instance_data_mariadb.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"wpTitle":"VIP Dev","multisite":false,"elasticsearch":false,"php":"ghcr.io/automattic/vip-container-images/php-fpm:8.0","mariadb":"10.3","mediaRedirectDomain":"","wordpress":{"mode":"image","tag":"6.1"},"muPlugins":{"mode":"image"},"appCode":{"mode":"image"},"phpmyadmin":false,"xdebug":false,"xdebugConfig":"","siteSlug":"vip-local","mailhog":false}
{"wpTitle":"VIP Dev","multisite":false,"elasticsearch":false,"php":"ghcr.io/automattic/vip-container-images/php-fpm:8.0","mariadb":"10.3","mediaRedirectDomain":"","wordpress":{"mode":"image","tag":"6.1"},"muPlugins":{"mode":"image"},"appCode":{"mode":"image"},"phpmyadmin":false,"xdebug":false,"xdebugConfig":"","siteSlug":"vip-local"}
3 changes: 0 additions & 3 deletions src/bin/vip-dev-env-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
handleCLIException,
validateDependencies,
processStringOrBooleanOption,
handleDeprecatedOptions,
processSlug,
} from '../lib/dev-environment/dev-environment-cli';
import {
Expand Down Expand Up @@ -99,8 +98,6 @@ cmd.argv( process.argv, async ( arg, opt ) => {

debug( 'Args: ', arg, 'Options: ', opt );

handleDeprecatedOptions( opt );

const trackingInfo = {
slug,
app: opt.app,
Expand Down
1 change: 0 additions & 1 deletion src/bin/vip-dev-env-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const userMap = {
memcached: 'memcache',
elasticsearch: 'elasticsearch',
phpmyadmin: 'www-data',
mailhog: 'mailhog',
mailpit: 'root',
photon: 'root',
};
Expand Down
5 changes: 1 addition & 4 deletions src/bin/vip-dev-env-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
getEnvTrackingInfo,
getEnvironmentName,
handleCLIException,
handleDeprecatedOptions,
processSlug,
promptForArguments,
validateDependencies,
Expand Down Expand Up @@ -53,8 +52,6 @@ cmd.examples( examples );
cmd.argv( process.argv, async ( arg, opt ) => {
const slug = await getEnvironmentName( opt );

handleDeprecatedOptions( opt );

const lando = await bootstrapLando();
await validateDependencies( lando, slug );

Expand Down Expand Up @@ -97,7 +94,7 @@ cmd.argv( process.argv, async ( arg, opt ) => {
mariadb: currentInstanceData.mariadb,
phpmyadmin: currentInstanceData.phpmyadmin,
xdebug: currentInstanceData.xdebug,
mailpit: currentInstanceData.mailpit ?? currentInstanceData.mailhog,
mailpit: currentInstanceData.mailpit,
photon: currentInstanceData.photon,
mediaRedirectDomain: currentInstanceData.mediaRedirectDomain,
multisite: false,
Expand Down
21 changes: 0 additions & 21 deletions src/lib/dev-environment/dev-environment-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,6 @@ export function addDevEnvConfigurationOptions( command: Args ): Args {
'Domain to redirect for missing media files. This can be used to still have images without the need to import them locally.'
)
.option( 'php', 'Explicitly choose PHP version to use', undefined, processVersionOption )
.option(
[ 'G', 'mailhog' ],
'Enable Mailpit. By default it is disabled (deprecated option, please use --mailpit instead)',
undefined,
processBooleanOption
)
.option(
[ 'A', 'mailpit' ],
'Enable Mailpit. By default it is disabled',
Expand Down Expand Up @@ -995,18 +989,3 @@ const getVSCodeExecutable = () => {
}
return null;
};

export function handleDeprecatedOptions( opts: Record< string, unknown > ): void {
if ( opts.mailhog ) {
console.warn(
chalk.yellow(
'Warning: --mailhog is deprecated and will be removed in a future release. Please use --mailpit instead.'
)
);
if ( opts.mailpit === undefined ) {
opts.mailpit = opts.mailhog;
}

delete opts.mailhog;
}
}
4 changes: 2 additions & 2 deletions src/lib/dev-environment/dev-environment-configuration-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function sanitizeConfiguration(
elasticsearch: stringToBooleanIfDefined( configuration.elasticsearch ),
phpmyadmin: stringToBooleanIfDefined( configuration.phpmyadmin ),
xdebug: stringToBooleanIfDefined( configuration.xdebug ),
mailpit: stringToBooleanIfDefined( configuration.mailpit ?? configuration.mailhog ),
mailpit: stringToBooleanIfDefined( configuration.mailpit ),
'media-redirect-domain': configuration[ 'media-redirect-domain' ]?.toString(),
photon: stringToBooleanIfDefined( configuration.photon ),
meta: configurationMeta,
Expand Down Expand Up @@ -166,7 +166,7 @@ export function mergeConfigurationFileOptions(
phpmyadmin: configurationFileOptions.phpmyadmin,
xdebug: configurationFileOptions.xdebug,
xdebugConfig: configurationFileOptions[ 'xdebug-config' ],
mailpit: configurationFileOptions.mailpit ?? configurationFileOptions.mailhog,
mailpit: configurationFileOptions.mailpit,
mediaRedirectDomain: configurationFileOptions[ 'media-redirect-domain' ],
photon: configurationFileOptions.photon,
};
Expand Down
9 changes: 1 addition & 8 deletions src/lib/dev-environment/dev-environment-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,7 @@ function preProcessInstanceData( instanceData: InstanceData ): InstanceData {
}

// Mailpit migration
if ( ! newInstanceData.mailpit ) {
newInstanceData.mailpit = newInstanceData.mailhog ?? false;
}
newInstanceData.mailpit ??= false;

// MariaDB migration
if ( ! newInstanceData.mariadb ) {
Expand Down Expand Up @@ -447,11 +445,6 @@ export function readEnvironmentData( slug: string ): InstanceData {
instanceData.appCode = instanceData.clientCode as ComponentConfig;
}

if ( instanceData.mailhog ) {
instanceData.mailpit = instanceData.mailhog;
delete instanceData.mailhog;
}

return instanceData;
}

Expand Down
3 changes: 0 additions & 3 deletions src/lib/dev-environment/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface InstanceOptions {
phpmyadmin?: boolean;
xdebug?: boolean;
xdebugConfig?: string;
mailhog?: boolean; // Legacy
mailpit?: boolean;
photon?: boolean;

Expand Down Expand Up @@ -69,7 +68,6 @@ export interface ConfigurationFileOptions {
phpmyadmin?: boolean;
xdebug?: boolean;
'xdebug-config'?: string;
mailhog?: boolean; // Legacy
mailpit?: boolean;
'media-redirect-domain'?: string;
photon?: boolean;
Expand Down Expand Up @@ -97,7 +95,6 @@ export interface InstanceData {
mariadb?: string; // Legacy
php: string;
elasticsearch?: string | boolean;
mailhog?: boolean; // Legacy
mailpit: boolean;
photon: boolean;
pullAfter?: number;
Expand Down