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

Fix node-git error caused by nodejsv13 #1218

Merged
merged 13 commits into from
Sep 21, 2020
25 changes: 22 additions & 3 deletions generator/cmd/postprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,29 @@ import { findAutogenEntries } from '../autogenlist';
import { saveAutogeneratedSchemaRefs, SchemaConfiguration, schemaPostProcess } from '../generate';
import * as constants from '../constants';

function getStatus(file: any){
var status;
if (file.isNew()) status = 'new';
else if (file.isModified()) status = 'modified';
else if (file.isDeleted()) status = 'deleted';
else if (file.isTypeChange()) status = 'typechange';
else if (file.isRenamed()) status = 'renamed';
else if (file.isIgnored()) status = 'ignored';

return {
'path': file.path(),
'status': status
};
}

async function getChangedSchemas(repoPath: string) {
var git = require('nodegit-kit');
const repo = await git.open(repoPath);
const status = await git.status(repo);
var Git = require("nodegit");
const repo = await Git.Repository.open(repoPath);
const files = await repo.getStatus();
let status = [];
if (files.length) {
status = files.map(getStatus);
}
const changedSchemas: { path: string, isNew: boolean }[] = [];
for (const stat of status) {
if (stat.path.toString().split(path.sep).indexOf('schemas') !== -1
Expand Down
Loading