mdn-confluence
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -10,84 +10,81 @@ // Copyright 2017 The Chromium Authors. All rights reserved. | ||
const { | ||
CompatConfluenceJsonGenerator, | ||
} = require('../lib/CompatConfluenceJsonGenerator.es6.js'); | ||
const argv = require('yargs') | ||
.help('help').alias('help', 'h') | ||
.option('fill-only', { | ||
type: 'boolean', | ||
alias: 'fo', | ||
desc: `Whether or not to only add missing version information`, | ||
default: false, | ||
}) | ||
.option('remove', { | ||
type: 'boolean', | ||
alias: 'rm', | ||
desc: `Whether or not to remove supported versions based on absence of support in Confluence`, | ||
default: false, | ||
}) | ||
.option('interfaces', { | ||
alias: 'i', | ||
desc: `Comma-separated list of interfaces to generate JSON for; omit to include all interfaces`, | ||
default: '', | ||
coerce: iStr => iStr.split(',').filter(str => !!str), | ||
}) | ||
.option('browsers', { | ||
alias: 'b', | ||
desc: `Comma-separated list of browser names to generate JSON for; omit to include all browsers`, | ||
default: '', | ||
coerce: bStr => bStr.split(',').filter(str => !!str).map(str => str.toLowerCase()), | ||
}) | ||
.option('confluence-release-url', { | ||
alias: 'cru', | ||
desc: `Absolute https: or file: URL to JSON for Confluence release metadata for GridRows`, | ||
default: `https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.Release.json`, | ||
coerce: cru => { | ||
if (!/^(https|file):[/][/]/i.test(cru)) { | ||
throw new Error('Invalid confluence-release-url: ${cru}'); | ||
} | ||
return cru; | ||
}, | ||
}) | ||
.option('confluence-data-url', { | ||
alias: 'cdu', | ||
desc: `Absolute https: or file: URL to JSON for Confluence GridRows`, | ||
default: `https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.GridRow.json`, | ||
coerce: cdu => { | ||
if (!/^(https|file):[/][/]/i.test(cdu)) { | ||
throw new Error('Invalid confluence-data-url: ${cdu}'); | ||
} | ||
return cdu; | ||
}, | ||
}) | ||
.option('output-dir', { | ||
alias: 'od', | ||
desc: `Directory where modified browser-compat-data JSON files will be stored`, | ||
default: path.resolve(`${__dirname}/../data/browser-compat-data`), | ||
coerce: od => { | ||
if (!fs.existsSync(od)) { | ||
throw new Error(`Output directory "${od}" does not exist`); | ||
} | ||
return path.resolve(od); | ||
}, | ||
}) | ||
.option('bcd-module', { | ||
alias: 'bm', | ||
desc: `Custom path to browser-compat-data module`, | ||
default: 'mdn-browser-compat-data', | ||
}) | ||
.argv; | ||
.help('help') | ||
.alias('help', 'h') | ||
.option('fill-only', { | ||
type: 'boolean', | ||
alias: 'fo', | ||
desc: `Whether or not to only add missing version information`, | ||
default: false, | ||
}) | ||
.option('remove', { | ||
type: 'boolean', | ||
alias: 'rm', | ||
desc: `Whether or not to remove supported versions based on absence of support in Confluence`, | ||
default: false, | ||
}) | ||
.option('interfaces', { | ||
alias: 'i', | ||
desc: `Comma-separated list of interfaces to generate JSON for; omit to include all interfaces`, | ||
default: '', | ||
coerce: (iStr) => iStr.split(',').filter((str) => !!str), | ||
}) | ||
.option('browsers', { | ||
alias: 'b', | ||
desc: `Comma-separated list of browser names to generate JSON for; omit to include all browsers`, | ||
default: '', | ||
coerce: (bStr) => | ||
bStr | ||
.split(',') | ||
.filter((str) => !!str) | ||
.map((str) => str.toLowerCase()), | ||
}) | ||
.option('confluence-release-url', { | ||
alias: 'cru', | ||
desc: `Absolute https: or file: URL to JSON for Confluence release metadata for GridRows`, | ||
default: `https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.Release.json`, | ||
coerce: (cru) => { | ||
if (!/^(https|file):[/][/]/i.test(cru)) { | ||
throw new Error('Invalid confluence-release-url: ${cru}'); | ||
} | ||
return cru; | ||
}, | ||
}) | ||
.option('confluence-data-url', { | ||
alias: 'cdu', | ||
desc: `Absolute https: or file: URL to JSON for Confluence GridRows`, | ||
default: `https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.GridRow.json`, | ||
coerce: (cdu) => { | ||
if (!/^(https|file):[/][/]/i.test(cdu)) { | ||
throw new Error('Invalid confluence-data-url: ${cdu}'); | ||
} | ||
return cdu; | ||
}, | ||
}) | ||
.option('output-dir', { | ||
alias: 'od', | ||
desc: `Directory where modified browser-compat-data JSON files will be stored`, | ||
default: path.resolve(`${__dirname}/../data/browser-compat-data`), | ||
coerce: (od) => { | ||
if (!fs.existsSync(od)) { | ||
throw new Error(`Output directory "${od}" does not exist`); | ||
} | ||
return path.resolve(od); | ||
}, | ||
}) | ||
.option('bcd-module', { | ||
alias: 'bm', | ||
desc: `Custom path to browser-compat-data module`, | ||
default: 'mdn-browser-compat-data', | ||
}).argv; | ||
require('../boot.es6.js'); | ||
const generator = new CompatConfluenceJsonGenerator(argv); | ||
(async function() { | ||
await mdn.CompatConfluenceJsonGenerator.create({ | ||
bcdModule: argv.bcdModule, | ||
confluenceReleaseUrl: argv.confluenceReleaseUrl, | ||
confluenceDataUrl: argv.confluenceDataUrl, | ||
fillOnly: argv.fillOnly, | ||
remove: argv.remove, | ||
outputDir: argv.outputDir, | ||
interfaces: argv.interfaces, | ||
browsers: argv.browsers, | ||
}).generateJson(); | ||
})().catch(error => { | ||
generator.generateJson().catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
{ | ||
"name": "mdn-confluence", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "User support tool for maintaining MDN compatibility data using Web API Confluence data.", | ||
"scripts": { | ||
"generate": "node ./main/generate.es6.js" | ||
"generate": "node ./main/generate.es6.js", | ||
"lint": "eslint .", | ||
"lint-fix": "eslint --fix ." | ||
}, | ||
"author": "Mark Dittmer", | ||
"contributors": [ | ||
"Philip Jägenstedt" | ||
], | ||
"dependencies": { | ||
"compare-versions": "^3.6.0", | ||
"foam2": "git://github.com/foam-framework/foam2.git#mdn-confluence", | ||
"yargs": "^15.4.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^7.8.1", | ||
"eslint-config-google": "^0.14.0" | ||
}, | ||
"eslintConfig": { | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"google" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
}, | ||
"rules": { | ||
"curly": [ | ||
"error", | ||
"all" | ||
], | ||
"max-len": [ | ||
"error", | ||
{ | ||
"ignoreStrings": true, | ||
"ignoreTemplateLiterals": true, | ||
"ignoreUrls": true | ||
} | ||
], | ||
"require-jsdoc": "off" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable and can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
2
0
22636
2
7
544
2