From 7797d9177a7e3d83d4acbf0c0b5f1da9682a03a2 Mon Sep 17 00:00:00 2001 From: PBK-Bin Date: Thu, 1 Jul 2021 19:16:31 +0800 Subject: [PATCH] fix: Repair Android styles.xml Code indentation causes repeated additions styles code --- src/services/file.processing.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/file.processing.ts b/src/services/file.processing.ts index 8e376ff..79daa17 100644 --- a/src/services/file.processing.ts +++ b/src/services/file.processing.ts @@ -19,8 +19,8 @@ export const applyPatch = ( path: string, { patch, pattern }: { patch: string; pattern: string | RegExp } ) => { - if (!readFile(path).includes(patch)) { - writeFileSync(path, readFileSync(path, 'utf8').replace(pattern, match => `${match}${patch}`)); + if (!readFile(path).replace(/[\ +]|[\s\t\r\n]/g, "").includes(patch.replace(/[\ +]|[\s\t\r\n]/g, ""))) { + writeFileSync(path, readFileSync(path, 'utf8').replace(pattern, (match: any) => `${match}${patch}`)); } };