Skip to content

Commit 81646f8

Browse files
committed
fix(nx-heroku): make buildpacks option required
1 parent 2e22feb commit 81646f8

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

packages/nx-heroku/src/executors/common/heroku/plugins.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ export async function hasPlugin(plugin: string): Promise<boolean> {
1414
}
1515

1616
export async function installPlugin(plugin: string): Promise<void> {
17-
const { stdout, stderr } = await exec(`heroku plugins:install ${plugin}`);
18-
console.warn('installPlugin', stdout, stderr);
17+
await exec(`heroku plugins:install ${plugin}`);
1918
}

packages/nx-heroku/src/executors/common/utils.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function sleep(ms: number) {
2323
return new Promise((resolve) => setTimeout(resolve, ms));
2424
}
2525

26+
// TODO: refactor to be more performant and efficient, running expand on each object option is (probably) not really efficient
2627
export function expandOptions<O extends object>(options: O): O {
2728
// iterate over 1 nested level objects
2829
const parsedNested = Object.entries(options).reduce((acc, curr) => {

packages/nx-heroku/src/executors/deploy/schema.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { ExecutorBaseSchema } from '../common/base-schema';
22
import { Environment } from '../common/constants';
33

4-
export interface DeployExecutorSchema extends Omit<ExecutorBaseSchema, 'config'> {
4+
export interface DeployExecutorSchema
5+
extends Omit<ExecutorBaseSchema, 'config'> {
56
config: Environment[];
67
org: string;
78
repositoryName?: string;
8-
buildPacks?: string[];
9+
buildPacks: string[];
910
variables?: Record<string, string>;
1011
addons?: { addonAlias?: string; addonName: string }[];
1112
webhook?: {

packages/nx-heroku/src/executors/deploy/schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,5 +189,5 @@
189189
"type": "boolean"
190190
}
191191
},
192-
"required": ["config", "apiKey", "email", "org", "watchDelay"]
192+
"required": ["config", "apiKey", "email", "org", "buildPacks", "watchDelay"]
193193
}

packages/nx-heroku/src/executors/deploy/services/heroku-app.service.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,15 @@ class HerokuApp {
163163

164164
private async addBuildPacks(): Promise<void> {
165165
const { appName, buildPacks } = this.options;
166-
if (buildPacks?.length) {
167-
if (!(await hasPlugin('buildpack-registry'))) {
168-
await installPlugin('buildpack-registry');
169-
}
170-
this.logger.info(`Clearing and adding buildpacks...`);
171-
await clearBuildPacks({ appName });
172-
for (const [i, buildPack] of buildPacks.entries()) {
173-
await addBuildPack({ appName, buildPack, index: i + 1 });
174-
}
175-
this.logger.info(`Buildpacks ${buildPacks} added.`);
166+
if (!(await hasPlugin('buildpack-registry'))) {
167+
await installPlugin('buildpack-registry');
168+
}
169+
this.logger.info(`Clearing and adding buildpacks...`);
170+
await clearBuildPacks({ appName });
171+
for (const [i, buildPack] of buildPacks.entries()) {
172+
await addBuildPack({ appName, buildPack, index: i + 1 });
176173
}
174+
this.logger.info(`Buildpacks ${buildPacks} added.`);
177175
}
178176

179177
private createStatic(): Promise<void> {

0 commit comments

Comments
 (0)