Open
Conversation
YusukeHirao
requested changes
May 16, 2024
Member
There was a problem hiding this comment.
@yusasa16 このファイルはpublish時に自動的に生成されるため、最初は不要です。ここでは削除しておいてください。
| @@ -0,0 +1,22 @@ | |||
| { | |||
| "name": "@d-zero/git-diff", | |||
| "version": "1.0.0", | |||
Member
There was a problem hiding this comment.
| import { execSync } from 'node:child_process'; | ||
|
|
||
| const tag = | ||
| process.argv[2] || execSync('git describe --tags --abbrev=0').toString('utf8').trim(); |
Member
There was a problem hiding this comment.
Suggested change
| process.argv[2] || execSync('git describe --tags --abbrev=0').toString('utf8').trim(); | |
| process.argv[2] ?? execSync('git describe --tags --abbrev=0').toString('utf8').trim(); |
Member
There was a problem hiding this comment.
論理値ではないものの代入なので || ではなく ?? を使いましょう。
|
|
||
| const tag = | ||
| process.argv[2] || execSync('git describe --tags --abbrev=0').toString('utf8').trim(); | ||
| const tag2 = process.argv[3] || 'HEAD'; |
Member
There was a problem hiding this comment.
Suggested change
| 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); |
Member
There was a problem hiding this comment.
出力がどんなものになるのか、出力されたものの何を読んで、何を判断するのか、ドキュメントか何かに記載してほしいです。
Comment on lines
+9
to
+10
| // eslint-disable-next-line no-console | ||
| console.log(list); |
Member
There was a problem hiding this comment.
Suggested change
| // eslint-disable-next-line no-console | |
| console.log(list); | |
| process.stdout.write(`${list}\n`); |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gitのコミット間の差分を取得するツール
git-diffの追加