First development of the deploy action #6
9
index.js
9
index.js
@ -26,8 +26,13 @@ function readFilesIntoDict(pattern, prefix) {
|
|||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
let readPromise = fs.promises.readFile(file, 'utf8')
|
let readPromise = fs.promises.readFile(file, 'utf8')
|
||||||
.then(content => {
|
.then(content => {
|
||||||
// Correctly remove the prefix from the filename
|
// Remove the prefix from the filename and drop the file suffix
|
||||||
const key = prefix && file.startsWith(prefix) ? file.slice(prefix.length) : file;
|
let key = file;
|
||||||
|
if (prefix && file.startsWith(prefix)) {
|
||||||
|
key = key.slice(prefix.length);
|
||||||
|
}
|
||||||
|
key = path.basename(key, path.extname(key)); // Drop the file suffix
|
||||||
|
|
||||||
fileDict[key] = content;
|
fileDict[key] = content;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user