constructor()

in packages/blueprints/test-blueprint/src/blueprint.ts [277:347]


  constructor(options_: Options) {
    super(options_);
    console.log(defaults);
    // helpful typecheck for defaults
    const typeCheck: Options = {
      outdir: this.outdir,
      ...defaults,
      runtimes: defaults.runtimes as Options['runtimes'],
    };
    const options = Object.assign(typeCheck, options_);

    if (!this.durableState.exists('inital-options')) {
      this.durableState.set('inital-options', options);
    }

    options.thisIsMyEnvironment.thisIsMyFirstAccountConnection;

    new OptionsSchema(this, 'optionsIdentifier', myOptions);

    // add a repository
    const repo = new SourceRepository(this, { title: 'code' });

    // example showing add files to the repository
    // assets get synth'd from the 'assets' folder. At synth time, the asset folder is a sibling of the blueprint.ts.
    new SourceFile(repo, 'wizard_input.json', JSON.stringify(options, null, 2));
    new Workflow(this, repo, NodeWorkflowDefinitionSamples.build);
    new Environment(this, options.thisIsMyEnvironment);
    new Secret(this, options.secret);

    // showcase the blueprint's own source files
    const blueprintInterface = fs.readFileSync('./lib/blueprint.d.ts').toString();
    const blueprintDefaults = fs.readFileSync('./lib/defaults.json').toString();
    const blueprintAST = fs.readFileSync('./lib/ast.json').toString();

    const internalRepo = new SourceRepository(this, { title: 'showcase-info' });

    // easy copying of static files
    internalRepo.copyStaticFiles({
      from: 'subdirectory/in/static/assets',
      to: 'subdirectory/in/my/repo',
    });

    this.setInstantiation({
      description: 'This is a overridden description',
    });

    new SourceFile(internalRepo, 'blueprint.d.ts', blueprintInterface);
    new SourceFile(internalRepo, 'defaults.json', blueprintDefaults);
    new SourceFile(internalRepo, 'internal/ast.json', blueprintAST);
    new SourceFile(internalRepo, 'internal/env.json', JSON.stringify(process.env, null, 2));
    new SourceFile(internalRepo, 'internal/blueprint-instantiation.json', JSON.stringify(this.context.project.blueprint || {}, null, 2));

    new SourceFile(internalRepo, 'internal/INSTANTIATIONS_ABS.json', JSON.stringify(this.context.project.blueprint, null, 2));

    new Issue(this, 'myFirstIssue', {
      title: 'myFirstIssue',
      content: 'this is an example issue',
    });

    new Issue(this, 'mySecondIssue', {
      title: 'mySecondIssue',
      content: 'this is an example high priority issue',
      priority: 'HIGH',
    });
    new Issue(this, 'myThirdIssue', {
      title: 'myThirdIssue',
      content: 'this is an example of a low priority issue with a label',
      priority: 'LOW',
      labels: ['exampleLabel'],
    });
  }