Skip to content

Commit 506f2cd

Browse files
author
Igor Olshevsky
committed
Merge branch 'feature/extension-manifest'
2 parents 10a10fb + 05505ff commit 506f2cd

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

cli

8.29 MB
Binary file not shown.

extensions/frontend/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"onCommand:go.tools.install",
6262
"onDebugResolve:go"
6363
],
64-
"main": "./out/src/goMain",
64+
"main": "./main.js",
6565
"contributes": {
6666
"languages": [
6767
{
@@ -1368,6 +1368,9 @@
13681368
]
13691369
}
13701370
},
1371+
"extension": {
1372+
"type": "extension.simple"
1373+
},
13711374
"__metadata": {
13721375
"id": "d6f6cfea-4b6f-41f4-b571-6ad2ab7918da",
13731376
"publisherDisplayName": "Microsoft",

src/cli/extensions.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func init() {
4848
_, err = strategy.Build()
4949
_, err = strategy.Pack()
5050
_, err = strategy.Publish()
51-
_, err = strategy.AddToRegistry()
51+
_, err = strategy.AddToRegistry(&context)
5252

5353
if err != nil {
5454
log.Fatal(err)

src/cli/strategy.go

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"context"
55
"fmt"
66
"github.com/shurcooL/graphql"
7+
"io/ioutil"
8+
"path/filepath"
79
)
810

911
type ExtensionContext struct {
@@ -16,7 +18,7 @@ type ExtensionLifecycle interface {
1618
Build() (bool, error)
1719
Pack() (string, error)
1820
Publish() (bool, error)
19-
AddToRegistry() (bool, error)
21+
AddToRegistry(context *ExtensionContext) (bool, error)
2022
}
2123

2224
type AbstractExtension struct {
@@ -40,22 +42,30 @@ func (ae AbstractExtension) Build() (bool, error) {
4042
return runCommand(ae.Context.Dir, ae.Manifest.Scripts.Build, "")
4143
}
4244

43-
func (ae AbstractExtension) AddToRegistry() (bool, error) {
45+
func (ae AbstractExtension) AddToRegistry(ctx *ExtensionContext) (bool, error) {
46+
manifest := ae.Manifest.String()
47+
48+
data, err := ioutil.ReadFile(filepath.Join(ctx.Dir, ctx.ManifestFile))
49+
50+
if err == nil {
51+
manifest = string(data)
52+
}
53+
4454
mutation, variables := NewPublishExtensionMutation(PublishExtensionVariables{
4555
force: true,
56+
manifest: manifest,
4657
name: ae.Manifest.Name,
4758
bundle: ae.Manifest.Bundle,
4859
version: ae.Manifest.Version,
49-
manifest: ae.Manifest.String(),
5060
extensionID: ae.Manifest.ExtensionID,
5161
})
5262

53-
err := ae.Context.GraphqlClient.Mutate(context.Background(), &mutation, variables)
63+
netErr := ae.Context.GraphqlClient.Mutate(context.Background(), &mutation, variables)
5464

5565
fmt.Printf("Mutation %s \n", ae.Manifest.String())
5666

57-
if err != nil {
58-
return false, err
67+
if netErr != nil {
68+
return false, netErr
5969
}
6070

6171
return true, nil

0 commit comments

Comments
 (0)