forked from JetBrains/toolbox-browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TBX-4041: Generate dist README.md with git metadata
- Loading branch information
Showing
5 changed files
with
29 additions
and
7 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
build | ||
dist | ||
distribution/generate-readme.js |
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
const chidProcess = require('child_process'); | ||
const { writeFileSync } = require('fs'); | ||
|
||
const buffer = [ | ||
'The source code can be found here: [https://github.com/JetBrains/toolbox-browser-extension/](https://github.com/JetBrains/toolbox-browser-extension/).', | ||
'\nUse the following data as your reference:' | ||
]; | ||
|
||
const branch = chidProcess.execSync('git rev-parse --abbrev-ref HEAD').toString().trim(); | ||
buffer.push(`* Branch: ${branch}`); | ||
const longSHA = chidProcess.execSync("git rev-parse HEAD").toString().trim(); | ||
buffer.push(`* Commit SHA: ${longSHA}`); | ||
const shortSHA = chidProcess.execSync("git rev-parse --short HEAD").toString().trim(); | ||
buffer.push(`* Commit short SHA: ${shortSHA}`); | ||
const authorName = chidProcess.execSync("git log -1 --pretty=format:'%an'").toString().trim(); | ||
buffer.push(`* Commit author: ${authorName}`); | ||
const commitTime = chidProcess.execSync("git log -1 --pretty=format:'%cd'").toString().trim(); | ||
buffer.push(`* Commit time: ${commitTime}`); | ||
const commitMsg = chidProcess.execSync("git log -1 --pretty=%B").toString().trim(); | ||
buffer.push(`* Commit message: ${commitMsg}`); | ||
|
||
buffer.push('\nHow to build:'); | ||
buffer.push('1. Run \`yarn install\` to install all the dependencies'); | ||
buffer.push('2. Run \`yarn build\` to build the code and save it to the \'dist\' subfolder'); | ||
|
||
writeFileSync('dist/README.md', buffer.join('\n')); |
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