prettify-bru 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/main.js +6 -4
- package/package.json +1 -1
package/lib/main.js
CHANGED
|
@@ -41,9 +41,9 @@ export async function main(cwd, path, write) {
|
|
|
41
41
|
for (const filePath of files) {
|
|
42
42
|
const outcome = await processFile(filePath, write);
|
|
43
43
|
|
|
44
|
-
let displayFilePath = filePath.replace(new RegExp('^' + cwd), "");
|
|
44
|
+
let displayFilePath = filePath.replace(new RegExp('^' + cwd + '/'), "");
|
|
45
45
|
|
|
46
|
-
if (outcome.
|
|
46
|
+
if (outcome.changeable) {
|
|
47
47
|
changeableFiles.push({displayFilePath, outcome});
|
|
48
48
|
} else if (outcome.error_messages.length) {
|
|
49
49
|
erroredFiles.push({displayFilePath, outcome});
|
|
@@ -69,8 +69,10 @@ export async function main(cwd, path, write) {
|
|
|
69
69
|
})
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
const requireNothing = files.length - changeableFiles.length - erroredFiles.length;
|
|
72
73
|
console.log(
|
|
73
|
-
`\x1b[35mProcessed ${files.length} .bru file(s)
|
|
74
|
+
`\x1b[35mProcessed ${files.length} .bru file(s):\x1b[0m ${changeablePrefix} in ${changeableFiles.length}. `
|
|
75
|
+
+ `Encountered errors in ${erroredFiles.length}. ${requireNothing} file(s) did not require any changes.`
|
|
74
76
|
);
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -99,7 +101,7 @@ async function processFile(filePath, write) {
|
|
|
99
101
|
|
|
100
102
|
const fileOutcome = await formatBlocks(original);
|
|
101
103
|
|
|
102
|
-
if (write && fileOutcome.
|
|
104
|
+
if (write && fileOutcome.changeable) {
|
|
103
105
|
fs.writeFileSync(filePath, fileOutcome.newContents, "utf8");
|
|
104
106
|
}
|
|
105
107
|
|