From f53a06a4033b3e9025c3feb42e219b52849da3fc Mon Sep 17 00:00:00 2001 From: Alex Ma Date: Fri, 16 Jul 2021 12:21:23 -0700 Subject: [PATCH] added delete zip files code (#16230) * added delete zip files code * removed space --- build/lib/locFunc.js | 9 +++++++-- build/lib/locFunc.ts | 11 +++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/build/lib/locFunc.js b/build/lib/locFunc.js index 514596ee6e..0dc357fd26 100644 --- a/build/lib/locFunc.js +++ b/build/lib/locFunc.js @@ -353,6 +353,11 @@ function renameVscodeLangpacks() { console.log('vscode pack is not in ADS yet: ' + langId); continue; } + //Delete any erroneous zip files found in vscode folder. + let globZipArray = glob.sync(path.join(locVSCODEFolder, '*.zip')); + globZipArray.forEach(element => { + fs.unlinkSync(element); + }); // Delete extension files in vscode language pack that are not in ADS. if (fs.existsSync(translationDataFolder)) { let totalExtensions = fs.readdirSync(path.join(translationDataFolder, 'extensions')); @@ -366,9 +371,9 @@ function renameVscodeLangpacks() { } } //Get list of md files in ADS langpack, to copy to vscode langpack prior to renaming. - let globArray = glob.sync(path.join(locADSFolder, '*.md')); + let globMDArray = glob.sync(path.join(locADSFolder, '*.md')); //Copy files to vscode langpack, then remove the ADS langpack, and finally rename the vscode langpack to match the ADS one. - globArray.forEach(element => { + globMDArray.forEach(element => { fs.copyFileSync(element, path.join(locVSCODEFolder, path.parse(element).base)); }); rimraf.sync(locADSFolder); diff --git a/build/lib/locFunc.ts b/build/lib/locFunc.ts index 05128ba18d..496a5af5ef 100644 --- a/build/lib/locFunc.ts +++ b/build/lib/locFunc.ts @@ -375,6 +375,13 @@ export function renameVscodeLangpacks(): Promise { console.log('vscode pack is not in ADS yet: ' + langId); continue; } + + //Delete any erroneous zip files found in vscode folder. + let globZipArray = glob.sync(path.join(locVSCODEFolder, '*.zip')); + globZipArray.forEach(element => { + fs.unlinkSync(element); + }); + // Delete extension files in vscode language pack that are not in ADS. if (fs.existsSync(translationDataFolder)) { let totalExtensions = fs.readdirSync(path.join(translationDataFolder, 'extensions')); @@ -389,10 +396,10 @@ export function renameVscodeLangpacks(): Promise { } //Get list of md files in ADS langpack, to copy to vscode langpack prior to renaming. - let globArray = glob.sync(path.join(locADSFolder, '*.md')); + let globMDArray = glob.sync(path.join(locADSFolder, '*.md')); //Copy files to vscode langpack, then remove the ADS langpack, and finally rename the vscode langpack to match the ADS one. - globArray.forEach(element => { + globMDArray.forEach(element => { fs.copyFileSync(element, path.join(locVSCODEFolder,path.parse(element).base)); }); rimraf.sync(locADSFolder);