Skip to content

Commit a975980

Browse files
authored
Merge pull request #841 from steveukx/feat/remove-legacy-promise
Fully deprecate legacy /promise interface
2 parents a6168ae + 87b0d75 commit a975980

25 files changed

+111
-606
lines changed

.changeset/friendly-apples-watch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"simple-git": minor
3+
---
4+
5+
Increase the level of deprecation notices for use of `simple-git/promise`, which will be fully removed in the next major

packages/test-typescript-consumer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"scripts": {
1414
"test": "yarn test:types && yarn test:jest",
15-
"test:types": "tsc -p tsconfig-standard.json && tsc -p tsconfig-promise.json",
15+
"test:types": "tsc",
1616
"test:jest": "jest"
1717
},
1818
"dependencies": {

packages/test-typescript-consumer/test/ts-promise-consumer.spec.ts

-29
This file was deleted.

packages/test-typescript-consumer/tsconfig-promise.json

-10
This file was deleted.

packages/test-typescript-consumer/tsconfig-standard.json

-10
This file was deleted.

packages/test-typescript-consumer/tsconfig.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
"moduleResolution": "Node",
66
"noEmit": true,
77
"composite": false,
8-
"esModuleInterop": true,
98
"baseUrl": ".",
10-
"paths": {}
11-
}
9+
"paths": {},
10+
"esModuleInterop": false,
11+
"allowSyntheticDefaultImports": false
12+
},
13+
"files": ["test/ts-default-from-root.spec.ts"]
1214
}

simple-git/promise.d.ts

-69
This file was deleted.

simple-git/promise.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// TODO: deprecation warning
2-
console.warn(`=============================================
1+
console.error(`=============================================
32
simple-git has supported promises / async await since version 2.6.0.
4-
Importing from 'simple-git/promise' has been deprecated and will be
5-
removed by July 2022.
3+
Importing from 'simple-git/promise' has been deprecated and will
4+
report this error until the next major release of version 4.
65
76
To upgrade, change all 'simple-git/promise' imports to just 'simple-git'
87
=============================================`);

simple-git/test/__fixtures__/instance.ts

-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,3 @@ export function newSimpleGit(...args: [] | [string] | [Partial<SimpleGitOptions>
44
const simpleGit = require('../..');
55
return simpleGit(...args);
66
}
7-
8-
export function newSimpleGitP(baseDir: unknown | string = '/tmp/example-repo') {
9-
if (typeof baseDir !== 'string') {
10-
throw new Error('Bad arguments to newSimpleGitP');
11-
}
12-
return require('../../promise')(baseDir);
13-
}

simple-git/test/consumer/ts-default-from-root.spec.ts

-79
This file was deleted.

simple-git/test/consumer/ts-gitp-from-root.spec.ts

-36
This file was deleted.

simple-git/test/consumer/ts-promise-consumer.spec.ts

-41
This file was deleted.

simple-git/test/consumer/tsconfig-promise.json

-14
This file was deleted.

simple-git/test/consumer/tsconfig-standard.json

-13
This file was deleted.

simple-git/test/integration/bad-initial-path.spec.ts

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { promiseError } from '@kwsites/promise-result';
21
import {
32
assertGitError,
43
createTestContext,
54
like,
65
newSimpleGit,
7-
newSimpleGitP,
86
SimpleGitTestContext,
97
} from '../__fixtures__';
108

@@ -15,24 +13,10 @@ describe('bad initial path', () => {
1513

1614
beforeEach(async () => (context = await createTestContext()));
1715

18-
it('simple-git/promise', async () => {
19-
const baseDir = context.path('foo');
20-
const git = newSimpleGitP(baseDir);
21-
22-
const errorInstance = await promiseError(git.init());
23-
assertGitError(errorInstance, `does not exist`, GitConstructError);
24-
expect(errorInstance).toHaveProperty(
25-
'config',
26-
like({
27-
baseDir,
28-
})
29-
);
30-
});
31-
3216
it('simple-git', async () => {
3317
const baseDir = context.path('foo');
3418

35-
let errorInstance: Error | undefined;
19+
let errorInstance: Error | unknown;
3620
try {
3721
newSimpleGit(baseDir);
3822
} catch (e) {

0 commit comments

Comments
 (0)