Task/check file length (#9047)

* add filelength task to vscodeTasks

* added to package task instead of build

* testing for failures with reduced limits

* reverted to actual lengths
This commit is contained in:
Maddy
2020-02-06 16:45:10 -08:00
committed by GitHub
parent df3f1768f7
commit 32ac169906

View File

@@ -275,6 +275,9 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
}
let result = all
.pipe(fileLengthFilter)
.pipe(filelength)
.pipe(fileLengthFilter.restore)
.pipe(util.skipDirectories())
.pipe(util.fixWin32DirectoryPermissions())
.pipe(electron(_.extend({}, config, { platform, arch, ffmpegChromium: true })))
@@ -329,6 +332,29 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
};
}
const fileLengthFilter = filter([
'**',
'!extensions/import/*.docx',
'!extensions/admin-tool-ext-win/license/**'
], {restore: true});
const filelength = es.through(function (file) {
const fileName = path.basename(file.relative);
const fileDir = path.dirname(file.relative);
//check the filename is < 50 characters (basename gets the filename with extension).
if (fileName.length > 50) {
console.error(`File name '${fileName}' under ${fileDir} is too long. Rename file to have less than 50 characters.`);
throw new Error('File name exceeds acceptable length of 50 characters: ' + fileName);
}
if (file.relative.length > 150) {
console.error(`File path ${file.relative} exceeds acceptable file-length. Rename the path to have less than 150 characters.`);
throw new Error('File path exceeds acceptable path-length of 150 characters: ' + file.relative);
}
this.emit('data', file);
});
const buildRoot = path.dirname(root);
const BUILD_TARGETS = [