1
1
mirror of https://github.com/primer/css.git synced 2024-12-27 08:05:06 +03:00

write variables object to data/deprecations.json

This commit is contained in:
Shawn Allen 2019-11-01 11:05:46 -07:00
parent 61ca4f89ee
commit e6c6ae10f3

View File

@ -88,15 +88,20 @@ function getPathName(path) {
} }
function writeDeprecationData() { function writeDeprecationData() {
const {versionDeprecations, selectorDeprecations} = require('../deprecations') const {versionDeprecations, selectorDeprecations, variableDeprecations} = require('../deprecations')
const data = { const data = {
versions: versionDeprecations, versions: versionDeprecations,
selectors: Array.from(selectorDeprecations.entries()).reduce((obj, [selector, deprecation]) => { selectors: mapToObject(selectorDeprecations),
obj[selector] = deprecation variables: mapToObject(variableDeprecations)
}
return writeFile(join(outDir, 'deprecations.json'), JSON.stringify(data, null, 2))
function mapToObject(map) {
return Array.from(map.entries()).reduce((obj, [key, value]) => {
obj[key] = value
return obj return obj
}, {}) }, {})
} }
return writeFile(join(outDir, 'deprecations.json'), JSON.stringify(data, null, 2))
} }
if (require.main === module) { if (require.main === module) {