From ff170c21182f9d1063ef026529ea1673f264c0cb Mon Sep 17 00:00:00 2001 From: wangqing Date: Thu, 3 Nov 2022 14:47:42 +0800 Subject: [PATCH] api check Signed-off-by: wangqing --- build-tools/api_check_plugin/entry.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/build-tools/api_check_plugin/entry.js b/build-tools/api_check_plugin/entry.js index f1dcae64b..36b800684 100644 --- a/build-tools/api_check_plugin/entry.js +++ b/build-tools/api_check_plugin/entry.js @@ -19,27 +19,21 @@ const { writeResultFile } = require('./src/utils'); function checkEntry(url) { let result = ""; - result += `line:22,__dirname:::::${__dirname}\n`; - const path1 = path.resolve(__dirname, "entry.js"); - result += `line:24,first:::::::::path1::${path1} is ${fs.existsSync(path1)}\n`; const sourceDirname = __dirname; __dirname = "interface/sdk-js/build-tools/api_check_plugin"; + const mdFilesPath = path.resolve(sourceDirname, '../../../../', "readme_file.txt"); + const content = fs.readFileSync(mdFilesPath, "utf-8"); try { const execSync = require("child_process").execSync; execSync("cd interface/sdk-js/build-tools/api_check_plugin && npm install"); - const path2 = path.resolve(sourceDirname, '../../../../', "ci_tool/ci_build/readme_file.txt"); - result += `line:31,second:::::::::path2::${path2} is ${fs.existsSync(path2)}\n`; - const path3 = path.resolve(__dirname, '../../../../', "ci_tool/ci_build/readme_file.txt"); - result += `line:33,third::::::::::path3::${path3} is ${fs.existsSync(path3)}\n`; const { scanEntry } = require(path.resolve(__dirname, "./src/api_check_plugin")); - result += scanEntry(url); - const content = fs.readFileSync(url, "utf-8"); - result += `\nmdFilePath = ${url}, content = ${content}, __dirname = ${__dirname}, sourceDirname = ${sourceDirname}\n`; + result += scanEntry(mdFilesPath); + result += `,,,mdFilePath = ${mdFilesPath}, content = ${content}`; const { removeDir } = require(path.resolve(__dirname, "./src/utils")); removeDir(path.resolve(__dirname, "node_modules")); } catch (error) { // catch error - result += `CATCHERROR : ${error}, mdFilePath = ${url}, __dirname = ${__dirname}, sourceDirname = ${sourceDirname}`; + result += `CATCHERROR : ${error}, mdFilePath = ${mdFilesPath}, content = ${content}`; } writeResultFile(result, path.resolve(__dirname, "./Result.txt"), {}); }