Version 1.0.1
@stackline/git-diff-tree
Stream Git tree differences in Node.js while preserving the git-diff-tree event API
Installation
npm install @stackline/git-diff-tree@1.0.1Node.js: >=18. Read the compatibility and maintenance notes before migrating.
Usage and API
@stackline/git-diff-tree
Stream Git tree differences in Node.js while preserving the git-diff-tree event API.
Documentation | npm | Issues | Repository
Package version: 1.0.1
Why this package?
A scoped maintenance fork of git-diff-tree@1.1.0 by Alexandru Vladutu (MIT). It preserves the event API and diff parsers while replacing deprecated stream plumbing with native Node streams, forwarding patch errors correctly and safely finishing raw-only output. Requires Node.js 18 or newer and Git on PATH. UPSTREAM.json records the exact released source and integrity.
Install with npm install @stackline/git-diff-tree and use require("@stackline/git-diff-tree"). The original API documentation follows. npm test runs the two original scenarios on Node’s test runner plus stream, UTF-8 and real Git regressions. npm run build and npm run lint validate JavaScript syntax; npm run test:package validates a fresh packed consumer install.
This package installs the verified @stackline/git-spawned-stream@1.0.0 maintenance fork through the git-spawned-stream alias; its existing child-process and size-limit behavior remains unchanged. The public data event continues to use two arguments (type, data).
Shelling out to git-diff-tree(1) in a Node streamy fashion.
Compatibility
| Item | Value |
|---|---|
| Package | @stackline/git-diff-tree@1.0.1 |
| Supported Node.js | >=18 |
| Module entry | index.js (CommonJS) |
| Runtime dependencies | 1 direct dependency |
| External tool | Git available on PATH |
Installation
npm install @stackline/git-diff-tree
Usage
const gitDiffTree = require('@stackline/git-diff-tree');
const changes = gitDiffTree(process.cwd());
changes.on('data', (type, data) => console.log(type, data));
changes.on('error', error => { throw error; });
gitDiffTree(repoPath, [options]);
Where options defaults to:
{
rev : 'HEAD',
originalRev : '--root',
// don't output data for files that have more lines changed than allowed
MAX_DIFF_LINES_PER_FILE: 300,
// when the diff output is bigger than the limit destroy the stream
MAX_DIFF_SIZE: (3 * 1024 * 1024) // 3 Mb
}
Example:
var gitDiffTree = require('@stackline/git-diff-tree');
var path = require('path');
var repoPath = path.resolve(process.env.REPO || (__dirname + '/../.git'));
gitDiffTree(repoPath).on('data', function(type, data) {
if (type === 'raw') {
console.log('RAW DATA');
} else if (type === 'patch') {
console.log('PATCH DATA');
} else if (type === 'stats') {
console.log('FILE STATS');
} else if (type === 'noshow') {
console.log('Diffs not shown because files were too big');
}
console.log('------ \n');
console.log(data);
console.log('=================\n');
// console.log(type, data);
}).on('error', function(err) {
console.log('OH NOES!!');
throw err;
}).on('cut', function() {
console.log('-----------------');
console.log('Diff to big, got cut :|');
}).on('end', function() {
console.log('-----------------');
console.log("That's all folks");
});
Security
Git must be available on PATH. The existing limits for total diff size and changed lines per file are retained; configure them for the repository being processed.
API Surface
The usage reference above documents the existing public API and its input/output behavior.
Local Development
Clone the repository and run the following commands from its root:
npm ci
npm run build
npm test
npm run lint
The retained upstream development notes below include historical tooling; the commands above are the maintained package checks.
Upstream tests
npm test
Consumer Smoke Test
npm run test:package packs the library and exercises an isolated consumer using the repository fixture.
Release Checklist
- Update the package version, lockfile, generated version fields, and changelog together.
- Run the development checks above and audit both
npm auditandnpm audit --omit=dev. - Use the GitHub publish workflow with its
Prodenvironment to publish the exact CI tarball. - Verify public npm bytes, package identity, provenance, and the immutable GitHub release evidence.
Community and Support
Report reproducible package issues in the issue tracker.
License
MIT. Original copyright notices and upstream attribution are retained.
MIT
See NOTICE for retained attribution.
Release changes
Changelog
1.0.1 (2026-09-28)
Replace
git-spawned-streamwith exact aliasnpm:@stackline/git-spawned-stream@1.0.0, preserving existing import names.Standardize package documentation, preserve the API reference and upstream attribution, and add Stackline community links.
Add focused npm discovery keywords and consistent repository metadata.
Keep the runtime API unchanged; maintenance dependency aliases are listed above.
Correct the pinned artifact-upload action commit while preserving the publish.yml workflow and Prod environment.
1.0.0
- Replace pump-chain, split-transform-stream and direct through2 dependencies with Node Transform, StringDecoder and pipeline.
- Forward patch errors through the error event and destroy affected streams.
- Flush the final patch before end, handle raw-only output and preserve UTF-8 across chunks.
- Restore both published upstream test scenarios on node:test and add native-stream and real Git regressions.
Release files and references
Package bytes, npm provenance and the immutable GitHub release were verified for this version. Security checks describe the reviewed release; documented compatibility risks and upstream reports are not blanket claims of resolution.