//Read all the content of 'static' folder, replace placeholders, and add the files to the context
  async beforeCreateBlueprint(
    context: blueprintTypes.DsgContext,
    eventParams: blueprint.CreateBlueprintParams,
  ): Promise<blueprint.CreateBlueprintParams> {
    context.logger.info("Generating Files from core plugin...");

    const params = {} as Record<string, string>;

    params.SERVICE_DISPLAY_NAME = context.resourceInfo?.name || "Service Name";
    params.SERVICE_NAME = pascalCase(params.SERVICE_DISPLAY_NAME);

    //resource catalog properties
    const resourceCatalogProperties = (context.resourceInfo?.properties ||
      {}) as Record<string, string>;
    const resourceSetting = (context.resourceSettings?.properties ||
      ({} as Record<string, string>)) as Record<string, string>;

    //all catalog and resource settings are available for use in the template
    const placeholders = {
      ...params,
      ...resourceCatalogProperties,
      ...resourceSetting,
    };

    const stringReplacements = {
      OrdersMicroservice: params.SERVICE_NAME,
    };

    // set the path to the static files and fetch them for manipulation
    const staticPath = resolve(__dirname, "./static");
    const files = await context.utils.importStaticFilesWithReplacements(
      staticPath,
      ".",
      placeholders,
      stringReplacements,
    );

    for (const file of files.getAll()) {
      const codeBlock: IFile<CodeBlock> = {
        path: file.path,
        code: new CodeBlock({
          code: file.code,
        }),
      };
      context.files.set(codeBlock);
    }

    return eventParams;

}

Event Name

createBlueprint

Event Parameters

This event does not use any additional parameters.

  //Read all the content of 'static' folder, replace placeholders, and add the files to the context
  async beforeCreateBlueprint(
    context: blueprintTypes.DsgContext,
    eventParams: blueprint.CreateBlueprintParams,
  ): Promise<blueprint.CreateBlueprintParams> {
    context.logger.info("Generating Files from core plugin...");

    const params = {} as Record<string, string>;

    params.SERVICE_DISPLAY_NAME = context.resourceInfo?.name || "Service Name";
    params.SERVICE_NAME = pascalCase(params.SERVICE_DISPLAY_NAME);

    //resource catalog properties
    const resourceCatalogProperties = (context.resourceInfo?.properties ||
      {}) as Record<string, string>;
    const resourceSetting = (context.resourceSettings?.properties ||
      ({} as Record<string, string>)) as Record<string, string>;

    //all catalog and resource settings are available for use in the template
    const placeholders = {
      ...params,
      ...resourceCatalogProperties,
      ...resourceSetting,
    };

    const stringReplacements = {
      OrdersMicroservice: params.SERVICE_NAME,
    };

    // set the path to the static files and fetch them for manipulation
    const staticPath = resolve(__dirname, "./static");
    const files = await context.utils.importStaticFilesWithReplacements(
      staticPath,
      ".",
      placeholders,
      stringReplacements,
    );

    for (const file of files.getAll()) {
      const codeBlock: IFile<CodeBlock> = {
        path: file.path,
        code: new CodeBlock({
          code: file.code,
        }),
      };
      context.files.set(codeBlock);
    }

    return eventParams;

}