screwdriver-template-validator
v9.0.0
Published
A module for validating a Screwdriver Template file
Downloads
194
Readme
Template Validator
A module for validating and parsing a Screwdriver Template file
yaml
# example.yaml
name: tkyi/nodejs_main
version: 2.0.1
description: |
Template for a NodeJS main job. Installs the NPM module dependencies and executes
the test target.
maintainer: [email protected]
config:
image: node:4
steps:
- install: npm install
- test: npm test
environment:
NODE_ENV: production
secrets:
- NPM_TOKEN
Usage
$ npm install screwdriver-template-validator
Validate in Node.js:
const fs = require('fs'); // standard fs module
const validator = require('screwdriver-template-validator');
// The "example.yaml" is the YAML described above
validator(fs.readFileSync('example.yaml'))
.then((templateData) => {
console.log(templateData);
});
Output of the console.log():
{
"name": "tkyi/nodejs_main",
"version": "2.0.1",
"description": "Template for a NodeJS main ...", //truncated for brevity
"maintainer": "[email protected]",
"config": {
"environment": {
"NODE_ENV": "production"
},
"image": "node:4",
"secrets": [
"NPM_TOKEN"
],
"steps": [{
"install": "npm install"
}, {
"test": "npm test"
}]
}
}
Testing
npm test
License
Code licensed under the BSD 3-Clause license. See LICENSE file for terms.