A module for validating a Screwdriver Command file
# example.yaml
namespace: git
name: clone
version: '1.1'
description: SD Command for git clone with habitat.
maintainer: [email protected]
format: habitat
habitat:
mode: remote
package: core/git/2.14.1
command: git clone
$ npm install screwdriver-command-validator
Validate in Node.js:
const fs = require('fs'); // standard fs module
const validator = require('screwdriver-command-validator');
// The "example.yaml" is the YAML described above
validator(fs.readFileSync('example.yaml'))
.then((commandData) => {
console.log(commandData);
});
Output of the console.log():
config: {
description: 'SD Command for git clone with habitat.',
maintainer: '[email protected]',
name: 'git',
namespace: 'clone',
version: '1.0',
format: 'habitat',
habitat: {
mode: 'remote',
package: 'core/git/2.14.1',
command: 'git clone'
}
}
Validate in CLI:
$ ./node_modules/.bin/command-validate -h
Usage: validate [options]
Options:
-j, --json output with JSON
-f, --file [name] screwdriver command file (default: ./sd-command.yaml)
-h, --help output usage information
$ ./node_modules/.bin/command-validate -j
{"valid":true}
npm test
Code licensed under the BSD 3-Clause license. See LICENSE file for terms.