-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
36 lines (28 loc) · 910 Bytes
/
Copy pathschema.js
File metadata and controls
36 lines (28 loc) · 910 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
27
28
29
30
31
32
33
34
35
36
'use strict';
var expanders = require('./expanders');
var utils = require('./utils');
/**
* Expand package.json using a schema.
*/
module.exports = function(options) {
var pkg = new utils.Pkg(options);
var schema = pkg.schema
/**
* Person fields
*/
.field('owner', 'string', { normalize: expanders.owner })
.field('author', ['object', 'string'], { normalize: expanders.person })
.field('authors', 'array', { normalize: expanders.persons })
.field('maintainers', 'array', { normalize: expanders.persons })
.field('contributors', 'array', { normalize: expanders.persons })
.field('collaborators', 'array', { normalize: expanders.persons })
/**
* Bugs, repo and license
*/
.field('git', ['object', 'string'], {
normalize: expanders.git
});
// Add fields defined on `options.fields`
schema.addFields(options);
return schema;
};