-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(git-diff): add @d-zero/git-diff
#35
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
テストファイルを作ってください。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yusasa16 このファイルはpublish時に自動的に生成されるため、最初は不要です。ここでは削除しておいてください。
@@ -0,0 +1,22 @@ | |||
{ | |||
"name": "@d-zero/git-diff", | |||
"version": "1.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { execSync } from 'node:child_process'; | ||
|
||
const tag = | ||
process.argv[2] || execSync('git describe --tags --abbrev=0').toString('utf8').trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process.argv[2] || execSync('git describe --tags --abbrev=0').toString('utf8').trim(); | |
process.argv[2] ?? execSync('git describe --tags --abbrev=0').toString('utf8').trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
論理値ではないものの代入なので ||
ではなく ??
を使いましょう。
|
||
const tag = | ||
process.argv[2] || execSync('git describe --tags --abbrev=0').toString('utf8').trim(); | ||
const tag2 = process.argv[3] || 'HEAD'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const tag2 = process.argv[3] || 'HEAD'; | |
const tag2 = process.argv[3] ?? 'HEAD'; |
論理値ではないものの代入なので ||
ではなく ??
を使いましょう。
const gitDiff = `git diff --name-only ${tag} ${tag2} --diff-filter=ACMR`; | ||
const list = execSync(gitDiff).toString('utf8').trim(); | ||
// eslint-disable-next-line no-console | ||
console.log(list); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
出力がどんなものになるのか、出力されたものの何を読んで、何を判断するのか、ドキュメントか何かに記載してほしいです。
// eslint-disable-next-line no-console | ||
console.log(list); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line no-console | |
console.log(list); | |
process.stdout.write(`${list}\n`); |
gitのコミット間の差分を取得するツール
git-diff
の追加