-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [1.0.0] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# `@d-zero/git-diff` | ||
|
||
gitの差分を持つファイルの一覧を取得するためのツールです。 | ||
|
||
## CLI | ||
|
||
```sh | ||
# HEADからタグが付いているコミットまでの差分を取得する場合 | ||
npx @d-zero/git-diff | ||
|
||
# HEADから特定のコミットまでの差分を取得する場合 | ||
npx @d-zero/git-diff <commit-hash> | ||
|
||
# 特定のコミットから特定のコミットまでの差分を取得する場合 | ||
npx @d-zero/git-diff <commit-hash> <commit-hash> | ||
``` | ||
|
||
差分を取得したいローカルリポジトリに移動し、上記コマンドを入力してください。 | ||
コミットのハッシュ値を指定する場合、古い方のコミットを先に入力してください |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"description": "Get a list of files with git diffs", | ||
"author": "D-ZERO", | ||
"license": "MIT", | ||
"private": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "./dist/index.js", | ||
"bin": { | ||
"git-diff": "./dist/index.js" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"clean": "tsc --build --clean" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,10 @@ | ||||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 論理値ではないものの代入なので |
||||||||
const tag2 = process.argv[3] || 'HEAD'; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
論理値ではないものの代入なので |
||||||||
// cspell:disable-next-line | ||||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. 出力がどんなものになるのか、出力されたものの何を読んで、何を判断するのか、ドキュメントか何かに記載してほしいです。
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"outDir": "./dist", | ||
"rootDir": "./src" | ||
}, | ||
"include": ["./src/**/*"], | ||
"exclude": ["node_modules", "dist", "./src/**/*.spec.ts"] | ||
} |
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時に自動的に生成されるため、最初は不要です。ここでは削除しておいてください。