Skip to content

Commit

Permalink
Log all steps not just completed steps
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrgicak committed Jan 10, 2025
1 parent 0d4d24f commit 996db94
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion packages/playground/blueprints/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import '@php-wasm/node-polyfills';

export * from './lib/steps';
export * from './lib/steps/handlers';
export { runBlueprintSteps, compileBlueprint } from './lib/compile';
export {
runBlueprintSteps,
compileBlueprint,
isStepDefinition,
} from './lib/compile';
export type { Blueprint, PHPConstants } from './lib/blueprint';
export type {
CompiledStep,
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/blueprints/src/lib/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ function compileVersion<T>(
* @param step The object to test
* @returns Whether the object is a StepDefinition
*/
function isStepDefinition(
export function isStepDefinition(
step: Step | string | undefined | false | null
): step is StepDefinition {
return !!(typeof step === 'object' && step);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
logErrorEvent,
logTrackingEvent,
} from '../../tracking';
import { Blueprint } from '@wp-playground/blueprints';
import { Blueprint, isStepDefinition } from '@wp-playground/blueprints';
import { logger } from '@php-wasm/logger';
import { setupPostMessageRelay } from '@php-wasm/web';
import { startPlaygroundWeb } from '@wp-playground/client';
Expand Down Expand Up @@ -106,6 +106,15 @@ export function bootSiteClient(
blueprint = site.metadata.originalBlueprint;
}

if (blueprint.steps) {
for (const step of blueprint.steps) {
if (!isStepDefinition(step)) {
continue;
}
logBlueprintStepEvent(step);
}
}

let playground: PlaygroundClient;
try {
playground = await startPlaygroundWeb({
Expand All @@ -118,9 +127,6 @@ export function bootSiteClient(
onClientConnected: (playground) => {
(window as any)['playground'] = playground;
},
onBlueprintStepCompleted: (result, step) => {
logBlueprintStepEvent(step);
},
mounts: mountDescriptor
? [
{
Expand Down

0 comments on commit 996db94

Please sign in to comment.