aboutsummaryrefslogtreecommitdiff
path: root/dev/util.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-14 20:25:41 -0500
committerGitHub <noreply@github.com>2021-02-14 20:25:41 -0500
commitd6332d2bc723f9aa60f2c886564bef49a6b91b84 (patch)
treea86c90cdc02f5a7d6633f69e48f3b9d289b61130 /dev/util.js
parentd97c84f8ac1ac3dc6e058057aa7a4ad5c54930ac (diff)
Test html script ordering (#1396)
* Simplify getAllFiles * Add test to validate script order * Update script include order * Update content script order * Update sw.js and corresponding lint * Update manifest
Diffstat (limited to 'dev/util.js')
-rw-r--r--dev/util.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/dev/util.js b/dev/util.js
index 85a478ac..a31cd9ac 100644
--- a/dev/util.js
+++ b/dev/util.js
@@ -76,7 +76,7 @@ function getArgs(args, argMap) {
return argMap;
}
-function getAllFiles(baseDirectory, relativeTo=null, predicate=null) {
+function getAllFiles(baseDirectory, predicate=null) {
const results = [];
const directories = [baseDirectory];
while (directories.length > 0) {
@@ -84,10 +84,10 @@ function getAllFiles(baseDirectory, relativeTo=null, predicate=null) {
const fileNames = fs.readdirSync(directory);
for (const fileName of fileNames) {
const fullFileName = path.join(directory, fileName);
- const relativeFileName = (relativeTo !== null ? path.relative(relativeTo, fullFileName) : fullFileName);
+ const relativeFileName = path.relative(baseDirectory, fullFileName);
const stats = fs.lstatSync(fullFileName);
if (stats.isFile()) {
- if (typeof predicate !== 'function' || predicate(fullFileName, directory, baseDirectory)) {
+ if (typeof predicate !== 'function' || predicate(relativeFileName)) {
results.push(relativeFileName);
}
} else if (stats.isDirectory()) {