diff --git a/packages/playground/blueprints/src/lib/steps/activate-plugin.ts b/packages/playground/blueprints/src/lib/steps/activate-plugin.ts index 706b0a8211..20a506f27a 100644 --- a/packages/playground/blueprints/src/lib/steps/activate-plugin.ts +++ b/packages/playground/blueprints/src/lib/steps/activate-plugin.ts @@ -67,6 +67,9 @@ export const activatePlugin: StepHandler = async ( die( $response->get_error_message() ); } else if ( false === $response ) { die( "The activatePlugin step wasn't able to find the plugin $plugin_path." ); + } else if ( $response === null ) { + // When the response is null, the plugin was successfully activated + die( 'true' ); } `, env: { @@ -75,6 +78,12 @@ export const activatePlugin: StepHandler = async ( }, }); if (activatePluginResult.text) { + /** + * If the plugin was successfully activated, we can return early. + */ + if (activatePluginResult.text === 'true') { + return; + } logger.warn( `Plugin ${pluginPath} activation printed the following bytes: ${activatePluginResult.text}` ); diff --git a/packages/playground/blueprints/src/lib/steps/install-asset.ts b/packages/playground/blueprints/src/lib/steps/install-asset.ts index 13f49a0048..8ff25e73cf 100644 --- a/packages/playground/blueprints/src/lib/steps/install-asset.ts +++ b/packages/playground/blueprints/src/lib/steps/install-asset.ts @@ -35,7 +35,7 @@ export async function installAsset( targetPath, zipFile, ifAlreadyInstalled = 'overwrite', - targetFolderName = '' + targetFolderName = '', }: InstallAssetOptions ): Promise<{ assetFolderPath: string; @@ -43,7 +43,15 @@ export async function installAsset( }> { // Extract to temporary folder so we can find asset folder name const zipFileName = zipFile.name; - const assetNameGuess = zipFileName.replace(/\.zip$/, ''); + let assetNameGuess = zipFileName.replace(/\.zip$/, ''); + /** + * Some resource types like GitDirectoryReference and UrlReference + * don't have a name, so we need to generate a random name to ensure + * the asset folder name exists. + */ + if (!zipFileName) { + assetNameGuess = `${randomString(32, '')}`; + } const wpContent = joinPaths(await playground.documentRoot, 'wp-content'); const tmpDir = joinPaths(wpContent, randomString()); @@ -88,7 +96,7 @@ export async function installAsset( } // If a specific slug was requested be used, use that. - if ( targetFolderName && targetFolderName.length ) { + if (targetFolderName && targetFolderName.length) { assetFolderName = targetFolderName; }