@enspirit/emb
Version:
A replacement for our Makefile-for-monorepos
355 lines (354 loc) • 12 kB
JSON
{
"$id": "/schemas/config",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "EMBConfig",
"type": "object",
"additionalProperties": false,
"properties": {
"project": {
"type": "object",
"required": ["name"],
"properties": {
"name": {
"$ref": "#/definitions/Identifier",
"description": "The name of the project."
},
"rootDir": {
"type": "string",
"minLength": 1,
"description": "The root directory of the project."
}
},
"additionalProperties": false
},
"plugins": {
"type": "array",
"items": {
"type": "object",
"required": ["name"],
"properties": {
"name": {
"$ref": "#/definitions/Identifier"
},
"config": {}
},
"additionalProperties": false
}
},
"env": {
"type": "object",
"description": "Variables to install on the environment",
"additionalProperties": {
"type": "string"
}
},
"vars": {
"type": "object",
"description": "Variables that will be accessible for string expansion",
"additionalProperties": true
},
"defaults": {
"$ref": "#/definitions/DefaultsConfig"
},
"components": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ComponentConfig"
}
},
"flavors": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ProjectFlavorConfig"
}
},
"tasks": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/TaskConfig"
}
}
},
"required": ["project"],
"definitions": {
"Identifier": {
"type": "string",
"pattern": "^[a-zA-Z]+[\\w._-]+$"
},
"QualifiedIdentifier": {
"type": "string",
"pattern": "^([a-zA-Z]+[\\w._-]+:)?[a-zA-Z]+[\\w._-]+$"
},
"DefaultsConfig": {
"type": "object",
"description": "Default settings for build aspects",
"additionalProperties": false,
"properties": {
"docker": {
"type": "object",
"description": "Default docker build settings",
"properties": {
"tag": {
"type": "string"
},
"target": {
"$ref": "#/definitions/Identifier"
},
"buildArgs": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"TaskConfig": {
"type": "object",
"required": [],
"anyOf": [
{ "required": ["script"] },
{ "required": ["pre"] }
],
"properties": {
"description": {
"type": "string"
},
"script": {
"type": "string"
},
"executor": {
"$ref": "#/definitions/Identifier"
},
"options": {
"type": "object",
"additionalProperties": true
},
"pre": {
"type": "array",
"items": {
"$ref": "#/definitions/Identifier"
}
},
"vars": {
"type": "object",
"description": "Variables to pass onto the task",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"ComponentConfig": {
"type": "object",
"required": [],
"properties": {
"rootDir": {
"type": "string",
"description": "Path to the component's root folder (relative to root of monorepo)"
},
"description": {
"type": "string",
"minLength": 1,
"description": "A description of the component."
},
"tasks": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/TaskConfig"
}
},
"resources": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ResourceConfig"
}
},
"flavors": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ComponentFlavorConfig"
}
}
},
"additionalProperties": false
},
"DockerImageConfig": {
"type": "object",
"properties": {
"buildArgs": {
"type": "object",
"properties": {},
"additionalProperties": {
"type": "string"
}
},
"target": {
"type": "string",
"description": "The stage to target for the build"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Labels to apply to the resulting image"
},
"context": {
"type": "string",
"description": "The context folder for the docker build"
},
"dockerfile": {
"type": "string",
"description": "The Dockerfile to use"
}
},
"additionalProperties": false
},
"ProjectFlavorConfig": {
"type": "object",
"additionalProperties": false,
"required": [],
"properties": {
"patches": {
"type": "array",
"items": {
"$ref": "#/definitions/JsonPatchOperation"
}
}
}
},
"ResourceConfig": {
"type": "object",
"required": ["type"],
"properties": {
"type": { "type": "string" },
"params": {},
"dependencies": {
"type": "array",
"items": { "$ref": "#/definitions/QualifiedIdentifier" },
"uniqueItems": true
}
},
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": {
"type": { "const": "docker/image" }
},
"required": ["type"]
},
"then": {
"properties": {
"params": { "$ref": "#/definitions/DockerImageConfig" }
}
}
},
{
"if": {
"properties": {
"type": { "const": "file" }
},
"required": ["type"]
},
"then": {
"properties": {
"params": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
},
"script": {
"type": "string"
}
}
}
}
}
}
]
},
"ComponentFlavorConfig": {
"type": "object",
"additionalProperties": false,
"required": [],
"properties": {
"patches": {
"type": "array",
"items": {
"$ref": "#/definitions/JsonPatchOperation"
}
}
}
},
"JsonPatchAddOperation": {
"type": "object",
"properties": {
"op": { "const": "add" },
"path": { "type": "string", "minLength": 1 },
"value": {}
},
"required": ["op", "path", "value"],
"additionalProperties": false
},
"JsonPatchRemoveOperation": {
"type": "object",
"properties": {
"op": { "const": "remove" },
"path": { "type": "string", "minLength": 1 }
},
"required": ["op", "path"],
"additionalProperties": false
},
"JsonPatchReplaceOperation": {
"type": "object",
"properties": {
"op": { "const": "replace" },
"path": { "type": "string", "minLength": 1 },
"value": {}
},
"required": ["op", "path", "value"],
"additionalProperties": false
},
"JsonPatchMoveOperation": {
"type": "object",
"properties": {
"op": { "const": "move" },
"path": { "type": "string", "minLength": 1 },
"from": { "type": "string", "minLength": 1 }
},
"required": ["op", "path", "from"],
"additionalProperties": false
},
"JsonPatchCopyOperation": {
"type": "object",
"properties": {
"op": { "const": "copy" },
"path": { "type": "string", "minLength": 1 },
"from": { "type": "string", "minLength": 1 }
},
"required": ["op", "path", "from"],
"additionalProperties": false
},
"JsonPatchOperation": {
"oneOf": [
{ "$ref": "#/definitions/JsonPatchAddOperation" },
{ "$ref": "#/definitions/JsonPatchRemoveOperation" },
{ "$ref": "#/definitions/JsonPatchReplaceOperation" },
{ "$ref": "#/definitions/JsonPatchMoveOperation" },
{ "$ref": "#/definitions/JsonPatchCopyOperation" }
]
}
}
}