All files / src/components source-code.ts

100% Statements 25/25
75% Branches 3/4
100% Functions 3/3
100% Lines 25/25

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 261x 1x 1x 1x 1x 1x 1x 1x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x  
import { FileBase, FileBaseOptions, Project } from 'projen';
import { codeBlock } from '../utils/code-block.js';
 
export interface SourceCodeOptions extends FileBaseOptions {
  codeBlock: string;
}
 
export class SourceCode extends FileBase {
  private startComment = '//';
 
  constructor(
    project: Project,
    filePath: string,
    private options: SourceCodeOptions,
  ) {
    super(project, filePath, options);
  }
 
  protected synthesizeContent(): string | undefined {
    const marker =
      this.readonly && this.marker ? `${this.startComment} ${this.marker}` : '';
 
    return `${marker}\n${codeBlock(this.options.codeBlock)}`;
  }
}