Skip to content

Commit

Permalink
fix(nx-heroku): make org optional to allow personal apps
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Mar 2, 2023
1 parent 331812d commit d4b8244
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
17 changes: 8 additions & 9 deletions packages/nx-heroku/src/executors/common/heroku/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,15 @@ export async function appExists(options: {
export async function createApp(options: {
appName: string;
remoteName: string;
org: string;
org?: string;
region?: string;
}): Promise<{ stdout: string; stderr: string }> {
const { appName, remoteName, org, region = 'eu' } = options;
// outputs on success to stderr : Creating ${appName}... done, region is ${region}, stack is ${HEROKU_STACK}
// outputs on success to stdout : https://<app-name>.herokuapp.com/ | https://git.heroku.com/<app-name>.git
return exec(
`heroku create ${appName} --remote ${remoteName} --region ${region} --stack ${HEROKU_STACK} --team ${org}`,
{ encoding: 'utf-8' }
);
const baseCommand = `heroku apps:create ${appName} --remote ${remoteName} --region ${region} --stack ${HEROKU_STACK}`;
const command = org ? `${baseCommand} --team ${org}` : baseCommand;
return exec(command, { encoding: 'utf-8' });
}

export async function createAppRemote(options: {
Expand All @@ -156,12 +155,12 @@ export async function createPipeline(options: {
appName: string;
pipelineName: string;
environment: Environment;
org: string;
org?: string;
}): Promise<void> {
const { appName, environment, org, pipelineName } = options;
await exec(
`heroku pipelines:create ${pipelineName} --app ${appName} --stage ${environment} --team ${org}`
);
const baseCommand = `heroku pipelines:create ${pipelineName} --app ${appName} --stage ${environment}`;
const command = org ? `${baseCommand} --team ${org}` : baseCommand;
await exec(command);
}

export async function addAppToPipeline(options: {
Expand Down
3 changes: 2 additions & 1 deletion packages/nx-heroku/src/executors/deploy/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Environment } from '../common/constants';
export interface DeployExecutorSchema
extends Omit<ExecutorBaseSchema, 'config'> {
config: Environment[];
org: string;
// org not required to allow for personal apps
org?: string;
repositoryName?: string;
buildPacks: string[];
variables?: Record<string, string>;
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-heroku/src/executors/deploy/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,5 @@
"type": "boolean"
}
},
"required": ["config", "apiKey", "email", "org", "buildPacks", "watchDelay"]
"required": ["config", "apiKey", "email", "buildPacks", "watchDelay"]
}
2 changes: 1 addition & 1 deletion packages/nx-heroku/src/executors/promote/schema.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExecutorBaseSchema } from '../common/base-schema';

export interface PromoteExecutorSchema extends ExecutorBaseSchema {
org: string;
org?: string;
serviceUser: string;
variables?: Record<string, string>;
}
2 changes: 1 addition & 1 deletion packages/nx-heroku/src/executors/promote/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
"type": "boolean"
}
},
"required": ["config", "apiKey", "email", "org"]
"required": ["config", "apiKey", "email"]
}
2 changes: 1 addition & 1 deletion packages/nx-heroku/src/generators/common/schema.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface GeneratorSchema {
projectName: string;
org: string;
org?: string;
repositoryName?: string;
appNamePrefix?: string;
apiKey?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-heroku/src/generators/common/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@
"type": "boolean"
}
},
"required": ["projectName", "org"]
"required": ["projectName"]
}

0 comments on commit d4b8244

Please sign in to comment.