• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
15import path from 'path';
16import { ApiResultSimpleInfo } from '../../typedef/checker/result_type';
17import { Check } from './src/api_check_plugin';
18import { TsSyntaxCheck } from './src/ts_check_plugin';
19import { FileUtils } from '../../utils/FileUtils';
20import { LogUtil } from '../../utils/logUtil';
21import { GenerateFile } from '../../utils/checkUtils';
22import { compositiveResult, compositiveLocalResult } from '../../utils/checkUtils';
23
24/**
25 * local entrance
26 */
27export class LocalEntry {
28  static checkEntryLocal(): ApiResultSimpleInfo[] {
29    const mdFilesPath = path.resolve(FileUtils.getBaseDirName(), '../mdFiles.txt');
30    let allResult: ApiResultSimpleInfo[] = compositiveResult;
31    try {
32      TsSyntaxCheck.checkAPISyntax(mdFilesPath);
33      Check.scanEntry(mdFilesPath);
34    } catch (error) {
35      LogUtil.e('API_CHECK_ERROR', error);
36    } finally {
37      GenerateFile.writeFile(compositiveResult, '../result.txt', {});
38      GenerateFile.writeExcelFile(compositiveLocalResult);
39    }
40    return allResult;
41  }
42}
43