From 4a8f035fbad828c1b680aba4ed1c1741bbb83282 Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Sat, 12 Sep 2020 17:26:56 +0700 Subject: [PATCH 1/4] Create json.yml --- .github/workflows/json.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/json.yml diff --git a/.github/workflows/json.yml b/.github/workflows/json.yml new file mode 100644 index 0000000..d6d661b --- /dev/null +++ b/.github/workflows/json.yml @@ -0,0 +1,30 @@ +name: Update JSON schema file +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: yarn + - run: | + mkdir -p json + for I in ./deployments/*.js + do + node - "$I" > ./json/"$I"on << 'EOF' + console.log(JSON.stringify(require(process.argv(2)), null, 2) + EOF + done + - name: Push changes back to GitHub + env: + GIT_COMMITTER_NAME: Janitor + GIT_AUTHOR_NAME: Janitor + EMAIL: repository-janitor[bot]@users.noreply.github.com + run: | + git add --all \ + && git commit -m "Update $(node -p 'new Date().toJSON()')" \ + || echo "Nothing to commit" + git push origin "$GITHUB_REF" From 4981bc8df9b0cf0d62f3465bd503b4919b567e7b Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Sat, 12 Sep 2020 17:28:42 +0700 Subject: [PATCH 2/4] Update json.yml --- .github/workflows/json.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/json.yml b/.github/workflows/json.yml index d6d661b..878575f 100644 --- a/.github/workflows/json.yml +++ b/.github/workflows/json.yml @@ -11,8 +11,8 @@ jobs: - uses: actions/checkout@v2 - run: yarn - run: | - mkdir -p json - for I in ./deployments/*.js + mkdir -p json/deployment + for I in ./deployment/*.js do node - "$I" > ./json/"$I"on << 'EOF' console.log(JSON.stringify(require(process.argv(2)), null, 2) From 1f1368d666aac34ba74a06631e134aaa7c208575 Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Sat, 12 Sep 2020 17:30:07 +0700 Subject: [PATCH 3/4] Update json.yml I have been doing programming for so many years yet I still have trouble balancing parentheses :( --- .github/workflows/json.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/json.yml b/.github/workflows/json.yml index 878575f..c1918c3 100644 --- a/.github/workflows/json.yml +++ b/.github/workflows/json.yml @@ -15,7 +15,7 @@ jobs: for I in ./deployment/*.js do node - "$I" > ./json/"$I"on << 'EOF' - console.log(JSON.stringify(require(process.argv(2)), null, 2) + console.log(JSON.stringify(require(process.argv[2]), null, 2)) EOF done - name: Push changes back to GitHub From d476f475e5cfcba4e8ce538f0bf71e8f46924a39 Mon Sep 17 00:00:00 2001 From: Janitor Date: Sat, 12 Sep 2020 10:30:22 +0000 Subject: [PATCH 4/4] Update 2020-09-12T10:30:22.908Z --- json/deployment/config-env.json | 39 ++++ json/deployment/config-static.json | 85 ++++++++ json/deployment/config.json | 314 +++++++++++++++++++++++++++++ json/deployment/service.json | 13 ++ 4 files changed, 451 insertions(+) create mode 100644 json/deployment/config-env.json create mode 100644 json/deployment/config-static.json create mode 100644 json/deployment/config.json create mode 100644 json/deployment/service.json diff --git a/json/deployment/config-env.json b/json/deployment/config-env.json new file mode 100644 index 0000000..49c6de3 --- /dev/null +++ b/json/deployment/config-env.json @@ -0,0 +1,39 @@ +{ + "EnvKey": { + "type": "string", + "pattern": "^[A-z0-9_]+$", + "minLength": 1, + "maxLength": 256 + }, + "EnvKeys": { + "type": "array", + "minItems": 0, + "maxItems": 100, + "uniqueItems": true, + "items": { + "type": "string", + "pattern": "^[A-z0-9_]+$", + "minLength": 1, + "maxLength": 256 + }, + "additionalProperties": false + }, + "EnvValue": { + "type": "string", + "minLength": 0, + "maxLength": 65536 + }, + "EnvObject": { + "type": "object", + "minProperties": 0, + "maxProperties": 100, + "patternProperties": { + ".+": { + "type": "string", + "minLength": 0, + "maxLength": 65536 + } + }, + "additionalProperties": false + } +} diff --git a/json/deployment/config-static.json b/json/deployment/config-static.json new file mode 100644 index 0000000..b8b4049 --- /dev/null +++ b/json/deployment/config-static.json @@ -0,0 +1,85 @@ +{ + "type": "object", + "properties": { + "public": { + "type": "string" + }, + "cleanUrls": { + "type": [ + "boolean", + "array" + ] + }, + "rewrites": { + "type": "array" + }, + "redirects": { + "type": "array" + }, + "headers": { + "type": "array", + "maxItems": 50, + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "object", + "required": [ + "source", + "headers" + ], + "properties": { + "source": { + "type": "string", + "maxLength": 100, + "minLength": 1 + }, + "headers": { + "type": "array", + "maxItems": 50, + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "object", + "required": [ + "key", + "value" + ], + "properties": { + "key": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "pattern": "^[a-zA-Z0-9_!#$%&'*+.^`|~-]+$" + }, + "value": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "pattern": "^[a-zA-Z0-9_!#$%&'*+.;/:, =^`|~-]+$" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + } + }, + "directoryListing": { + "type": [ + "boolean", + "array" + ] + }, + "unlisted": { + "type": "array" + }, + "trailingSlash": { + "type": "boolean" + }, + "renderSingle": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/json/deployment/config.json b/json/deployment/config.json new file mode 100644 index 0000000..cdbdb0c --- /dev/null +++ b/json/deployment/config.json @@ -0,0 +1,314 @@ +{ + "type": "object", + "additionalProperties": false, + "dependencies": { + "slot": { + "type": "object", + "required": [ + "features" + ], + "properties": { + "features": { + "type": "object", + "required": [ + "cloud" + ], + "properties": { + "cloud": { + "const": "v2" + } + } + } + } + } + }, + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "project": { + "type": "string", + "minLength": 1 + }, + "alias": { + "type": [ + "string", + "array" + ] + }, + "env": { + "anyOf": [ + { + "type": "object", + "minProperties": 0, + "maxProperties": 100, + "patternProperties": { + ".+": { + "type": "string", + "minLength": 0, + "maxLength": 65536 + } + }, + "additionalProperties": false + }, + { + "type": "array", + "minItems": 0, + "maxItems": 100, + "uniqueItems": true, + "items": { + "type": "string", + "pattern": "^[A-z0-9_]+$", + "minLength": 1, + "maxLength": 256 + }, + "additionalProperties": false + } + ] + }, + "build": { + "type": "object", + "additionalProperties": false, + "properties": { + "env": { + "type": "object", + "minProperties": 0, + "maxProperties": 100, + "patternProperties": { + ".+": { + "type": "string", + "minLength": 0, + "maxLength": 65536 + } + }, + "additionalProperties": false + } + } + }, + "scale": { + "type": "object", + "patternProperties": { + ".+": { + "type": "object", + "required": [ + "max", + "min" + ], + "properties": { + "max": { + "anyOf": [ + { + "type": "number", + "minimum": 1 + }, + { + "const": "auto" + } + ] + }, + "min": { + "type": "number", + "minimum": 0 + } + }, + "if": { + "properties": { + "max": { + "type": "number" + } + } + }, + "then": { + "properties": { + "min": { + "maximum": { + "$data": "1/max" + } + } + } + } + } + }, + "additionalProperties": false + }, + "regions": { + "type": "array" + }, + "dotenv": { + "type": [ + "boolean", + "string" + ] + }, + "files": { + "type": "array" + }, + "type": { + "type": "string" + }, + "forwardNpm": { + "type": "boolean" + }, + "public": { + "type": "boolean" + }, + "engines": { + "type": "object" + }, + "api": { + "type": "string" + }, + "static": { + "type": "object", + "properties": { + "public": { + "type": "string" + }, + "cleanUrls": { + "type": [ + "boolean", + "array" + ] + }, + "rewrites": { + "type": "array" + }, + "redirects": { + "type": "array" + }, + "headers": { + "type": "array", + "maxItems": 50, + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "object", + "required": [ + "source", + "headers" + ], + "properties": { + "source": { + "type": "string", + "maxLength": 100, + "minLength": 1 + }, + "headers": { + "type": "array", + "maxItems": 50, + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "object", + "required": [ + "key", + "value" + ], + "properties": { + "key": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "pattern": "^[a-zA-Z0-9_!#$%&'*+.^`|~-]+$" + }, + "value": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "pattern": "^[a-zA-Z0-9_!#$%&'*+.;/:, =^`|~-]+$" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + } + }, + "directoryListing": { + "type": [ + "boolean", + "array" + ] + }, + "unlisted": { + "type": "array" + }, + "trailingSlash": { + "type": "boolean" + }, + "renderSingle": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "limits": { + "type": "object", + "properties": { + "duration": { + "type": "number", + "minimum": 60000, + "maximum": 900000 + }, + "maxConcurrentReqs": { + "type": "number", + "minimum": 1, + "maximum": 256 + }, + "timeout": { + "type": "number", + "minimum": 60000, + "maximum": 900000 + } + }, + "additionalProperties": false + }, + "features": { + "type": "object", + "patternProperties": { + ".*": { + "type": [ + "string", + "number", + "boolean" + ] + } + } + }, + "github": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "autoAlias": { + "type": "boolean" + }, + "autoJobCancelation": { + "type": "boolean" + }, + "silent": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "slot": { + "type": "string", + "pattern": "c.125-m512|c1-m4096|staging-*" + }, + "service": { + "type": "object", + "additionalProperties": false, + "properties": { + "port": { + "type": "number", + "minimum": 1, + "maximum": 32767 + } + } + } + } +} diff --git a/json/deployment/service.json b/json/deployment/service.json new file mode 100644 index 0000000..49aeea9 --- /dev/null +++ b/json/deployment/service.json @@ -0,0 +1,13 @@ +{ + "Service": { + "type": "object", + "additionalProperties": false, + "properties": { + "port": { + "type": "number", + "minimum": 1, + "maximum": 32767 + } + } + } +}