Skip to content

Commit 393c94d

Browse files
authored
fix: Add schema version to package.json (#1212)
We should have a version in the package.json file so that we can check compatibility with the CLI.
1 parent 39fc65e commit 393c94d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

serve/package.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This creates a directory with the plugin binaries, package.json and documentatio
2929
// PackageJSON is the package.json file inside the dist directory. It is used by the CloudQuery package command
3030
// to be able to package the plugin with all the needed metadata.
3131
type PackageJSON struct {
32+
SchemaVersion int `json:"schema_version"`
3233
Name string `json:"name"`
3334
Version string `json:"version"`
3435
Protocols []int `json:"protocols"`
@@ -141,6 +142,7 @@ func (s *PluginServe) writePackageJSON(dir, pluginVersion string) error {
141142
})
142143
}
143144
packageJSON := PackageJSON{
145+
SchemaVersion: 1,
144146
Name: s.plugin.Name(),
145147
Version: pluginVersion,
146148
Protocols: s.versions,

serve/package_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ func TestPluginPackage(t *testing.T) {
5555
}
5656

5757
expectPackage := PackageJSON{
58-
Name: "testPlugin",
59-
Version: "v1.2.3",
60-
Protocols: []int{3},
58+
SchemaVersion: 1,
59+
Name: "testPlugin",
60+
Version: "v1.2.3",
61+
Protocols: []int{3},
6162
SupportedTargets: []TargetBuild{
6263
{OS: plugin.GoOSLinux, Arch: plugin.GoArchAmd64, Path: "plugin-testPlugin-v1.2.3-linux-amd64.zip"},
6364
{OS: plugin.GoOSWindows, Arch: plugin.GoArchAmd64, Path: "plugin-testPlugin-v1.2.3-windows-amd64.zip"},

0 commit comments

Comments
 (0)