mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Add a helper script to convert all the tests to yaml
This commit is contained in:
parent
7db868cc29
commit
663e769cdc
29
helpers/convert-old-json-to-yaml.js
Normal file
29
helpers/convert-old-json-to-yaml.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const UAList = require('./src/useragents').useragents;
|
||||||
|
const json2yaml = require('json2yaml');
|
||||||
|
const Parser = require('./lib/parser').default;
|
||||||
|
|
||||||
|
const newBrowserList = {};
|
||||||
|
|
||||||
|
for (const browserName in UAList) {
|
||||||
|
const newBrowser = [];
|
||||||
|
const browserClass = UAList[browserName];
|
||||||
|
|
||||||
|
for (const browserUA in browserClass) {
|
||||||
|
const parsedUA = new Parser(browserUA).parse().getResult();
|
||||||
|
const newBrowserDeclaration = {
|
||||||
|
ua: browserUA
|
||||||
|
};
|
||||||
|
// const browserDeclaration = browserClass[browserUA];
|
||||||
|
|
||||||
|
newBrowserDeclaration.spec = parsedUA;
|
||||||
|
|
||||||
|
newBrowser.push(newBrowserDeclaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
newBrowserList[browserName] = newBrowser;
|
||||||
|
}
|
||||||
|
|
||||||
|
const yaml = json2yaml.stringify(newBrowserList);
|
||||||
|
|
||||||
|
fs.writeFileSync('useragentstrings.yml', yaml);
|
Loading…
Reference in New Issue
Block a user