From af5f788587951a692ff35694e2b9447b0bc1a67d Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 25 Feb 2022 01:39:55 +0400 Subject: [PATCH 1/3] feat: set new upstream branch for starters --- templates/cli/lib/commands/init.js.twig | 3 +-- templates/cli/lib/sdks.js.twig | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/cli/lib/commands/init.js.twig b/templates/cli/lib/commands/init.js.twig index 3bad4fb85..d4b84cf7a 100644 --- a/templates/cli/lib/commands/init.js.twig +++ b/templates/cli/lib/commands/init.js.twig @@ -78,8 +78,7 @@ const initFunction = async () => { git remote add -f origin https://github.com/{{ sdk.gitUserName }}/functions-starter && \ git config core.sparseCheckout true && \ echo '${answers.runtime.id}' >> .git/info/sparse-checkout && \ - git pull origin dev && \ - git checkout dev && \ + git pull origin main && \ rm -rf .git && \ mv ${answers.runtime.id}/* . && \ rm -rf ${answers.runtime.id}`; diff --git a/templates/cli/lib/sdks.js.twig b/templates/cli/lib/sdks.js.twig index 647ee472d..c1db5283f 100644 --- a/templates/cli/lib/sdks.js.twig +++ b/templates/cli/lib/sdks.js.twig @@ -61,6 +61,13 @@ const sdkForProject = async () => { .setSelfSigned(selfSigned) .setLocale("en-US"); + if (cookie) { + return client +{% if sdk.test != "true" %} + .setCookie(cookie) + .setMode("admin"); +{% endif %} + if (key) { return client {% if sdk.test != "true" %} @@ -69,12 +76,6 @@ const sdkForProject = async () => { {% endif %} } - if (cookie) { - return client -{% if sdk.test != "true" %} - .setCookie(cookie) - .setMode("admin"); -{% endif %} } throw new Error("Session not found. Please run `{{ language.params.executableName }} login` to create a session."); From 48ab68b248704afc979349409ebd884265f1e351 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 25 Feb 2022 01:42:20 +0400 Subject: [PATCH 2/3] feat: tweak client command --- templates/cli/lib/commands/generic.js.twig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/cli/lib/commands/generic.js.twig b/templates/cli/lib/commands/generic.js.twig index ba89be52f..608e40824 100644 --- a/templates/cli/lib/commands/generic.js.twig +++ b/templates/cli/lib/commands/generic.js.twig @@ -64,7 +64,7 @@ const client = new Command("client") parse(config) } - if (endpoint) { + if (endpoint !== undefined) { try { let url = new URL(endpoint); if (url.protocol === "http:" || url.protocol === "https:") { @@ -77,11 +77,11 @@ const client = new Command("client") } } - if (key) { + if (key !== undefined) { globalConfig.setKey(key) } - if (projectId) { + if (projectId !== undefined) { localConfig.setProject(projectId, ''); } @@ -89,7 +89,7 @@ const client = new Command("client") globalConfig.setSelfSigned(selfSigned); } - if (reset) { + if (reset !== undefined) { globalConfig.setEndpoint(""); globalConfig.setKey(""); globalConfig.setCookie(""); From d8addd8325bae9c7692c57630c6bc0bc3a9a22b1 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 25 Feb 2022 02:07:44 +0400 Subject: [PATCH 3/3] feat: fix CLI tests --- templates/cli/lib/sdks.js.twig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/cli/lib/sdks.js.twig b/templates/cli/lib/sdks.js.twig index c1db5283f..c277c0f66 100644 --- a/templates/cli/lib/sdks.js.twig +++ b/templates/cli/lib/sdks.js.twig @@ -67,6 +67,7 @@ const sdkForProject = async () => { .setCookie(cookie) .setMode("admin"); {% endif %} + } if (key) { return client @@ -76,8 +77,6 @@ const sdkForProject = async () => { {% endif %} } - } - throw new Error("Session not found. Please run `{{ language.params.executableName }} login` to create a session."); };