1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { CONFIG_PATH } from 'config.dev'; 17const fs = require('fs'); 18 19interface ConfigType { 20 name?: string, 21 url?: string, 22 branch?: string, 23 fullSdkAssembleList?: string, 24 basicSignList?: string, 25 coreSignList?: string 26 systemAppList?: string 27}; 28 29function checkProjectIfInFull(projectName: string) { 30 try { 31 const config: ConfigType = {}; 32 const configContent = fs.readFileSync(CONFIG_PATH, 'utf8'); 33 configContent.split('\n').forEach((line: string) => { 34 if (line.trim() !== '') { 35 const [key = '', value = ''] = line.split('='); 36 config[key.trim()] = value.trim(); 37 }; 38 }); 39 const fullSdkAssembleList: string[] = config.fullSdkAssembleList.split(';'); 40 return fullSdkAssembleList.includes(projectName); 41 } catch (e) { 42 return false; 43 }; 44} 45 46export { checkProjectIfInFull };