Browse Source

Define a JSON schema for the package JSON, and clarify some naming rules

default_compile_flags
vector-of-bool 4 years ago
parent
commit
a2800b3ec4
4 changed files with 74 additions and 20 deletions
  1. +3
    -2
      docs/guide/packages.rst
  2. +0
    -18
      package.json5
  3. +18
    -0
      package.jsonc
  4. +53
    -0
      res/package-schema.json

+ 3
- 2
docs/guide/packages.rst View File

@@ -317,8 +317,9 @@ Naming Requirements
Package names aren't a complete free-for-all. Package names must follow a set
of specific rules:

- Package names may consist of ASCII, lowercase characters, digits,
underscores (``_``), hyphens (``-``), and periods (``.``).
- Package names may consist of a subset of ASCII including lowercase
characters, digits, underscores (``_``), hyphens (``-``), and periods
(``.``).

.. note::
Different filesystems differ in their handling of filenames. Some platforms

+ 0
- 18
package.json5 View File

@@ -1,18 +0,0 @@
{
"$schema": "what",
name: 'dds',
namespace: 'dds',
version: '0.1.0',
depends: {
spdlog: '1.4.2',
'ms-wil': '2019.11.10',
'range-v3': '0.10.0',
'nlohmann-json': '3.7.1',
'neo-sqlite3': '0.2.2',
'neo-fun': '0.1.0',
'semver': '0.2.1',
pubgrub: '0.2.0',
json5: '0.1.2',
},
test_driver: 'Catch-Main',
}

+ 18
- 0
package.jsonc View File

@@ -0,0 +1,18 @@
{
"$schema": "./res/package-schema.json",
"name": "dds",
"version": "0.1.0",
"namespace": "dds",
"depends": {
"spdlog": "1.4.2",
"ms-wil": "2019.11.10",
"range-v3": "0.10.0",
"nlohmann-json": "3.7.1",
"neo-sqlite3": "0.2.2",
"neo-fun": "0.1.0",
"semver": "0.2.1",
"pubgrub": "0.2.0",
"json5": "0.1.2"
},
"test_driver": "Catch-Main"
}

+ 53
- 0
res/package-schema.json View File

@@ -0,0 +1,53 @@
{
"type": "object",
"description": "DDS Package Manifest",
"additionalProperties": false,
"patternProperties": {
"^\\$": {}
},
"required": [
"name",
"version",
"namespace"
],
"properties": {
"name": {
"type": "string",
"description": "The name of the package. Must be a valid Semantic Version string.",
"pattern": "^[a-z][a-z0-9_]*((\\.|-)[a-z0-9_]+)*$"
},
"version": {
"type": "string",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
"description": "The version of the package. Required",
"default": "0.1.0"
},
"namespace": {
"type": "string",
"description": "The package's namespace. Must be a valid string.",
"pattern": "^[a-z][a-z0-9_]*((\\.|-)[a-z0-9_]+)*$"
},
"$schema": {
"type": "string",
"description": "JSON schema tag. Ignored by dds."
},
"depends": {
"type": "object",
"patternProperties": {
"^[a-z][a-z0-9_]*((\\.|-)[a-z0-9_]+)*$": {
"type": "string",
"description": "The version of the dependency. Must be a valid Semantic Version string",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
}
}
},
"test_driver": {
"type": "string",
"default": "Catch-Main",
"enum": [
"Catch-Main",
"Catch"
]
}
}
}

Loading…
Cancel
Save