Skip to content

Commit

Permalink
fix path issues with node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmjs committed Nov 26, 2022
1 parent db00282 commit 60c256b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/azle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { Err, ok, Ok, Result, unwrap } from './result';
import { red, yellow, green, blue, purple, dim } from './colors';
import * as tsc from 'typescript';
import * as path from 'path';

azle();

Expand Down Expand Up @@ -272,11 +273,9 @@ function getFileNames(tsPath: string): string[] {
const program = tsc.createProgram([tsPath], {});
const sourceFiles = program.getSourceFiles();

const root_absolute_path = require('path').join(__dirname, '..');

const fileNames = sourceFiles.map((sourceFile) => {
if (sourceFile.fileName.startsWith(root_absolute_path) === false) {
return `${process.cwd()}/${sourceFile.fileName}`;
if (!sourceFile.fileName.startsWith('/')) {
return path.join(process.cwd(), sourceFile.fileName);
} else {
return sourceFile.fileName;
}
Expand Down

0 comments on commit 60c256b

Please sign in to comment.