docs: excalidraw package usage example tweaks (#2608)
Co-authored-by: Aakansha Doshi <monstershome@gmail.com>pull/2619/head
parent
325d1bec91
commit
34dcf998bd
@ -1,34 +1,34 @@
|
|||||||
const { exec } = require("child_process");
|
const { exec } = require("child_process");
|
||||||
|
|
||||||
const changeLogCheck = () => {
|
const normalizePath = (path) => path.replace(/\\+/g, "/").trim().toLowerCase();
|
||||||
exec(
|
|
||||||
"git diff origin/master --cached --name-only",
|
|
||||||
(error, stdout, stderr) => {
|
|
||||||
if (error || stderr) {
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!stdout || stdout.includes("packages/excalidraw/CHANGELOG.md")) {
|
const IGNORED_PATHS = [
|
||||||
process.exit(0);
|
"src/excalidraw-app",
|
||||||
}
|
"packages/utils",
|
||||||
|
"CHANGELOG.md",
|
||||||
|
"README.md",
|
||||||
|
].map(normalizePath);
|
||||||
|
|
||||||
const onlyNonSrcFilesUpdated = stdout.indexOf("src") < 0;
|
exec("git diff origin/master --cached --name-only", (error, stdout, stderr) => {
|
||||||
if (onlyNonSrcFilesUpdated) {
|
if (error || stderr) {
|
||||||
process.exit(0);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const changedFiles = stdout.trim().split("\n");
|
if (!stdout || stdout.includes("packages/excalidraw/CHANGELOG.md")) {
|
||||||
const filesToIgnoreRegex = /src\/excalidraw-app|packages\/utils/;
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
const excalidrawPackageFiles = changedFiles.filter((file) => {
|
const changedFiles = stdout.trim().split("\n").map(normalizePath);
|
||||||
return file.indexOf("src") >= 0 && !filesToIgnoreRegex.test(file);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (excalidrawPackageFiles.length) {
|
const excalidrawPackageFiles = changedFiles.filter((filename) => {
|
||||||
process.exit(1);
|
return (
|
||||||
}
|
filename.includes("src") &&
|
||||||
process.exit(0);
|
!IGNORED_PATHS.find((ignoredPath) => filename.includes(ignoredPath))
|
||||||
},
|
);
|
||||||
);
|
});
|
||||||
};
|
|
||||||
changeLogCheck();
|
if (excalidrawPackageFiles.length) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue