From f37524595d559560679bba57259d93f679802a87 Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Mon, 31 Oct 2022 11:04:43 +0100 Subject: [PATCH 1/4] Updated init script and README to support bigcommerce/widget-builder/pull/110 --- README.md | 1 + src/cli/run/init.ts | 5 +++++ src/services/auth/generate.ts | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 63a9ee5..3a7c164 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ You can find more information here. https://support.bigcommerce.com/s/article/St ? What is the Client ID? xxxxxxxxxxxxx ? What is the Access Token? xxxxxxxxxxxxx ? What is the API Path? https://api.bigcommerce.com/stores/xxxxx/v3/ +? What is the Channel ID or ID\'s you would like to publish your widgets to? Seperate channel ID\'s with comma.? (1,2,3,4) [2021-09-08T15:12:40.271Z] Successfully created your configuration, you're all set! ``` ### Resetting configurations diff --git a/src/cli/run/init.ts b/src/cli/run/init.ts index bdd78c1..c002d39 100644 --- a/src/cli/run/init.ts +++ b/src/cli/run/init.ts @@ -34,6 +34,11 @@ const configQuestionnaire = [ }); }, }, + { + type: 'input', + name: 'channelId', + message: 'What is the Channel ID or ID\'s you would like to publish your widgets to? Seperate channel ID\'s with comma.', + } ]; const init = () => { diff --git a/src/services/auth/generate.ts b/src/services/auth/generate.ts index 76fb415..d2613af 100644 --- a/src/services/auth/generate.ts +++ b/src/services/auth/generate.ts @@ -9,16 +9,17 @@ interface EnvironmentInterface { clientId: string; accessToken: string; apiPath: string; + channelId: string; } const generateConfig = ({ - clientId, accessToken, apiPath, + clientId, accessToken, channelId, apiPath, }: EnvironmentInterface) => { const dir = resolve('.'); const configuration = ` WIDGET_BUILDER_AUTH_ID=${clientId} WIDGET_BUILDER_AUTH_TOKEN=${accessToken} -WIDGET_BUILDER_CHANNEL_ID=1 +WIDGET_BUILDER_CHANNEL_ID=${channelId} WIDGET_BUILDER_API_GATEWAY_BASE=${apiPath.replace(/\/$/, '')} `; From 69400beffa8595a29ec19a9c34459d8ef4742e14 Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Mon, 31 Oct 2022 11:35:21 +0100 Subject: [PATCH 2/4] update tests --- src/services/auth/generate.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/auth/generate.test.ts b/src/services/auth/generate.test.ts index f2c9c33..24dd10d 100644 --- a/src/services/auth/generate.test.ts +++ b/src/services/auth/generate.test.ts @@ -11,12 +11,13 @@ const config = { clientId: 'someClientId', accessToken: 'sometokenvalue', apiPath: 'https://api.bigcommerce.com/stores/storeHash/v3/', + channelId: 'someString', }; const configuration = ` WIDGET_BUILDER_AUTH_ID=${config.clientId} WIDGET_BUILDER_AUTH_TOKEN=${config.accessToken} -WIDGET_BUILDER_CHANNEL_ID=1 +WIDGET_BUILDER_CHANNEL_ID=${config.channelId} WIDGET_BUILDER_API_GATEWAY_BASE=${config.apiPath.replace(/\/$/, '')} `; From a692543568fecb08a89eda363e1bd036adc98230 Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Mon, 31 Oct 2022 11:53:25 +0100 Subject: [PATCH 3/4] fix max-len --- src/cli/run/init.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cli/run/init.ts b/src/cli/run/init.ts index c002d39..2efe543 100644 --- a/src/cli/run/init.ts +++ b/src/cli/run/init.ts @@ -37,7 +37,8 @@ const configQuestionnaire = [ { type: 'input', name: 'channelId', - message: 'What is the Channel ID or ID\'s you would like to publish your widgets to? Seperate channel ID\'s with comma.', + message: `What is the Channel ID or ID\'s you would like to publish your widgets to? + Seperate channel ID\'s with comma.`, } ]; From 0e318c2016d5e7d5c3f36d737d2c29e091ea2285 Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Mon, 31 Oct 2022 12:26:40 +0100 Subject: [PATCH 4/4] fix no-useless-escape, no-trailing-spaces, comma-dangle --- src/cli/run/init.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli/run/init.ts b/src/cli/run/init.ts index 2efe543..90c6c90 100644 --- a/src/cli/run/init.ts +++ b/src/cli/run/init.ts @@ -37,9 +37,9 @@ const configQuestionnaire = [ { type: 'input', name: 'channelId', - message: `What is the Channel ID or ID\'s you would like to publish your widgets to? - Seperate channel ID\'s with comma.`, - } + message: `What is the Channel ID or ID's you would like to publish your widgets to? + Seperate channel ID's with comma.`, + }, ]; const init = () => {