Skip to content

Commit

Permalink
fix: do not write access token to env file (#1365)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewvolk authored Sep 13, 2024
1 parent 00f72dd commit 896b4d3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-sheep-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/create-catalyst": minor
---

Changes the default behavior of the `create-catalyst` CLI such that it no longer writes the access token created by the OAuth device flow to the created project's `.env.local` file
1 change: 0 additions & 1 deletion packages/create-catalyst/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ export const create = new Command('create')
writeEnv(projectDir, {
channelId: channelId.toString(),
storeHash,
accessToken,
customerImpersonationToken,
});

Expand Down
1 change: 0 additions & 1 deletion packages/create-catalyst/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ export const init = new Command('init')
writeEnv(projectDir, {
channelId: channelId.toString(),
storeHash,
accessToken,
customerImpersonationToken,
});
});
6 changes: 2 additions & 4 deletions packages/create-catalyst/src/utils/write-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@ export const writeEnv = (
{
channelId,
storeHash,
accessToken,
customerImpersonationToken,
}: {
channelId: string;
storeHash: string;
accessToken: string;
customerImpersonationToken: string;
},
) => {
outputFileSync(
join(projectDir, '.env.local'),
[
`AUTH_SECRET=${randomBytes(32).toString('hex')}`,
`BIGCOMMERCE_STORE_HASH=${storeHash}`,
`BIGCOMMERCE_CHANNEL_ID=${channelId}`,
`BIGCOMMERCE_ACCESS_TOKEN=${accessToken}`,
`BIGCOMMERCE_CUSTOMER_IMPERSONATION_TOKEN=${customerImpersonationToken}`,
'',
`AUTH_SECRET=${randomBytes(32).toString('hex')}`,
`CLIENT_LOGGER=false`,
`ENABLE_ADMIN_ROUTE=true`,
`NEXT_PUBLIC_DEFAULT_REVALIDATE_TARGET=3600`,
Expand Down

0 comments on commit 896b4d3

Please sign in to comment.