diff --git a/.changeset/thick-bikes-repair.md b/.changeset/thick-bikes-repair.md new file mode 100644 index 00000000..3bdaea57 --- /dev/null +++ b/.changeset/thick-bikes-repair.md @@ -0,0 +1,5 @@ +--- +"composable-cli": patch +--- + +add environment variables to test file as well diff --git a/packages/composable-cli/src/commands/generate/d2c/tasks/setup-accounts.ts b/packages/composable-cli/src/commands/generate/d2c/tasks/setup-accounts.ts index 6e386dfe..084dc9c5 100644 --- a/packages/composable-cli/src/commands/generate/d2c/tasks/setup-accounts.ts +++ b/packages/composable-cli/src/commands/generate/d2c/tasks/setup-accounts.ts @@ -61,10 +61,13 @@ export async function setupAccountsTask< return parentTask.newListr({ title: "File system changes", task: async () => { - await addToEnvFile(ctx.workspaceRoot, ".env.local", { + const envVars = { NEXT_PUBLIC_PASSWORD_PROFILE_ID: profileCreationResult.data.id, NEXT_PUBLIC_AUTHENTICATION_REALM_ID: realmId, - }) + } + + await addToEnvFile(ctx.workspaceRoot, ".env.local", envVars) + await addToEnvFile(ctx.workspaceRoot, ".env.test", envVars) }, }) }, diff --git a/packages/composable-cli/src/commands/integration/algolia/algolia-integration-command.tsx b/packages/composable-cli/src/commands/integration/algolia/algolia-integration-command.tsx index 4f88c766..cfd99bbe 100644 --- a/packages/composable-cli/src/commands/integration/algolia/algolia-integration-command.tsx +++ b/packages/composable-cli/src/commands/integration/algolia/algolia-integration-command.tsx @@ -121,13 +121,17 @@ export function createAlgoliaIntegrationCommandHandler( task: createAlgoliaTask({ unsubscribe }), }, { - title: "Update .env file with latest keys", + title: "Update environment files with latest keys", task: async (ctx) => { const { workspaceRoot } = ctx - await addToEnvFile(workspaceRoot, ".env.local", { + + const envVariables = { NEXT_PUBLIC_ALGOLIA_API_KEY: options.searchApiKey, NEXT_PUBLIC_ALGOLIA_APP_ID: options.appId, - }) + } + + await addToEnvFile(workspaceRoot, ".env.local", envVariables) + await addToEnvFile(workspaceRoot, ".env.test", envVariables) }, }, ]) diff --git a/packages/composable-cli/src/commands/payments/manual/tasks/ep-payment.ts b/packages/composable-cli/src/commands/payments/manual/tasks/ep-payment.ts index f2fa3b6e..b065bc68 100644 --- a/packages/composable-cli/src/commands/payments/manual/tasks/ep-payment.ts +++ b/packages/composable-cli/src/commands/payments/manual/tasks/ep-payment.ts @@ -62,7 +62,7 @@ export function createEPPaymentTasks( }, }, { - title: "Update .env.local file", + title: "Update local environment files", task: async (taskCtx) => { const { accountId, publishableKey } = taskCtx @@ -73,10 +73,13 @@ export function createEPPaymentTasks( throw new Error("EP Payment gateway setup requires publishableKey") } - await addToEnvFile(taskCtx.workspaceRoot, ".env.local", { + const envVars = { NEXT_PUBLIC_STRIPE_ACCOUNT_ID: accountId, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: publishableKey, - }) + } + + await addToEnvFile(taskCtx.workspaceRoot, ".env.local", envVars) + await addToEnvFile(taskCtx.workspaceRoot, ".env.test", envVars) }, }, ])