Skip to content

Commit

Permalink
use outputPath to check if thi is a new file (#691)
Browse files Browse the repository at this point in the history
* use outputPath to check if thi is a new file

* use case-insensitive check

roku fs is case-insensitive
  • Loading branch information
ZeeD committed Sep 14, 2022
1 parent 33f8318 commit ad752b7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1388,13 +1388,13 @@ export class Program {
public async transpile(fileEntries: FileObj[], stagingFolderPath: string) {
const { entries, getOutputPath, astEditor } = this.beforeProgramTranspile(fileEntries, stagingFolderPath);

const processedFiles = new Set<File>();
const processedFiles = new Set<string>();

const transpileFile = async (srcPath: string, outputPath?: string) => {
//find the file in the program
const file = this.getFile(srcPath);
//mark this file as processed so we don't process it more than once
processedFiles.add(file);
processedFiles.add(outputPath?.toLowerCase());

//skip transpiling typedef files
if (isBrsFile(file) && file.isTypedef) {
Expand Down Expand Up @@ -1437,9 +1437,10 @@ export class Program {
for (const key in this.files) {
const file = this.files[key];
//this is a new file
if (!processedFiles.has(file)) {
const outputPath = getOutputPath(file);
if (!processedFiles.has(outputPath?.toLowerCase())) {
promises.push(
transpileFile(file?.srcPath, getOutputPath(file))
transpileFile(file?.srcPath, outputPath)
);
}
}
Expand Down

0 comments on commit ad752b7

Please sign in to comment.