resources.schema.json 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. {
  2. "$schema": "http://json-schema.org/draft-07/schema#",
  3. "type": "object",
  4. "required": ["externalAssetPattern", "preloadAssetPattern", "resources"],
  5. "description": "Contains all resources (images, fonts, stylesheets, etc.) used by BYTM.",
  6. "properties": {
  7. "externalAssetPattern": {
  8. "type": "string",
  9. "description": "Pattern passed to `new RegExp()` that identifies an external asset that will be loaded via fetching from the CDN instead of a locally cached @resource.",
  10. "format": "regex",
  11. "pattern": "^.+$"
  12. },
  13. "preloadAssetPattern": {
  14. "type": "string",
  15. "description": "Pattern passed to `new RegExp()` that identifies an asset that should be preloaded.",
  16. "format": "regex",
  17. "pattern": "^.+$"
  18. },
  19. "resources": {
  20. "type": "object",
  21. "description": "Mapping of resource file identifiers and paths.",
  22. "patternProperties": {
  23. "^[a-zA-Z]([a-zA-Z0-9_]+)?-[a-zA-Z0-9-_]+$": {
  24. "description": "Resource with a key in the format `prefix-resource_name` and a value that is either a path string or metadata object.",
  25. "oneOf": [
  26. {
  27. "type": "string"
  28. },
  29. {
  30. "type": "object",
  31. "required": ["path"],
  32. "properties": {
  33. "path": {
  34. "type": "string",
  35. "description": "Path or URL to the resource. If it starts with /, it's relative to the project root, else it's relative to the assets folder. Query strings and hashes are allowed. You may make use of the placeholders $MODE, $BRANCH, $HOST, $BUILD_NUMBER and $UID anywhere in the string."
  36. },
  37. "ref": {
  38. "type": "string",
  39. "description": "Git Ref (branch, tag, or commit SHA) to use when fetching the resource from the CDN. Uses the branch and build number from src/constants.ts if not set. You may make use of the placeholders $MODE, $BRANCH, $HOST, $BUILD_NUMBER and $UID anywhere in the string."
  40. },
  41. "integrity": {
  42. "type": "boolean",
  43. "default": true,
  44. "description": "Whether to calculate a Subresource Integrity hash for the resource (works with URLs too)."
  45. }
  46. },
  47. "additionalProperties": false
  48. }
  49. ]
  50. }
  51. },
  52. "additionalProperties": false
  53. }
  54. },
  55. "additionalProperties": false
  56. }