Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
JOYBOY-0 committed Mar 25, 2024
1 parent cfb0105 commit 3361264
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-socks-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-bsmnt-app": patch
---

fix basehub usage
3 changes: 1 addition & 2 deletions cli/src/helpers/logNextSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ export const logNextSteps = async ({
if (!(await isInsideGitRepo(projectDir)) && !isRootGitRepo(projectDir)) {
logger.info(` git init`)
}
logger.info(` git commit -m "initial commit"`)

if (packages?.basehub.inUse) {
logger.info(` change de BASEHUB_TOKEN in .env file`)
logger.info(` change the BASEHUB_TOKEN in .env file`)
}
}
14 changes: 10 additions & 4 deletions cli/src/installers/envVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import fs from 'fs-extra'

import { type Installer } from '~/installers/index.js'

export const envVariablesInstaller: Installer = ({ projectDir }) => {
const envContent = getEnvContent()
export const envVariablesInstaller: Installer = ({ projectDir, packages }) => {
const envContent = getEnvContent({
usingBasehub: packages?.basehub.inUse,
})

const envDest = path.join(projectDir, '.env')
const envExampleDest = path.join(projectDir, '.env.example')
Expand All @@ -13,11 +15,15 @@ export const envVariablesInstaller: Installer = ({ projectDir }) => {
fs.writeFileSync(envExampleDest, exampleEnvContent + envContent, 'utf-8')
}

const getEnvContent = () => {
const getEnvContent = ({
usingBasehub,
}: {
usingBasehub: boolean | undefined
}) => {
const content = `
# When adding additional environment variables, the schema in "/src/env.js"
# should be updated accordingly.
BASEHUB_TOKEN="bshb_pk_56s2gv3g0azxbfj2zarn55kyxl7totvj6c9fkfg7jvrqyyu8vdnveobyvmfhr4rs"
${usingBasehub ? `BASEHUB_TOKEN="bshb_pk_56s2gv3g0azxbfj2zarn55kyxl7totvj6c9fkfg7jvrqyyu8vdnveobyvmfhr4rs` : ''}
`
.trim()
.concat('\n')
Expand Down
8 changes: 4 additions & 4 deletions cli/template/base/src/env.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";
import { createEnv } from '@t3-oss/env-nextjs'
import { z } from 'zod'

export const env = createEnv({
/**
* Specify your server-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars.
*/
server: {
NODE_ENV: z.enum(["development", "test", "production"]),
NODE_ENV: z.enum(['development', 'test', 'production']),
},

/**
Expand Down Expand Up @@ -37,4 +37,4 @@ export const env = createEnv({
* `SOME_VAR=''` will throw an error.
*/
emptyStringAsUndefined: true,
});
})

0 comments on commit 3361264

Please sign in to comment.