Files
cocos-engine/gulp/tasks/buildDebugInfos.js
pandamicro 1380e46c34 Unittest (#4973)
* unit test for ts

* Fix ts-jest warnings

* Remove puppeteer for now

* fix physics define and jest config for windows

* Replace Node ref with INode ref

* Fix ci issue

* Fix

* tweak

* tweak

* Fix vscode launcher

* now physics framework export all physics component (#28)

* tweaks
2019-07-25 17:15:20 +08:00

30 lines
975 B
JavaScript

const Fs = require('fs');
module.exports = function buildDebugInfos () {
let readContent = Fs.readFileSync('EngineErrorMap.md', 'utf-8');
let titleRegExp = /### \d+/g;
let debugInfos = {};
let result1 = titleRegExp.exec(readContent);
while (result1) {
let result2 = titleRegExp.exec(readContent);
let errInfoHead = result1.index + result1[0].length;
let errInfoTail = result2? result2.index: readContent.length;
let errCode = /\d+/.exec(result1[0])[0];
let errInfo = readContent.slice(errInfoHead, errInfoTail);
errInfo = errInfo.replace(/```/g, ' ');
errInfo = errInfo.trim();
errInfo = errInfo.replace(/\r\n/g, '\n');
if (!errInfo.includes('<!-- DEPRECATED -->')) {
debugInfos[`${errCode}`] = errInfo;
}
result1 = result2;
}
let writeContent = JSON.stringify(debugInfos, null, 4);
Fs.writeFileSync('DebugInfos.json', writeContent);
};