mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2025-02-08 09:50:40 +00:00
api check
Signed-off-by: wangqing <wangqing136@huawei.com>
This commit is contained in:
parent
249e8122f4
commit
ff170c2118
@ -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"), {});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user