diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/verify-all.js | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/scripts/verify-all.js b/scripts/verify-all.js index af0bab9..da8b82f 100644 --- a/scripts/verify-all.js +++ b/scripts/verify-all.js | |||
@@ -54,20 +54,23 @@ const decompress = (src, dest) => new Promise((resolve, reject) => { | |||
54 | await fs.mkdir(tempUncompressed); | 54 | await fs.mkdir(tempUncompressed); |
55 | 55 | ||
56 | // Package to uncompressed recipe to .tar.gz | 56 | // Package to uncompressed recipe to .tar.gz |
57 | console.log(`Decompressing ${recipe} (${recipeNum + 1} of ${all.length})...`); | ||
58 | await decompress(compressedRecipe, tempUncompressed); | 57 | await decompress(compressedRecipe, tempUncompressed); |
59 | 58 | ||
60 | // Compare directories | 59 | // Compare directories |
61 | const compare = dircompare.compareSync(uncompressedRecipe, tempUncompressed, { | 60 | const compare = await dircompare.compare(uncompressedRecipe, tempUncompressed, { |
62 | compareContent: true, | 61 | compareContent: true, |
63 | // Don't fail because of DS_Store files | 62 | // Don't fail because of DS_Store files |
64 | excludeFilter: '.DS_Store', | 63 | excludeFilter: '.DS_Store', |
65 | ignoreLineEnding: true, | 64 | compareFileAsync: async (path1, stat1, path2, stat2, options) => { |
66 | ignoreWhiteSpaces: true, | 65 | const f1 = await fs.readFile(path1, 'utf-8'); |
66 | const f2 = await fs.readFile(path2, 'utf-8'); | ||
67 | |||
68 | return f1 === f2; | ||
69 | } | ||
67 | }); | 70 | }); |
68 | 71 | ||
69 | if (compare.same) { | 72 | if (compare.same) { |
70 | console.log(`✓ ${recipe} is valid`); | 73 | console.log(`✓ ${recipe} is valid (${recipeNum + 1} of ${all.length})`); |
71 | } else { | 74 | } else { |
72 | console.log(`❌ Compressed and uncompressed files for "${recipe}" are NOT equal:`); | 75 | console.log(`❌ Compressed and uncompressed files for "${recipe}" are NOT equal:`); |
73 | 76 | ||
@@ -75,22 +78,10 @@ const decompress = (src, dest) => new Promise((resolve, reject) => { | |||
75 | for (const file of compare.diffSet) { | 78 | for (const file of compare.diffSet) { |
76 | if (file.state !== 'equal') { | 79 | if (file.state !== 'equal') { |
77 | console.log(`- "${file.name1 || file.name2}" is not equal (${file.type1} in uncompressed, ${file.type2} in archive)`); | 80 | console.log(`- "${file.name1 || file.name2}" is not equal (${file.type1} in uncompressed, ${file.type2} in archive)`); |
78 | |||
79 | if (file.name1) { | ||
80 | const filePath = path.join(file.path1, file.name1); | ||
81 | console.log('File1:', await fs.readFile(filePath, 'utf-8')); | ||
82 | } | ||
83 | if (file.name2) { | ||
84 | const filePath = path.join(file.path2, file.name2); | ||
85 | console.log('File2:', await fs.readFile(filePath, 'utf-8')); | ||
86 | } | ||
87 | } | 81 | } |
88 | } | 82 | } |
89 | 83 | ||
90 | console.log(compare.diffSet); | 84 | process.exit(1); |
91 | |||
92 | // TODO: REENABLE! | ||
93 | //process.exit(1); | ||
94 | } | 85 | } |
95 | 86 | ||
96 | // Remove temporary compressed file | 87 | // Remove temporary compressed file |