Skip to content

Commit

Permalink
script fix and tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Simek committed Jun 8, 2024
1 parent afd664b commit f60f888
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/scripts/append-dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ async function appendModificationDate(dir = './pages') {
);

const fileContent = (await readFile(filePath, 'utf8')).split('\n');
const modificationDateLine = `modificationDate: ${stdout.replace('\n', '')}`;
const cleanDate = stdout.replace('\n', '').replaceAll('"', '');
const modificationDateLine = `modificationDate: ${cleanDate}`;

if (!fileContent[1].startsWith('modificationDate')) {
fileContent.splice(1, 0, modificationDateLine);
} else {
fileContent[1] = modificationDateLine;
}

await writeFile(filePath, fileContent.join('\n'), 'utf8');
Expand Down

0 comments on commit f60f888

Please sign in to comment.