-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding feature detection table publish script
- Loading branch information
Showing
8 changed files
with
175 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,7 @@ temp/ | |
|
||
|
||
#generated files | ||
/generated-wasm/** | ||
/generated-wasm/** | ||
|
||
#test run | ||
/TestResults/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"dependencies": { | ||
"wabt": "^1.0.36" | ||
"he": "^1.2.0", | ||
"wabt": "^1.0.36", | ||
"xml2js": "^0.6.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
const fs = require('fs').promises; | ||
const xml2js = require('xml2js'); | ||
const path = require('path'); | ||
const he = require("he"); | ||
|
||
class TrxToMarkdown { | ||
constructor() { | ||
this.parser = new xml2js.Parser(); | ||
} | ||
|
||
async convertFile(inputPath, outputPath) { | ||
try { | ||
const xmlData = await fs.readFile(inputPath, 'utf8'); | ||
const result = await this.parser.parseStringPromise(xmlData); | ||
const markdown = this.generateMarkdown(result); | ||
await fs.writeFile(outputPath, markdown); | ||
console.log(`Successfully converted ${inputPath} to ${outputPath}`); | ||
} catch (error) { | ||
console.error('Error converting file:', error); | ||
throw error; | ||
} | ||
} | ||
|
||
generateMarkdown(trxData) { | ||
const testRun = trxData.TestRun; | ||
const results = testRun.Results[0].UnitTestResult; | ||
|
||
let tests = []; | ||
results.forEach(result => { | ||
const test = result['$']; | ||
const jsonStartIndex = test.testName.indexOf('{'); | ||
const jsonString = test.testName.slice(jsonStartIndex, -1); | ||
|
||
function decodeHtmlEntities(str) { | ||
const he = require('he'); | ||
return he.decode(str); | ||
} | ||
|
||
const json = decodeHtmlEntities(jsonString); | ||
const testDef = JSON.parse(json); | ||
testDef['outcome'] = test.outcome; | ||
|
||
tests.push(testDef); | ||
}); | ||
|
||
let markdown = []; | ||
|
||
markdown.push(`|Proposal |Features| |`); | ||
markdown.push(`|------|-------|----|`); | ||
|
||
tests.sort((a, b) => (a.Id || '').localeCompare(b.Id || '')); | ||
|
||
tests.forEach(testDef => { | ||
markdown.push(`|[${testDef['Name']}](${testDef['Proposal']})|${testDef['Features']}|${testDef['outcome'] === 'Failed'?'❌':'✅'}|`); | ||
}); | ||
|
||
return markdown.join('\n'); | ||
} | ||
} | ||
|
||
// CLI implementation | ||
async function main() { | ||
if (process.argv.length !== 4) { | ||
console.log('Usage: node trx-to-markdown.js <input.trx> <output.md>'); | ||
process.exit(1); | ||
} | ||
|
||
const inputFile = process.argv[2]; | ||
const outputFile = process.argv[3]; | ||
|
||
try { | ||
const converter = new TrxToMarkdown(); | ||
await converter.convertFile(inputFile, outputFile); | ||
} catch (error) { | ||
console.error('Conversion failed:', error); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
if (require.main === module) { | ||
main(); | ||
} | ||
|
||
module.exports = TrxToMarkdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|Proposal |Features| | | ||
|------|-------|----| | ||
|[BigInt integration](https://github.com/WebAssembly/JS-BigInt-integration)||✅| | ||
|[Bulk memory operations](https://github.com/webassembly/bulk-memory-operations)||✅| | ||
|[Legacy Exception Handling](https://github.com/WebAssembly/exception-handling)|exceptions|❌| | ||
|[Exception Handling with exnref](https://github.com/WebAssembly/exception-handling)|exceptions|❌| | ||
|[Extented Const Expressesions](https://github.com/WebAssembly/extended-const)|extended_const|❌| | ||
|[Garbage Collection](https://github.com/WebAssembly/gc)|gc|❌| | ||
|[JS String Builtins Proposal for WebAssembly](https://github.com/WebAssembly/js-string-builtins)||❌| | ||
|[JavaScript Promise Integration](https://github.com/WebAssembly/js-promise-integration)|jspi|❌| | ||
|[Memory64](https://github.com/WebAssembly/memory64)|memory64|❌| | ||
|[Multiple Memories](https://github.com/WebAssembly/multi-memory)|multi-memory|❌| | ||
|[Multi-value](https://github.com/WebAssembly/multi-value)|multi_value|✅| | ||
|[Importable/Exportable mutable globals]()||✅| | ||
|[Reference Types](https://github.com/WebAssembly/reference-types)||✅| | ||
|[Relaxed SIMD](https://github.com/webassembly/relaxed-simd)|relaxed_simd|❌| | ||
|[Non-trapping float-to-int conversions](https://github.com/WebAssembly/nontrapping-float-to-int-conversions)||✅| | ||
|[Sign-extension operators](https://github.com/WebAssembly/sign-extension-ops)||✅| | ||
|[Fixed-Width SIMD](https://github.com/webassembly/simd)||✅| | ||
|[Streaming Compilation](https://webassembly.github.io/spec/web-api/index.html#streaming-modules)|streaming_compilation|❌| | ||
|[Tail call](https://github.com/webassembly/tail-call)|tail_call|❌| | ||
|[Threads](https://github.com/webassembly/threads)|threads|❌| | ||
|[Type Reflection](https://github.com/WebAssembly/js-types)|type-reflection|❌| | ||
|[Typed function references](https://github.com/WebAssembly/function-references)|function-references|❌| |