Skip to content

Commit

Permalink
#3 comment out diff
Browse files Browse the repository at this point in the history
  • Loading branch information
katai5plate committed Sep 19, 2021
1 parent 3684b3b commit 312b2b4
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions _scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require("fs-extra");
const pathLib = require("path");
const deepmerge = require("deepmerge");
const eol = require("eol");
const Diff = require("diff");
// const Diff = require("diff");
const prettier = require("prettier");
const { transform } = require("@babel/core");

Expand Down Expand Up @@ -104,28 +104,28 @@ module.exports = {
x.replace(/\r/g, "→").replace(/\n/g, "↵\n")
);
if (before !== after) {
const diff = Diff.diffChars(before, after);
console.log(
diff
.slice(
diff.findIndex((d) => d.added || d.removed),
-diff.reverse().findIndex((d) => d.added || d.removed)
)
.reduce(
(p, { added, removed, value }) =>
`${p}${
added || removed
? `\n==================== ${
added ? "ADD" : "REM"
} ==============================================================================================================\n|\n${value.replace(
/^/gm,
"| "
)}\n|\n=======================================================================================================================================\n`
: value
}`,
""
)
);
// const diff = Diff.diffChars(before, after);
// console.log(
// diff
// .slice(
// diff.findIndex((d) => d.added || d.removed),
// -diff.reverse().findIndex((d) => d.added || d.removed)
// )
// .reduce(
// (p, { added, removed, value }) =>
// `${p}${
// added || removed
// ? `\n==================== ${
// added ? "ADD" : "REM"
// } ==============================================================================================================\n|\n${value.replace(
// /^/gm,
// "| "
// )}\n|\n=======================================================================================================================================\n`
// : value
// }`,
// ""
// )
// );
return true;
}
return false;
Expand Down

0 comments on commit 312b2b4

Please sign in to comment.