All files / src/sections run-locally.ts

100% Statements 26/26
100% Branches 5/5
100% Functions 3/3
100% Lines 26/26

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 271x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 1x 1x 3x 3x 1x 1x 1x 4x 4x  
import { type ListOptions, ListSection } from './list-section.js';
 
interface RunLocalStep {
  description: string;
  command: string;
}
 
export interface RunLocalOptions extends Partial<ListOptions<RunLocalStep>> {}
 
export class RunLocally extends ListSection<RunLocalStep> {
  constructor(options?: RunLocalOptions) {
    super({
      title: options?.title ?? 'Run Locally',
      type: 'Unordered',
      ...options,
    });
  }
 
  protected itemMapper(step: RunLocalStep): string {
    return [step.description, '', '```bash', step.command, '```'].join('\n');
  }
}
 
export function runLocallySection(options?: RunLocalOptions) {
  return new RunLocally(options);
}