@servant/servant
Version:
Servant builder for node modules.
328 lines (327 loc) • 14.8 kB
JSON
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "JSON schema for Servant servant.json files",
"definitions": {
"coreProperties": {
"type": "object",
"properties": {
"package": {
"description": "Name of whole package. Is used only for printing this name into Servant console. If field is not provided, it's load from package.json 'name' field.",
"type": "string",
"maxLength": 214,
"minLength": 1,
"pattern": "^(?:@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$"
},
"modules": {
"description": "Array of glob patterns for loading and determining modules. It's recommended to use prefixes for you inner modules directories, so you can distinguish between modules directories and helpers and tools directories. For example you use for main modules `module.name` and for views modules `view.name`.",
"type": "array",
"items": {
"type": "string"
}
},
"output": {
"type": "object",
"properties": {
"directory": {
"description": "Directory for final build output. There will be saved all resources and bundled files. This is used by `build` command.",
"type": "string"
},
"filename": {
"description": "Name of bundled file. This is used by `build` command.",
"type": "string"
},
"resolve": {
"description": "Array of extensions for resolve in output directory. This extensions are used for resolving what can be loaded into tests runner.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"webpage": {
"type": "object",
"properties": {
"title": {
"description": "Name of page that will be injected into title meta tag in html.",
"type": "string"
},
"favicon": {
"description": "Relative path to asset for favicon.",
"type": "string"
},
"publicPath": {
"description": "Path where web page will be served on server side. Default is set to './'.",
"type": "string"
}
}
},
"entry": {
"description": "Main entry point into your module. It can be `*.js` or `*.ts` file or file without extension. If it's specified in main servant.json it's used as a default for every submodule. You can override it in submodule servant.json. Doing this you can have different structures for each module. This is used by `build` command.",
"type": ["string", "boolean"]
},
"src": {
"description": "Array of glob patterns for determining src files of module. If it's specified in main servant.json it's used as a default for every submodule. You can override it in submodule servant.json. Doing this you can have different structures for each module. But this approach is not recommended.",
"type": "array",
"items": {
"type": "string"
}
},
"tests": {
"description": "Array of glob patterns for determining tests files of module. If it's specified in main servant.json it's used as a default for every submodule. You can override it in submodule servant.json. Doing this you can have different structures for each module. But this approach is not recommended.",
"type": "array",
"items": {
"type": "string"
}
},
"resources": {
"description": "Array of glob patterns for resources files of module. If it's specified in main servant.json it's used as a default for every submodule. You can override it in submodule servant.json. Doing this you can have different structures for each module. Every module has different sets of resources so it must be defined in every module separately.",
"type": "array",
"items": {
"type": "string"
}
},
"watch": {
"description": "Array of glob patterns for watched files in module. This property is used by `--changed` flag. All files in this array are watched and if there are some changes in in, Servant can rebuild a module. You can watch node_modules directory, some hot folder for resources and so on.",
"type": "array",
"items": {
"type": "string"
}
},
"resolve": {
"description": "Array of extensions for resolve in src and tests directories.",
"type": "array",
"items": {
"type": "string"
}
},
"clean": {
"description": "Array of all extension that are removed by `clean` command. By default `clean` command clearing you dist files defined in `package.json` 'files' field. But it can additionally clean some other files with specified extensions. This is used for cleaning autogenerated js or d.ts files for example.",
"type": "array",
"items": {
"type": "string"
}
},
"temp": {
"description": "Temporary dirname that is removed by `clean` command. By default 'clean' command clearing you dist files and also all files under temporary directory. Some commands can create files under this temp directory. You can also use this dir to store some temporary files here. But don't forget that will be deleted by 'clean' command!",
"type": "string"
},
"registry": {
"description": "You can setup your registry if you do not use default 'registry.npmjs.org'. Registry is used by `publish`, `install` and `update` commands. You can defined also scoped registry with object mapping. More at documentation.",
"type": ["string", "object"],
"additionalProperties": {
"type": "string"
}
},
"target": {
"description": "This is setting of output target. You must specify for what is module used.",
"type": "string",
"enum": ["web", "web_page", "node", "node-cli"]
},
"publish": {
"type": "object",
"properties": {
"increment": {
"description": "This is increment type used by `publish` command. Servant will increase semver version fo your module by specify type. If you don't want to increment version automatically, set 'none' as increment.",
"type": "string",
"enum": ["major", "premajor", "minor", "preminor", "patch", "prepatch", "prerelease", "none"]
},
"access": {
"description": "Define if you publish public or restricted package. Is is used by `publish` command and if you want to use 'restricted' on default registry, you need paid account!",
"type": "string",
"enum": ["public", "restricted"]
},
"stripDev": {
"description": "You can remove dev dependencies from published package.json if you turn this option.",
"type": "boolean"
},
"commitMessage": {
"description": "Commit message that will be attached to commit if you use --commit flag in publish command. You can use variables that will be replaced. Variables: $version, $increment.",
"type": "string"
}
}
},
"issues": {
"description": "Settings for bug name resolving in test name. It's used by tests command and is used for collecting all bugs that are reported in test or suit name. On end of tests task you can view the count of tested issues and all passed tests for it. Key of object is pattern for resolving issue in tests name. Value of object is url for issues that are testing. This url is show in list of all tested issues on end. You can use $0 for whole matching string and the $1, $2, ... for groups.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"libraries": {
"$ref": "#/definitions/libraries"
},
"mappings": {
"$ref": "#/definitions/mappings"
},
"shared": {
"$ref": "#/definitions/shared"
},
"server": {
"$ref": "#/definitions/serverSettings"
},
"testing": {
"type": "object",
"properties": {
"browsers": {
"description": "List of all browsers, where code will be tested. Servant automatically spawn all of them.",
"type": "array",
"items": {
"type": "string",
"enum": ["Webkit", "Firefox", "Chromium"]
}
},
"devices": {
"description": "List of devices, that will be run in all defined browsers.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"prettify": {
"type": "object",
"properties": {
"sources": {
"description": "Array of glob patterns for determining directories and files for prettier validation by `validate` command.",
"type": "array",
"items": {
"type": "string"
}
},
"extensions": {
"description": "Array of all extension that are prettified and validated by `validate` command.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"generators": {
"description": "Directory where generators for current module are stored.",
"type": "string"
}
}
},
"libraries": {
"description": "Directory of all libraries that will not be build into output file. By default every dependency and every node module is not bundled into output. But if there are some special cases (for example: you use library 'simple-git', but you need import 'simple-git/promise') Servant is not able to determine library to not include. So if you wan't this library as build into output, you must specify in there.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/library"
}
},
"mappings": {
"description": "There are defined all links on external libraries. For example if you use react as external library (that is not part of your build) you can defined link where library sources are located. Servant known most uses libraries.",
"type": "object",
"additionalProperties": {
"type": ["string", "boolean"]
}
},
"shared": {
"description": "There are defined all shared libraries that will be linked to global node_modules. For example some libraries needs to be included in app only once (React for example) so you can share them from global node_modules. This is basically necessary only in development.",
"type": "object",
"additionalProperties": {
"type": ["string"]
}
},
"library": {
"description": "Library full object definition.",
"type": ["string", "object"],
"additionalProperties": {
"type": "string"
},
"properties": {
"root": {
"description": "The library that is available as a global variable",
"type": "string"
},
"umd": {
"description": "Library is exposed under all the module definitions, allowing it to work with CommonJS, AMD and as global variable.",
"type": "string"
},
"commonjs": {
"description": "The library that is available as a CommonJS module.",
"type": "string"
},
"commonjs2": {
"description": "Similar to the above but where the export is module.exports.default.",
"type": "string"
},
"amd": {
"description": "Similar to commonjs but using AMD module system",
"type": "string"
}
}
},
"serverSettings": {
"type": "object",
"properties": {
"css": {
"description": "List of all externals css libraries. You can specify url or relative path.",
"type": "array",
"items": {
"type": "string"
}
},
"js": {
"description": "List of all externals js libraries. You can specify url or relative path.",
"type": "array",
"items": {
"type": "string"
}
},
"entries": {
"description": "List of all modules that's will be used for running development and preview server.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/entry"
}
}
}
},
"entry": {
"type": "object",
"description": "List of all modules that will be server for developing on web or on server.",
"properties": {
"title": {
"description": "Define title of development page with module.",
"type": "string"
},
"template": {
"description": "Define template file with data for development server.",
"type": "string"
},
"command": {
"type": "object",
"properties": {
"file": {
"description": "Define what file will be run for node process.",
"type": "string"
},
"args": {
"description": "Define all arguments for file that will be run.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"shared": {
"description": "Pair of key values for creating shared folders. Key is a relative path in current module and value is another module name. Output directory of this module will be symlink to defined path.",
"type": "object",
"additionalProperties": {
"type": ["string"]
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/coreProperties"
}
]
}