From 2f0205011a511b400155239224c03db076f78a2e Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 25 May 2020 12:35:35 +0800 Subject: [PATCH] chore: git add staged and formatted files --- docs/.format/format.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/.format/format.js b/docs/.format/format.js index 719df9f0ab..f25ddac869 100644 --- a/docs/.format/format.js +++ b/docs/.format/format.js @@ -99,6 +99,7 @@ const buildStagedList = async () => { // console.log(fileList); // return + const stagedFiles = await sgf(); for (const processor of processors) { // We don't want to mix up processor /* eslint-disable no-await-in-loop */ @@ -107,7 +108,9 @@ const buildStagedList = async () => { let formatted = await file.readFile(e.path); formatted = await processor.handler(formatted); await file.writeFile(e.path, formatted); - await exec(`git add ${e.path}`); + if (stagedFiles.find((x) => e.path.indexOf(x.filename) !== -1)) { + await exec(`git add ${e.path}`); + } }) ).catch((err) => { // eslint-disable-next-line no-console