-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbin.js
More file actions
executable file
·26 lines (21 loc) · 747 Bytes
/
bin.js
File metadata and controls
executable file
·26 lines (21 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env node
const getStdin = require('./get-stdin')
const applyOverlay = require('./apply-overlay')
const externalResolver = require('./external-resolver.js')
const overlaysSchema = require('./overlays.schema.json')
const jsYaml = require('js-yaml')
const validateOverlays = require('./validate-overlays.js')
run().then(console.log, (err) => {
console.error(err)
process.exit(1)
})
// Functions
async function run() {
const overlay = jsYaml.load(await getStdin(), { schema: jsYaml.JSON_SCHEMA })
const errors = validateOverlays(overlay)
if(errors) {
throw errors
}
const applied = await applyOverlay(overlay, externalResolver)
return jsYaml.dump(applied, {schema: jsYaml.JSON_SCHEMA, noRefs: true})
}