Skip to content
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

Updates for node 14+ and newer dependencies #54

Merged
merged 3 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ lib
*.log
npm-debug.log*
.idea
package-lock.json

package-lock.json
8 changes: 8 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict'

module.exports = {
require: 'ts-node/register',
reporter: 'spec',
'watch-extensions': 'ts',
timeout: 80000
}
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ os:
- windows

node_js:
- '10'
- '12'
- '14'
- '16'

git:
depth: 1
Expand All @@ -21,8 +22,5 @@ branches:
only:
- master

install:
yarn

script:
yarn build && yarn test
npm run build && npm test
10 changes: 2 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"args": [
"${file}",
"--no-timeouts",
"--colors",
"--opts",
"${workspaceRoot}/mocha.opts"
"--colors"
],
"env": {
"TS_NODE_PROJECT": "${workspaceRoot}/tsconfig.json"
Expand All @@ -35,8 +33,6 @@
"${file}",
"--no-timeouts",
"--colors",
"--opts",
"${workspaceRoot}/mocha.opts"
],
"env": {
"TS_NODE_PROJECT": "${workspaceRoot}/tsconfig.json",
Expand All @@ -56,9 +52,7 @@
"args": [
"${file}",
"--no-timeouts",
"--colors",
"--opts",
"${workspaceRoot}/mocha.opts"
"--colors"
],
"env": {
"TS_NODE_PROJECT": "${workspaceRoot}/tsconfig.json",
Expand Down
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ High-level Git commands for [dugite-no-gpl](https://github.com/theia-ide/dugite)
## Requirements
```
"engines": {
"node": ">=10.11.0 <13"
"node": ">=10.11.0"
},
```
4 changes: 0 additions & 4 deletions mocha.opts

This file was deleted.

46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "dugite-extra",
"version": "0.1.14",
"version": "0.2.0",
"description": "High-level Git commands for dugite.",
"main": "lib/index",
"typings": "lib/index",
"engines": {
"node": ">=10.11.0 <13"
"node": ">=10.11.0"
},
"scripts": {
"build": "tsc && tslint -c ./tslint.json --project ./tsconfig.json",
"test": "cross-env USE_LOCAL_GIT=true mocha --opts ./mocha.opts src/**/*.spec.ts",
"prepare": "yarn run build && yarn run test",
"test:watch": "cross-env USE_LOCAL_GIT=true mocha -w --opts ./mocha.opts src/**/*.spec.ts",
"test:ssh": "cross-env GIT_OVER_SSH_TEST=true mocha --opts ./mocha.opts src/**/*.spec.ts",
"test": "cross-env USE_LOCAL_GIT=true mocha src/**/*.spec.ts",
"prepare": "npm run build && npm run test",
"test:watch": "cross-env USE_LOCAL_GIT=true mocha -w src/**/*.spec.ts",
"test:ssh": "cross-env GIT_OVER_SSH_TEST=true mocha src/**/*.spec.ts",
"clean": "rimraf ./lib",
"build:watch": "tsc -w",
"clean:all": "rimraf ./lib && rimraf ./node_modules"
Expand All @@ -34,26 +34,26 @@
"dependencies": {
"byline": "^5.0.0",
"dugite-no-gpl": "1.69.0",
"find-git-exec": "^0.0.3",
"upath": "^1.0.0"
"find-git-exec": "^0.0.4",
"upath": "^2.0.1"
},
"devDependencies": {
"@types/chai": "^4.2.5",
"@types/fs-extra": "^4.0.2",
"@types/mocha": "^5.2.7",
"@types/node": "^7.0.22",
"@types/temp": "^0.8.34",
"chai": "^4.2.0",
"concurrently": "^5.0.0",
"cross-env": "^6.0.3",
"fs-extra": "^4.0.2",
"mocha": "^6.2.2",
"node-ssh": "^6.0.0",
"@types/chai": "^4.2.22",
"@types/fs-extra": "^9.0.13",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.6",
"@types/temp": "^0.9.1",
"chai": "^4.3.4",
"concurrently": "^6.3.0",
"cross-env": "^7.0.3",
"fs-extra": "^10.0.0",
"mocha": "9.1.3",
"node-ssh": "^12.0.1",
"rimraf": "^3.0.0",
"temp": "^0.9.1",
"ts-node": "^8.5.2",
"tslint": "^5.20.1",
"temp": "^0.9.4",
"ts-node": "^10.4.0",
"tslint": "^6.1.3",
"tslint-no-unused-expression-chai": "^0.1.4",
"typescript": "~3.5.3"
"typescript": "~4.4.4"
}
}
8 changes: 4 additions & 4 deletions src/command/branch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ describe('branch', async () => {

const localBranches = await listBranch(path, 'all');
expect(localBranches.length).to.be.equal(2);
expect(localBranches[0].name).to.be.equal('master');
expect(localBranches[1].name).to.be.equal(newBranch);
expect(localBranches[1].name).to.be.equal('master');
expect(localBranches[0].name).to.be.equal(newBranch);

const currentBranch = await listBranch(path, 'current');
expect(currentBranch).to.not.be.undefined;
Expand All @@ -88,8 +88,8 @@ describe('branch', async () => {

const localBranches = await listBranch(path, 'all');
expect(localBranches.length).to.be.equal(2);
expect(localBranches[0].name).to.be.equal('master');
expect(localBranches[1].name).to.be.equal(newBranch);
expect(localBranches[1].name).to.be.equal('master');
expect(localBranches[0].name).to.be.equal(newBranch);

const currentBranch = await listBranch(path, 'current');
expect(currentBranch).to.not.be.undefined;
Expand Down
4 changes: 3 additions & 1 deletion src/command/branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async function getBranches(repositoryPath: string, prefixes: string[], options?:
// Remove the trailing newline.
lines.splice(-1, 1);

return lines.map((line, ix) => {
let branches = lines.map((line, ix) => {
// Preceding newline character after first row.
const pieces = (ix > 0 ? line.substr(1) : line).split('\0');

Expand All @@ -125,4 +125,6 @@ async function getBranches(repositoryPath: string, prefixes: string[], options?:
const type = ref.startsWith('refs/head') ? BranchType.Local : BranchType.Remote;
return new Branch(name, upstream.length > 0 ? upstream : undefined, tip, type);
});
if (process.platform === 'darwin') { branches.reverse(); }
return branches;
}
6 changes: 3 additions & 3 deletions src/command/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const upath = require('upath');
const normalizeSafe: (path: string) => string = upath.normalizeSafe;

const successExitCodes = new Set([0, 1]);
const utf8Encoding: (process: ChildProcess) => void = cb => cb.stdout.setEncoding('utf8');
const binaryEncoding: (process: ChildProcess) => void = cb => cb.stdout.setEncoding('binary');
const utf8Encoding: (process: ChildProcess) => void = cb => cb.stdout?.setEncoding('utf8');
const binaryEncoding: (process: ChildProcess) => void = cb => cb.stdout?.setEncoding('binary');

/**
* Retrieve the text (UTF-8) contents of a file from the repository at a given
Expand Down Expand Up @@ -53,4 +53,4 @@ export async function getBlobContents(repositoryPath: string, commitish: string,
};
const blobContents = await git(args, repositoryPath, 'getBlobContents', opts);
return Buffer.from(blobContents.stdout, 'binary');
}
}
Loading