Several bug fixes and start for handling ms-graph calls and sharepoint basic storage #81

Merged
rodrigorodriguez merged 4 commits from master into master 2019-02-01 13:06:17 +00:00
Showing only changes of commit dd92032f62 - Show all commits

View file

@ -40,6 +40,18 @@ import * as ts from 'typescript';
const logger = require('../../../src/logger'); const logger = require('../../../src/logger');
export class TSCompiler { export class TSCompiler {
private static shouldIgnoreError(diagnostic) {
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
if (message.indexOf('Cannot find name') >= 0 || message.indexOf('Cannot use imports') >= 0) {
return true;
}
return false;
}
public compile( public compile(
fileNames: string[], fileNames: string[],
options: ts.CompilerOptions = { options: ts.CompilerOptions = {
@ -61,15 +73,19 @@ export class TSCompiler {
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
allDiagnostics.forEach(diagnostic => { allDiagnostics.forEach(diagnostic => {
if (diagnostic.file) { if (!TSCompiler.shouldIgnoreError(diagnostic)) {
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!);
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
if (diagnostic.file) {
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
logger.error(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); logger.error(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
} else { } else {
logger.error(`${ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`); logger.error(`${message}`);
}
} }
}); });
return emitResult; return emitResult;
} }
} }