-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nx-heroku): add separate helpers for plugins and buildpacks
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
packages/nx-heroku/src/executors/common/heroku/buildpacks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { exec } from '../utils'; | ||
|
||
export async function clearBuildPacks(options: { appName: string }) { | ||
const { appName } = options; | ||
// stdout contains : Buildpacks cleared. Next release on <appName> will detect buildpacks normally. | ||
await exec(`heroku buildpacks:clear --app ${appName}`); | ||
} | ||
|
||
export async function addBuildPack(options: { | ||
appName: string; | ||
buildPack: string; | ||
index: number; | ||
}) { | ||
const { appName, buildPack, index } = options; | ||
// stdout contains : Buildpack added. Next release on <appName> will use <buildPack>. | ||
await exec( | ||
`heroku buildpacks:add ${buildPack} --app ${appName} --index ${index}` | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { exec } from '../utils'; | ||
|
||
export async function getPlugins(): Promise<string[]> { | ||
const { stdout } = await exec('heroku plugins', { encoding: 'utf8' }); | ||
return stdout | ||
.trim() | ||
.split('\n') | ||
.map((line) => line.trim().split(' ')[0]); | ||
} | ||
|
||
export async function hasPlugin(plugin: string): Promise<boolean> { | ||
const list = await getPlugins(); | ||
return list.includes(plugin); | ||
} | ||
|
||
export async function installPlugin(plugin: string): Promise<void> { | ||
const { stdout, stderr } = await exec(`heroku plugins:install ${plugin}`); | ||
console.warn('installPlugin', stdout, stderr); | ||
} |