Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update init script to reflect MSF changes #111

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/cli/run/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ 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 = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/services/auth/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(/\/$/, '')}
`;

Expand Down
5 changes: 3 additions & 2 deletions src/services/auth/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(/\/$/, '')}
`;

Expand Down