diff --git a/src/api/json/catalog.json b/src/api/json/catalog.json index 450e2eb3653..cd9a3832e52 100644 --- a/src/api/json/catalog.json +++ b/src/api/json/catalog.json @@ -65,6 +65,12 @@ "fileMatch": ["accelerator.yaml"], "url": "https://www.schemastore.org/accelerator.json" }, + { + "name": "amplify.yml", + "description": "AWS Amplify Console build settings file", + "fileMatch": ["amplify.yml", "amplify.yaml"], + "url": "https://www.schemastore.org/amplify.json" + }, { "name": "Applicant Profile Protocol", "description": "Structured JSON format for professional profiles, resumes, and CVs with skills, experience, education, and certifications", diff --git a/src/schemas/json/amplify.json b/src/schemas/json/amplify.json new file mode 100644 index 00000000000..fe80ce7fb88 --- /dev/null +++ b/src/schemas/json/amplify.json @@ -0,0 +1,202 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://json.schemastore.org/amplify.json", + "title": "AWS Amplify build specification (amplify.yml)", + "type": "object", + "properties": { + "version": { + "description": "Schema version (integer as in AWS examples)", + "type": "integer" + }, + "env": { + "type": "object", + "properties": { + "variables": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": true + }, + "backend": { + "type": "object", + "properties": { + "phases": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/phase" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": true + }, + "frontend": { + "type": "object", + "properties": { + "buildpath": { + "type": "string" + }, + "phases": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/phase" + } + }, + "additionalProperties": false + }, + "artifacts": { + "type": "object", + "properties": { + "files": { + "type": "array", + "items": { + "type": "string" + } + }, + "discard-paths": { + "type": "boolean" + }, + "baseDirectory": { + "type": "string" + } + }, + "additionalProperties": false + }, + "cache": { + "type": "object", + "properties": { + "paths": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": true + }, + "test": { + "type": "object", + "properties": { + "phases": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/phase" + } + }, + "additionalProperties": false + }, + "artifacts": { + "type": "object", + "properties": { + "files": { + "type": "array", + "items": { + "type": "string" + } + }, + "configFilePath": { + "type": "string" + }, + "baseDirectory": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": true + } + }, + "definitions": { + "phase": { + "type": "object", + "properties": { + "commands": { + "type": "array", + "items": { + "type": "string" + } + }, + "runtime-versions": { + "description": "Optional object to specify runtime versions (e.g. nodejs: 12)", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": true + } + }, + "additionalProperties": true, + "examples": [ + { + "version": 1, + "env": { + "variables": { + "key": "value" + } + }, + "backend": { + "phases": { + "preBuild": { + "commands": ["enter command"] + }, + "build": { + "commands": ["enter command"] + }, + "postBuild": { + "commands": ["enter command"] + } + } + }, + "frontend": { + "buildpath": "", + "phases": { + "preBuild": { + "commands": ["cd react-app", "npm ci"] + }, + "build": { + "commands": ["npm run build"] + } + }, + "artifacts": { + "files": ["location"], + "discard-paths": true, + "baseDirectory": "location" + }, + "cache": { + "paths": ["path"] + } + }, + "test": { + "phases": { + "preTest": { + "commands": ["enter command"] + }, + "test": { + "commands": ["enter command"] + }, + "postTest": { + "commands": ["enter command"] + } + }, + "artifacts": { + "files": ["location"], + "configFilePath": "location", + "baseDirectory": "location" + } + } + } + ] +} diff --git a/src/test/amplify/amplify.yml b/src/test/amplify/amplify.yml new file mode 100644 index 00000000000..9c766013658 --- /dev/null +++ b/src/test/amplify/amplify.yml @@ -0,0 +1,21 @@ +# yaml-language-server: $schema=../../schemas/json/amplify.json +version: 1 +applications: + - appRoot: 'frontend' + frontend: + phases: + preBuild: + commands: + - yarn install + build: + commands: + - yarn build + artifacts: + baseDirectory: build + files: + - '**/*' + cache: + paths: + - node_modules/** + backend: + someKey: someValue