Skip to content

Commit

Permalink
Merge pull request #1218 from openapi-env-test/master
Browse files Browse the repository at this point in the history
Fix node-git error caused by nodejsv13
  • Loading branch information
leni-msft authored Sep 21, 2020
2 parents fe49cd0 + 2e2bc55 commit 791a4e1
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 350 deletions.
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

0 comments on commit 791a4e1

Please sign in to comment.