-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd92629
commit b3b5b73
Showing
5 changed files
with
91 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ChangeLog } from "./components/ChangeLog"; | ||
import changelog from './codegen/changelog.codegen'; | ||
|
||
# Check out what the latest updates are | ||
|
||
<ChangeLog tags={changelog}/> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
const { execSync } = require('child_process'); | ||
const commitLog = execSync('git log --pretty="%H %aN %aE %s"').toString().trim(); | ||
const tagLog = execSync('git log --tags --no-walk --pretty="%H %S"').toString().trim(); | ||
|
||
const tags = Object.fromEntries(tagLog.split('\n').map(line => { | ||
const [hash, tag] = line.split(' '); | ||
return [hash, tag]; | ||
})); | ||
|
||
const commits = commitLog.split('\n').map(line => { | ||
const [hash, author, email, ...message] = line.split(' '); | ||
return { hash, author, email, message: message.join(' ') }; | ||
}); | ||
|
||
const taggedCommits = []; | ||
|
||
for (let i = 0; i < commits.length;) { | ||
let taggedCommit = { tag: tags[commits[i].hash], commits: []}; | ||
|
||
do { | ||
taggedCommit.commits.push(commits[i]); | ||
} | ||
while (++i < commits.length && !tags[commits[i].hash]); | ||
|
||
taggedCommits.push(taggedCommit); | ||
} | ||
|
||
|
||
module.exports = function () { | ||
return ` | ||
//@ts-nocheck | ||
export default ${JSON.stringify(taggedCommits)}; | ||
`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ReactElement } from "react"; | ||
import React from "react"; | ||
|
||
function TagWithCommits({ tag, commits }: { tag: string, commits: Commit[] }): ReactElement { | ||
return ( | ||
<> | ||
{tag || "Prerelease"} | ||
{ | ||
commits.map(v => ( | ||
<> | ||
* {v.message}<br /> | ||
</> | ||
)) | ||
} | ||
</> | ||
) | ||
} | ||
|
||
export function ChangeLog({ tags }: React.PropsWithChildren<{ tags: TaggedCommits[] }>): ReactElement { | ||
return ( | ||
<> | ||
{tags.map(({ tag, commits }) => <TagWithCommits tag={tag} commits={commits} />)} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters