[bazel] Run nodejs inside of bazel for genrules (#1948)

This commit is contained in:
Keith Smiley
2024-02-07 13:29:06 -05:00
committed by GitHub
parent f9c6c9c2be
commit 5cd2f73d77
24 changed files with 2910 additions and 179 deletions

View File

@@ -1,5 +1,6 @@
// Global functions //
const ejs = require('ejs');
const fs = require('fs');
const path = require('path');
@@ -59,3 +60,11 @@ global.writeIfModified = function(filename, newContent, output) {
}
console.warn(`* Updating outdated file '${filename}'`);
};
global.readAndCompile = function(filename, root) {
if (root) {
filename = path.resolve(path.join(root, filename));
}
return ejs.compile(fs.readFileSync(filename, 'utf8'), {strict: true});
}