From 28e16c637bdc1b06fc004616294400447c3fcfdb Mon Sep 17 00:00:00 2001 From: Merlin Date: Sat, 3 Feb 2024 20:23:49 +0100 Subject: [PATCH] fix cli commands that interact with the api --- examples/automod/package-lock.json | 52 ++++++++++++++++++++++++++++++ examples/automod/yarn.lock | 16 --------- kite-docs/package-lock.json | 3 +- kite-service/cmd/config/login.go | 8 ++--- kite-service/cmd/plugin/deploy.go | 4 +-- 5 files changed, 59 insertions(+), 24 deletions(-) create mode 100644 examples/automod/package-lock.json delete mode 100644 examples/automod/yarn.lock diff --git a/examples/automod/package-lock.json b/examples/automod/package-lock.json new file mode 100644 index 0000000..8c7988d --- /dev/null +++ b/examples/automod/package-lock.json @@ -0,0 +1,52 @@ +{ + "name": "automod", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@merlingg/kite-sdk": "file:../../js-sdk", + "obscenity": "^0.2.0" + }, + "devDependencies": { + "typescript": "^5.3.3" + } + }, + "../../js-sdk": { + "version": "0.0.1", + "license": "AGPL-3.0", + "devDependencies": { + "@microsoft/api-extractor": "^7.39.4", + "esbuild": "^0.20.0", + "typescript": "^5.3.3" + } + }, + "node_modules/@merlingg/kite-sdk": { + "resolved": "../../js-sdk", + "link": true + }, + "node_modules/obscenity": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/obscenity/-/obscenity-0.2.0.tgz", + "integrity": "sha512-eYe8r9hqJk5dEMZkLtWlGlwGxKYO6xA/yEOzd8MGSG3vzn8hAgo6MUZ9dirA3kPAfy/1d1jEOkCUpIU1nGI1EQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + } +} diff --git a/examples/automod/yarn.lock b/examples/automod/yarn.lock deleted file mode 100644 index 46b23b2..0000000 --- a/examples/automod/yarn.lock +++ /dev/null @@ -1,16 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@merlingg/kite-sdk@file:../../js-sdk": - version "0.0.1" - -obscenity@^0.2.0: - version "0.2.0" - resolved "https://registry.npmjs.org/obscenity/-/obscenity-0.2.0.tgz" - integrity sha512-eYe8r9hqJk5dEMZkLtWlGlwGxKYO6xA/yEOzd8MGSG3vzn8hAgo6MUZ9dirA3kPAfy/1d1jEOkCUpIU1nGI1EQ== - -typescript@^5.3.3: - version "5.3.3" - resolved "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz" - integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== diff --git a/kite-docs/package-lock.json b/kite-docs/package-lock.json index c9bfb63..084a40e 100644 --- a/kite-docs/package-lock.json +++ b/kite-docs/package-lock.json @@ -6375,8 +6375,7 @@ "tapable": "^1.0.0" }, "engines": { - "node": ">=10", - "yarn": ">=1.0.0" + "node": ">=10" }, "peerDependencies": { "eslint": ">= 6", diff --git a/kite-service/cmd/config/login.go b/kite-service/cmd/config/login.go index 3209567..e68c1ef 100644 --- a/kite-service/cmd/config/login.go +++ b/kite-service/cmd/config/login.go @@ -22,7 +22,7 @@ func loginCMD() *cli.Command { &cli.StringFlag{ Name: "server", Usage: "The Kite server to deploy to", - Value: "http://localhost:3000", + Value: "http://localhost:8080", }, }, Action: func(c *cli.Context) error { @@ -45,7 +45,7 @@ func loginCMD() *cli.Command { func runLogin(serverURL *url.URL, cfg *config.GlobalConfig) error { authStartURL := *serverURL - authStartURL.Path = path.Join(authStartURL.Path, "/api/v1/auth/cli/start") + authStartURL.Path = path.Join(authStartURL.Path, "/v1/auth/cli/start") resp, err := http.Post(authStartURL.String(), "application/json", nil) if err != nil { return fmt.Errorf("Failed to start auth: %v", err) @@ -68,7 +68,7 @@ func runLogin(serverURL *url.URL, cfg *config.GlobalConfig) error { loginCode := loginResp.Data.Code authRedirectURL := *serverURL - authRedirectURL.Path = path.Join(authRedirectURL.Path, "/api/v1/auth/cli/redirect") + authRedirectURL.Path = path.Join(authRedirectURL.Path, "/v1/auth/cli/redirect") authRedirectURL.RawQuery = url.Values{ "code": {loginCode}, }.Encode() @@ -77,7 +77,7 @@ func runLogin(serverURL *url.URL, cfg *config.GlobalConfig) error { fmt.Println("\n\nWaiting for you to complete the login ...") authCheckURL := *serverURL - authCheckURL.Path = path.Join(authCheckURL.Path, "/api/v1/auth/cli/check") + authCheckURL.Path = path.Join(authCheckURL.Path, "/v1/auth/cli/check") authCheckURL.RawQuery = url.Values{ "code": {loginCode}, }.Encode() diff --git a/kite-service/cmd/plugin/deploy.go b/kite-service/cmd/plugin/deploy.go index d858cb4..b67540a 100644 --- a/kite-service/cmd/plugin/deploy.go +++ b/kite-service/cmd/plugin/deploy.go @@ -34,7 +34,7 @@ func deployCMD() *cli.Command { &cli.StringFlag{ Name: "server", Usage: "The Kite server to deploy to", - Value: "http://localhost:3000", + Value: "http://localhost:8080", }, }, Action: func(c *cli.Context) error { @@ -81,7 +81,7 @@ func runDeploy( return fmt.Errorf("No session for server %s, login first!", serverURL.String()) } - serverURL.Path = path.Join(serverURL.Path, "api/v1/guilds", guildID, "deployments") + serverURL.Path = path.Join(serverURL.Path, "v1/guilds", guildID, "deployments") wasmPath := filepath.Join(basePath, cfg.Module.Build.Out) wasm, err := os.ReadFile(wasmPath)