Skip to content

Commit

Permalink
feat: add changelog page
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelblijleven committed Jun 29, 2023
1 parent 49e9cfd commit a485bd6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/lib/markdown/get-changelog.ts

This file was deleted.

29 changes: 29 additions & 0 deletions src/lib/versioning/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as path from "path";
import { promises as fs } from "fs";

const rootDir = process.cwd();

interface PackageJSON {
version: string;
}

export async function getChangelog(): Promise<string> {
const fullPath = path.join(rootDir, "CHANGELOG.md");
const content = await fs.readFile(fullPath);
return content.toString();
}

export async function getCurrentVersion(): Promise<string> {
const content = await fs.readFile(path.join(rootDir, "package.json"), "utf-8");
const json: PackageJSON = JSON.parse(content);
return json.version;
}

export async function getSha(): Promise<string> {
const rev = (await fs.readFile('.git/HEAD')).toString().trim();
if (rev.indexOf(':') === -1) {
return rev;
} else {
return (await fs.readFile('.git/' + rev.substring(5))).toString().trim();
}
}

0 comments on commit a485bd6

Please sign in to comment.