* 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.
37 lines
762 B
JavaScript
Executable File
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)
|
|
)
|