Skip to content

Instantly share code, notes, and snippets.

@jamesmacwhite
Last active July 31, 2025 20:37
Show Gist options
  • Save jamesmacwhite/7aeb1da95bb352e0f60fda71499aeb85 to your computer and use it in GitHub Desktop.
Save jamesmacwhite/7aeb1da95bb352e0f60fda71499aeb85 to your computer and use it in GitHub Desktop.

Revisions

  1. jamesmacwhite revised this gist Jul 31, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion craft-cloud-schema.json
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    "properties": {
    "php-version": {
    "type": "string",
    "pattern": "^\\d+\\.\\d+$",
    "enum": ["8.1", "8.2", "8.3", "8.4"],
    "description": "Required. Major and minor PHP version (e.g., '8.2')."
    },
    "node-version": {
  2. jamesmacwhite revised this gist Jul 31, 2025. 1 changed file with 131 additions and 97 deletions.
    228 changes: 131 additions & 97 deletions craft-cloud-schema.json
    Original file line number Diff line number Diff line change
    @@ -1,107 +1,141 @@
    {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Craft Cloud Config File",
    "type": "object",
    "required": ["php-version"],
    "properties": {
    "php-version": {
    "type": "string",
    "pattern": "^\\d+\\.\\d+$",
    "description": "Required. Major and minor PHP version (e.g., '8.2')."
    },
    "node-version": {
    "type": "string",
    "pattern": "^\\d+$",
    "description": "Optional. Major Node.js version (e.g., '18')."
    },
    "node-path": {
    "type": "string",
    "description": "Optional. Directory for NPM build commands."
    },
    "npm-script": {
    "type": "string",
    "description": "Optional. Name of the script in package.json to run at build time."
    },
    "artifact-path": {
    "type": "string",
    "description": "Optional. Directory to be uploaded to CDN after build."
    },
    "app-path": {
    "type": "string",
    "description": "Optional. Path where your PHP application lives."
    },
    "webroot": {
    "type": "string",
    "description": "Optional. Public directory containing index.php."
    },
    "redirects": {
    "type": "array",
    "items": {
    "type": "object",
    "required": ["pattern", "destination"],
    "properties": {
    "pattern": {
    "oneOf": [
    { "type": "string" },
    {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Craft Cloud Config File",
    "type": "object",
    "required": [
    "php-version"
    ],
    "properties": {
    "php-version": {
    "type": "string",
    "pattern": "^\\d+\\.\\d+$",
    "description": "Required. Major and minor PHP version (e.g., '8.2')."
    },
    "node-version": {
    "type": "string",
    "pattern": "^\\d+$",
    "description": "Optional. Major Node.js version (e.g., '18')."
    },
    "node-path": {
    "type": "string",
    "description": "Optional. Directory for NPM build commands."
    },
    "npm-script": {
    "type": "string",
    "description": "Optional. Name of the script in package.json to run at build time."
    },
    "artifact-path": {
    "type": "string",
    "description": "Optional. Directory to be uploaded to CDN after build."
    },
    "app-path": {
    "type": "string",
    "description": "Optional. Path where your PHP application lives."
    },
    "webroot": {
    "type": "string",
    "description": "Optional. Public directory containing index.php."
    },
    "redirects": {
    "type": "array",
    "items": {
    "type": "object",
    "required": [
    "pattern",
    "destination"
    ],
    "properties": {
    "protocol": { "type": "string" },
    "hostname": { "type": "string" },
    "pathname": { "type": "string" },
    "search": { "type": "string" },
    "hash": { "type": "string" }
    "pattern": {
    "oneOf": [
    {
    "type": "string"
    },
    {
    "type": "object",
    "properties": {
    "protocol": {
    "type": "string"
    },
    "hostname": {
    "type": "string"
    },
    "pathname": {
    "type": "string"
    },
    "search": {
    "type": "string"
    },
    "hash": {
    "type": "string"
    }
    },
    "additionalProperties": false
    }
    ],
    "description": "URLPattern-compatible matcher for request URLs."
    },
    "destination": {
    "type": "string",
    "description": "URL or template for the redirect target, supporting substitutions like {request.uri}."
    },
    "status": {
    "type": "integer",
    "enum": [
    301,
    302
    ],
    "description": "Optional HTTP status code (301 for permanent, 302 for temporary)."
    }
    },
    "additionalProperties": false
    }
    ],
    "description": "URLPattern-compatible matcher for request URLs."
    },
    "destination": {
    "type": "string",
    "description": "URL or template for the redirect target, supporting substitutions like {request.uri}."
    },
    "status": {
    "type": "integer",
    "enum": [301, 302],
    "description": "Optional HTTP status code (301 for permanent, 302 for temporary)."
    }
    }
    },
    "additionalProperties": false
    }
    },
    "rewrites": {
    "type": "array",
    "items": {
    "type": "object",
    "required": ["pattern", "destination"],
    "properties": {
    "pattern": {
    "oneOf": [
    { "type": "string" },
    {
    "rewrites": {
    "type": "array",
    "items": {
    "type": "object",
    "required": [
    "pattern",
    "destination"
    ],
    "properties": {
    "protocol": { "type": "string" },
    "hostname": { "type": "string" },
    "pathname": { "type": "string" },
    "search": { "type": "string" },
    "hash": { "type": "string" }
    "pattern": {
    "oneOf": [
    {
    "type": "string"
    },
    {
    "type": "object",
    "properties": {
    "protocol": {
    "type": "string"
    },
    "hostname": {
    "type": "string"
    },
    "pathname": {
    "type": "string"
    },
    "search": {
    "type": "string"
    },
    "hash": {
    "type": "string"
    }
    },
    "additionalProperties": false
    }
    ],
    "description": "URLPattern-compatible matcher for request URLs."
    },
    "destination": {
    "type": "string",
    "description": "Internal routing path or target handler."
    }
    },
    "additionalProperties": false
    }
    ],
    "description": "URLPattern-compatible matcher for request URLs."
    },
    "destination": {
    "type": "string",
    "description": "Internal routing path or target handler."
    }
    },
    "additionalProperties": false
    }
    }

    },
    "additionalProperties": false
    }
    }
    }
    },
    "additionalProperties": false
    }
  3. jamesmacwhite created this gist Jul 31, 2025.
    107 changes: 107 additions & 0 deletions craft-cloud-schema.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,107 @@
    {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Craft Cloud Config File",
    "type": "object",
    "required": ["php-version"],
    "properties": {
    "php-version": {
    "type": "string",
    "pattern": "^\\d+\\.\\d+$",
    "description": "Required. Major and minor PHP version (e.g., '8.2')."
    },
    "node-version": {
    "type": "string",
    "pattern": "^\\d+$",
    "description": "Optional. Major Node.js version (e.g., '18')."
    },
    "node-path": {
    "type": "string",
    "description": "Optional. Directory for NPM build commands."
    },
    "npm-script": {
    "type": "string",
    "description": "Optional. Name of the script in package.json to run at build time."
    },
    "artifact-path": {
    "type": "string",
    "description": "Optional. Directory to be uploaded to CDN after build."
    },
    "app-path": {
    "type": "string",
    "description": "Optional. Path where your PHP application lives."
    },
    "webroot": {
    "type": "string",
    "description": "Optional. Public directory containing index.php."
    },
    "redirects": {
    "type": "array",
    "items": {
    "type": "object",
    "required": ["pattern", "destination"],
    "properties": {
    "pattern": {
    "oneOf": [
    { "type": "string" },
    {
    "type": "object",
    "properties": {
    "protocol": { "type": "string" },
    "hostname": { "type": "string" },
    "pathname": { "type": "string" },
    "search": { "type": "string" },
    "hash": { "type": "string" }
    },
    "additionalProperties": false
    }
    ],
    "description": "URLPattern-compatible matcher for request URLs."
    },
    "destination": {
    "type": "string",
    "description": "URL or template for the redirect target, supporting substitutions like {request.uri}."
    },
    "status": {
    "type": "integer",
    "enum": [301, 302],
    "description": "Optional HTTP status code (301 for permanent, 302 for temporary)."
    }
    },
    "additionalProperties": false
    }
    },
    "rewrites": {
    "type": "array",
    "items": {
    "type": "object",
    "required": ["pattern", "destination"],
    "properties": {
    "pattern": {
    "oneOf": [
    { "type": "string" },
    {
    "type": "object",
    "properties": {
    "protocol": { "type": "string" },
    "hostname": { "type": "string" },
    "pathname": { "type": "string" },
    "search": { "type": "string" },
    "hash": { "type": "string" }
    },
    "additionalProperties": false
    }
    ],
    "description": "URLPattern-compatible matcher for request URLs."
    },
    "destination": {
    "type": "string",
    "description": "Internal routing path or target handler."
    }
    },
    "additionalProperties": false
    }
    }

    },
    "additionalProperties": false
    }