Skip to content

Commit

Permalink
feat: add env to test file (#198)
Browse files Browse the repository at this point in the history
* feat: add environment variables to test file as well

* chore: changeset

* test: update schematics test snapshots for latest changes
  • Loading branch information
field123 authored Feb 15, 2024
1 parent e819f3d commit 9d95712
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-bikes-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"composable-cli": patch
---

add environment variables to test file as well
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function createEPPaymentTasks<TContext extends EPPaymentTasksContext>(
},
},
{
title: "Update .env.local file",
title: "Update local environment files",
task: async (taskCtx) => {
const { accountId, publishableKey } = taskCtx

Expand All @@ -73,10 +73,13 @@ export function createEPPaymentTasks<TContext extends EPPaymentTasksContext>(
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)
},
},
])
Expand Down

0 comments on commit 9d95712

Please sign in to comment.