Skip to content

Commit

Permalink
feat: add condition to adding payload variable
Browse files Browse the repository at this point in the history
  • Loading branch information
maneike committed Nov 6, 2024
1 parent ea08dd4 commit 9c27786
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/core/installMachine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ const createInstallMachine = (initialContext: InstallMachineContext) => {
deployVercelProjectActor: createStepMachine(
fromPromise<void, InstallMachineContext, AnyEventObject>(async ({ input }) => {
try {
await deployVercelProject();
await deployVercelProject(input.stateData.options.usePayload);
input.stateData.stepsCompleted.deployVercelProject = true;
saveStateToRcFile(input.stateData, input.projectDir);
} catch (error) {
Expand Down
14 changes: 8 additions & 6 deletions packages/core/installMachine/installSteps/vercel/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { execSync } from 'node:child_process';
import { logWithColoredPrefix } from '../../../utils/logWithColoredPrefix';

export const deployVercelProject = async () => {
export const deployVercelProject = async (usePayload: boolean) => {
execSync('npx vercel git connect', {
stdio: ['inherit', 'pipe', 'inherit'],
encoding: 'utf-8',
Expand All @@ -13,11 +13,13 @@ export const deployVercelProject = async () => {
encoding: 'utf8',
});

logWithColoredPrefix('vercel', 'Setting up environment variables...');
execSync("grep PAYLOAD_SECRET apps/web/.env | cut -d '=' -f2 | vercel env add PAYLOAD_SECRET production", {
stdio: 'inherit',
encoding: 'utf8',
});
if (usePayload) {
logWithColoredPrefix('vercel', 'Setting up environment variables...');
execSync("grep PAYLOAD_SECRET apps/web/.env | cut -d '=' -f2 | vercel env add PAYLOAD_SECRET production", {
stdio: 'inherit',
encoding: 'utf8',
});
}

if (productionUrl) {
logWithColoredPrefix('vercel', `You can access your production deployment at: \x1b[36m${productionUrl}\x1b[0m`);
Expand Down

0 comments on commit 9c27786

Please sign in to comment.