@@ -32,7 +32,8 @@
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/integration": "workspace:^",
|
||||
"@backstage/plugin-search-common": "workspace:^",
|
||||
"front-matter": "^4.0.2"
|
||||
"front-matter": "^4.0.2",
|
||||
"luxon": "3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "workspace:^"
|
||||
|
||||
@@ -21,6 +21,7 @@ import { Entity, getEntitySourceLocation } from '@backstage/catalog-model';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import frontMatter from 'front-matter';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
/**
|
||||
* ADR plugin annotation.
|
||||
@@ -135,10 +136,12 @@ export const parseMadrWithFrontmatter = (content: string): ParsedMadr => {
|
||||
const parsed = frontMatter<Record<string, unknown>>(content);
|
||||
const status = parsed.attributes.status;
|
||||
const date = parsed.attributes.date;
|
||||
const luxdate = DateTime.fromJSDate(new Date(`${date}`));
|
||||
const formattedDate = luxdate.toISODate();
|
||||
return {
|
||||
content: parsed.body,
|
||||
status: status ? String(status) : undefined,
|
||||
date: date ? String(date) : undefined,
|
||||
date: date ? String(formattedDate) : undefined,
|
||||
attributes: parsed.attributes,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user