Skip to content

Commit

Permalink
Test script auto-compiles all source files
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Jun 25, 2021
1 parent 1ae9591 commit 5cb562d
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const {transformSync} = require('@babel/core');
const {btoa} = require('base64');
const {mkdirSync, readFileSync, writeFileSync} = require('fs');
const {
lstatSync,
mkdirSync,
readdirSync,
readFileSync,
writeFileSync,
} = require('fs');
const {emptyDirSync} = require('fs-extra');
const {resolve} = require('path');

Expand Down Expand Up @@ -57,4 +63,11 @@ function compile(fileName) {
);
}

compile('SimpleComponent.js');
// Compile all files in the current directory
const entries = readdirSync(sourceDir);
entries.forEach(entry => {
const stat = lstatSync(resolve(sourceDir, entry));
if (!stat.isDirectory() && entry.endsWith('.js')) {
compile(entry);
}
});

0 comments on commit 5cb562d

Please sign in to comment.