-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.js
executable file
·51 lines (49 loc) · 1008 Bytes
/
schemas.js
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var extend = require('extend'),
path = require('path'),
schemas = {
'creating': {
'name' : {
properties: {
name: {
pattern: /^[a-zA-Z\s\-]+$/,
message: 'Enter the name of component',
default: '',
required: true
},
description: {
message: 'Enter description',
default: "",
required: true
}
}
},
"isabs": {
properties: {
org: {
pattern: /^[a-zA-Z\s\-]+$/,
message: "Organization",
default: "abstudio",
required: false
}
}
},
"tags": {
properties:{
tags: {
message: 'Tags',
type: 'array',
required: true
}
}
},
'init': function() {
var probablyName = process.cwd().split(path.sep).pop().replace(/[^a-zA-Z\s\-]*/ig, "");
this.name.properties.name.default = probablyName;
}
}
}
module.exports = function(schemaName) {
var schema = schemas[schemaName];
schemas[schemaName].init.call(schema);
return schema;
}