Skip to content

Commit

Permalink
Upgrade repo dependencies (#940)
Browse files Browse the repository at this point in the history
* Upgrade repo dependencies

* Update lerna config

* Add link to status documentation

* Docs, drop priority of v3 notice
  • Loading branch information
steveukx authored Aug 22, 2023
1 parent d184c13 commit 400b894
Show file tree
Hide file tree
Showing 13 changed files with 1,722 additions and 1,865 deletions.
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
}
},
"ignoreChanges": ["**/test/**", "**/*.md"],
"useWorkspaces": true,
"version": "2.48.0"
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"test": "lerna run test"
},
"dependencies": {
"@changesets/changelog-github": "^0.4.2",
"@changesets/cli": "^2.20.0",
"lerna": "^6.0.3",
"prettier": "^2.7.1"
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"lerna": "^7.1.4",
"prettier": "^3.0.1"
}
}
12 changes: 6 additions & 6 deletions simple-git/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@

A lightweight interface for running `git` commands in any [node.js](https://nodejs.org) application.

# Version 3 - Out Now

From v3 of `simple-git` you can now import as an ES module, Common JS module or as TypeScript with bundled type
definitions. Upgrading from v2 will be seamless for any application not relying on APIs that were marked as deprecated
in v2 (deprecation notices were logged to `stdout` as `console.warn` in v2).

# Installation

Use your favourite package manager:
Expand Down Expand Up @@ -183,6 +177,12 @@ Whether using a trailing callback or a Promise, tasks either return the raw `str

For type details of the response for each of the tasks, please see the [TypeScript definitions](https://github.com/steveukx/git-js/blob/main/simple-git/typings/simple-git.d.ts).

# Upgrading from Version 2

From v3 of `simple-git` you can now import as an ES module, Common JS module or as TypeScript with bundled type
definitions. Upgrading from v2 will be seamless for any application not relying on APIs that were marked as deprecated
in v2 (deprecation notices were logged to `stdout` as `console.warn` in v2).

# API

| API | What it does |
Expand Down
5 changes: 4 additions & 1 deletion simple-git/src/lib/errors/git-construct-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { SimpleGitOptions } from '../types';
* passed to the constructor.
*/
export class GitConstructError extends GitError {
constructor(public readonly config: SimpleGitOptions, message: string) {
constructor(
public readonly config: SimpleGitOptions,
message: string
) {
super(undefined, message);
}
}
5 changes: 4 additions & 1 deletion simple-git/src/lib/errors/git-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ import type { SimpleGitTask } from '../types';
```
*/
export class GitError extends Error {
constructor(public task?: SimpleGitTask<any>, message?: string) {
constructor(
public task?: SimpleGitTask<any>,
message?: string
) {
super(message);
Object.setPrototypeOf(this, new.target.prototype);
}
Expand Down
11 changes: 7 additions & 4 deletions simple-git/src/lib/parsers/parse-list-log-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ export const SPLITTER = ' ò ';
const defaultFieldNames = ['hash', 'date', 'message', 'refs', 'author_name', 'author_email'];

function lineBuilder(tokens: string[], fields: string[]): any {
return fields.reduce((line, field, index) => {
line[field] = tokens[index] || '';
return line;
}, Object.create({ diff: null }) as any);
return fields.reduce(
(line, field, index) => {
line[field] = tokens[index] || '';
return line;
},
Object.create({ diff: null }) as any
);
}

export function createListLogSummaryParser<T = any>(
Expand Down
6 changes: 5 additions & 1 deletion simple-git/src/lib/responses/FileStatusSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ export const fromPathRegex = /^(.+) -> (.+)$/;
export class FileStatusSummary implements FileStatusResult {
public readonly from: string | undefined;

constructor(public path: string, public index: string, public working_dir: string) {
constructor(
public path: string,
public index: string,
public working_dir: string
) {
if ('R' === index + working_dir) {
const detail = fromPathRegex.exec(path) || [null, path, path];
this.from = detail[1] || '';
Expand Down
5 changes: 4 additions & 1 deletion simple-git/src/lib/responses/TagList.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { TagResult } from '../../../typings';

export class TagList implements TagResult {
constructor(public readonly all: string[], public readonly latest: string | undefined) {}
constructor(
public readonly all: string[],
public readonly latest: string | undefined
) {}
}

export const parseTagList = function (data: string, customSort = false) {
Expand Down
5 changes: 4 additions & 1 deletion simple-git/src/lib/utils/git-output-streams.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { TaskResponseFormat } from '../types';

export class GitOutputStreams<T extends TaskResponseFormat = Buffer> {
constructor(public readonly stdOut: T, public readonly stdErr: T) {}
constructor(
public readonly stdOut: T,
public readonly stdErr: T
) {}

asStrings(): GitOutputStreams<string> {
return new GitOutputStreams(this.stdOut.toString('utf8'), this.stdErr.toString('utf8'));
Expand Down
12 changes: 6 additions & 6 deletions simple-git/test/unit/__fixtures__/responses/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function change(count: number, sign: '-' | '+') {
function line(insertions: SmallNumber, deletions: SmallNumber, fileName: string) {
return `
${fileName} | ${insertions + deletions} ${''.padEnd(insertions, '+')}${''.padEnd(
deletions,
'-'
)}`;
deletions,
'-'
)}`;
}

export function diffSummarySingleFile(
Expand Down Expand Up @@ -48,9 +48,9 @@ export function diffSummaryMultiFile(

stdOut += `
${files.length} file${files.length === 1 ? '' : 's'} changed ${change(add, '+')}${change(
del,
'-'
)}
del,
'-'
)}
`;
return createFixture(stdOut, '');
}
11 changes: 7 additions & 4 deletions simple-git/test/unit/promises.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ describe('promises', () => {
const resolveMockCallCount = (c: jest.Mock) => c.mock.calls.length;

function byName<T>(resolver: (c: jest.Mock) => T) {
return callbacks.reduce((all, callback) => {
all[callback.getMockName()] = resolver(callback);
return all;
}, {} as { [key: string]: T });
return callbacks.reduce(
(all, callback) => {
all[callback.getMockName()] = resolver(callback);
return all;
},
{} as { [key: string]: T }
);
}

return {
Expand Down
4 changes: 3 additions & 1 deletion simple-git/typings/response.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ export interface FileStatusResult {
index: string;

/** Second digit of the status code of the file. Represents status of the working directory
if no merge conflicts, otherwise represents status of other side of a merge. */
if no merge conflicts, otherwise represents status of other side of a merge.
See https://git-scm.com/docs/git-status#_short_format for full documentation of possible
values and their meanings. */
working_dir: string;
}

Expand Down
Loading

0 comments on commit 400b894

Please sign in to comment.