1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/script/create-glossary-from-spreadsheet.js
Kevin Heis f6acb1f08a Update dependencies (#19408)
* Update dependencies 2

* Lint fixes

* Update graphql packages

* Update changelog-entry.json

* Update @octokit/rest

* Update commander with help from @rachmari

@rachmari

* Upgrade helmet

* Upgrade js-yaml

* Update server.js

* Update cheerio

* Revert "Update cheerio"

This reverts commit 8aa17c39fbf564ee554037d89e7a473027d16984.
2021-05-19 17:32:47 +00:00

37 lines
762 B
JavaScript
Executable File

#!/usr/bin/env node
// [start-readme]
//
// This script turns a Google Sheets CSV spreadsheet into a YAML file.
//
// [end-readme]
const fs = require('fs')
const path = require('path')
const yaml = require('js-yaml')
const inputFile = path.join(__dirname, '../data/glossary.yml')
const glossary = yaml.load(fs.readFileSync(inputFile, 'utf8'))
console.log(glossary)
const external = []
const internal = []
glossary.forEach(term => {
if (term.internal) {
delete term.internal
internal.push(term)
} else {
external.push(term)
}
})
fs.writeFileSync(
path.join(__dirname, '../data/glossaries/internal.yml'),
yaml.safeDump(internal)
)
fs.writeFileSync(
path.join(__dirname, '../data/glossaries/external.yml'),
yaml.safeDump(external)
)