Skip to content

Commit 791a4e1

Browse files
authored
Merge pull request #1218 from openapi-env-test/master
Fix node-git error caused by nodejsv13
2 parents fe49cd0 + 2e2bc55 commit 791a4e1

File tree

4 files changed

+84
-350
lines changed

4 files changed

+84
-350
lines changed

generator/cmd/postprocessor.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,29 @@ import { findAutogenEntries } from '../autogenlist';
55
import { saveAutogeneratedSchemaRefs, SchemaConfiguration, schemaPostProcess } from '../generate';
66
import * as constants from '../constants';
77

8+
function getStatus(file: any){
9+
var status;
10+
if (file.isNew()) status = 'new';
11+
else if (file.isModified()) status = 'modified';
12+
else if (file.isDeleted()) status = 'deleted';
13+
else if (file.isTypeChange()) status = 'typechange';
14+
else if (file.isRenamed()) status = 'renamed';
15+
else if (file.isIgnored()) status = 'ignored';
16+
17+
return {
18+
'path': file.path(),
19+
'status': status
20+
};
21+
}
22+
823
async function getChangedSchemas(repoPath: string) {
9-
var git = require('nodegit-kit');
10-
const repo = await git.open(repoPath);
11-
const status = await git.status(repo);
24+
var Git = require("nodegit");
25+
const repo = await Git.Repository.open(repoPath);
26+
const files = await repo.getStatus();
27+
let status = [];
28+
if (files.length) {
29+
status = files.map(getStatus);
30+
}
1231
const changedSchemas: { path: string, isNew: boolean }[] = [];
1332
for (const stat of status) {
1433
if (stat.path.toString().split(path.sep).indexOf('schemas') !== -1

0 commit comments

Comments
 (0)