-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2290 from carolynvs/allow-mixin-config
Retrieve mixin configuration schema from mixins
- Loading branch information
Showing
22 changed files
with
1,393 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package main | ||
|
||
import ( | ||
_ "embed" | ||
"fmt" | ||
"os" | ||
) | ||
|
||
//go:embed schema.json | ||
var schema string | ||
|
||
//go:embed version.txt | ||
var version string | ||
|
||
func main() { | ||
if len(os.Args) < 2 { | ||
return | ||
} | ||
|
||
command := os.Args[1] | ||
switch command { | ||
case "version": | ||
fmt.Println(version) | ||
case "schema": | ||
// This is a mixin that helps us test out our schema command | ||
fmt.Println(schema) | ||
case "lint": | ||
fmt.Println("[]") | ||
case "build": | ||
fmt.Println("# testmixin") | ||
case "run": | ||
fmt.Println("running testmixin...") | ||
default: | ||
fmt.Println("unsupported command:", command) | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"config": { | ||
"description": "Configuration that can be set when the mixin is declared", | ||
"type": "object", | ||
"properties": { | ||
"testmixin": { | ||
"description": "test mixin configuration", | ||
"type": "object", | ||
"properties": { | ||
"clientVersion": { | ||
"description": "Version of the client to install in the bundle", | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"installStep": { | ||
"type": "object", | ||
"properties": { | ||
"testmixin": { | ||
"$ref": "#/definitions/testmixin" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"testmixin" | ||
] | ||
}, | ||
"upgradeStep": { | ||
"type": "object", | ||
"properties": { | ||
"testmixin": { | ||
"$ref": "#/definitions/testmixin" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"testmixin" | ||
] | ||
}, | ||
"invokeStep": { | ||
"type": "object", | ||
"properties": { | ||
"testmixin": { | ||
"$ref": "#/definitions/testmixin" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"testmixin" | ||
] | ||
}, | ||
"uninstallStep": { | ||
"type": "object", | ||
"properties": { | ||
"testmixin": { | ||
"$ref": "#/definitions/testmixin" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"testmixin" | ||
] | ||
}, | ||
"testmixin": { | ||
"description": "A step that is executed by the test mixin", | ||
"type": "object", | ||
"properties": { | ||
"description": { | ||
"description": "A description of the mixin step", | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"description" | ||
] | ||
} | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"install": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/installStep" | ||
} | ||
}, | ||
"upgrade": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/upgradeStep" | ||
} | ||
}, | ||
"uninstall": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/uninstallStep" | ||
} | ||
} | ||
}, | ||
"additionalProperties": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/invokeStep" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "testmixin", | ||
"version": "v0.1.0", | ||
"commit": "abc123", | ||
"author": "Porter Authors" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--------------------------------- | ||
Name Version Author | ||
--------------------------------- | ||
exec v1.0 Porter Authors | ||
-------------------------------------- | ||
Name Version Author | ||
-------------------------------------- | ||
exec v1.0 Porter Authors | ||
testmixin v0.1.0 Porter Authors |
Oops, something went wrong.