heroku 8.1.9 → 8.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete-scripts/README.md +7 -0
- package/autocomplete-scripts/bash/heroku.bash +59 -0
- package/autocomplete-scripts/brew/bash +4 -0
- package/autocomplete-scripts/brew/zsh/_heroku +59 -0
- package/autocomplete-scripts/zsh/_heroku +53 -0
- package/bin/bats-test-runner.js +7 -0
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +36 -1
- package/lib/analytics.d.ts +2 -2
- package/lib/analytics.js +3 -4
- package/lib/commands/auth/2fa/disable.d.ts +7 -0
- package/lib/commands/auth/2fa/disable.js +16 -0
- package/lib/commands/auth/2fa/index.d.ts +6 -0
- package/lib/commands/auth/2fa/index.js +18 -0
- package/lib/commands/auth/login.d.ts +8 -0
- package/lib/commands/auth/login.js +25 -0
- package/lib/commands/auth/logout.d.ts +6 -0
- package/lib/commands/auth/logout.js +14 -0
- package/lib/commands/auth/token.d.ts +7 -0
- package/lib/commands/auth/token.js +31 -0
- package/lib/commands/auth/whoami.d.ts +7 -0
- package/lib/commands/auth/whoami.js +26 -0
- package/lib/commands/authorizations/create.d.ts +13 -0
- package/lib/commands/authorizations/create.js +41 -0
- package/lib/commands/authorizations/index.d.ts +9 -0
- package/lib/commands/authorizations/index.js +35 -0
- package/lib/commands/authorizations/info.d.ts +11 -0
- package/lib/commands/authorizations/info.js +25 -0
- package/lib/commands/authorizations/revoke.d.ts +10 -0
- package/lib/commands/authorizations/revoke.js +22 -0
- package/lib/commands/authorizations/rotate.d.ts +8 -0
- package/lib/commands/authorizations/rotate.js +19 -0
- package/lib/commands/authorizations/update.d.ts +13 -0
- package/lib/commands/authorizations/update.js +36 -0
- package/lib/commands/autocomplete/create.d.ts +29 -0
- package/lib/commands/autocomplete/create.js +213 -0
- package/lib/commands/autocomplete/doctor.d.ts +12 -0
- package/lib/commands/autocomplete/doctor.js +97 -0
- package/lib/commands/autocomplete/index.d.ts +12 -0
- package/lib/commands/autocomplete/index.js +67 -0
- package/lib/commands/autocomplete/options.d.ts +25 -0
- package/lib/commands/autocomplete/options.js +210 -0
- package/lib/commands/autocomplete/script.d.ts +10 -0
- package/lib/commands/autocomplete/script.js +23 -0
- package/lib/commands/buildpacks/add.d.ts +13 -0
- package/lib/commands/buildpacks/add.js +43 -0
- package/lib/commands/buildpacks/clear.d.ts +9 -0
- package/lib/commands/buildpacks/clear.js +17 -0
- package/lib/commands/buildpacks/index.d.ts +9 -0
- package/lib/commands/buildpacks/index.js +25 -0
- package/lib/commands/buildpacks/info.d.ts +8 -0
- package/lib/commands/buildpacks/info.js +41 -0
- package/lib/commands/buildpacks/remove.d.ts +13 -0
- package/lib/commands/buildpacks/remove.js +55 -0
- package/lib/commands/buildpacks/search.d.ts +13 -0
- package/lib/commands/buildpacks/search.js +69 -0
- package/lib/commands/buildpacks/set.d.ts +13 -0
- package/lib/commands/buildpacks/set.js +42 -0
- package/lib/commands/buildpacks/versions.d.ts +8 -0
- package/lib/commands/buildpacks/versions.js +56 -0
- package/lib/commands/certs/auto/wait.d.ts +9 -0
- package/lib/commands/certs/auto/wait.js +14 -0
- package/lib/commands/ci/index.d.ts +12 -0
- package/lib/commands/ci/index.js +25 -0
- package/lib/commands/ci/info.d.ts +14 -0
- package/lib/commands/ci/info.js +29 -0
- package/lib/commands/ci/last.d.ts +11 -0
- package/lib/commands/ci/last.js +31 -0
- package/lib/commands/ci/rerun.d.ts +13 -0
- package/lib/commands/ci/rerun.js +53 -0
- package/lib/commands/ci/run.d.ts +10 -0
- package/lib/commands/ci/run.js +42 -0
- package/lib/commands/clients/create.d.ts +14 -0
- package/lib/commands/clients/create.js +37 -0
- package/lib/commands/clients/destroy.d.ts +8 -0
- package/lib/commands/clients/destroy.js +18 -0
- package/lib/commands/clients/index.d.ts +8 -0
- package/lib/commands/clients/index.js +32 -0
- package/lib/commands/clients/info.d.ts +13 -0
- package/lib/commands/clients/info.js +33 -0
- package/lib/commands/clients/rotate.d.ts +12 -0
- package/lib/commands/clients/rotate.js +33 -0
- package/lib/commands/clients/update.d.ts +13 -0
- package/lib/commands/clients/update.js +38 -0
- package/lib/commands/config/edit.d.ts +23 -0
- package/lib/commands/config/edit.js +132 -0
- package/lib/commands/config/get.d.ts +16 -0
- package/lib/commands/config/get.js +35 -0
- package/lib/commands/config/index.d.ts +11 -0
- package/lib/commands/config/index.js +33 -0
- package/lib/commands/config/unset.d.ts +12 -0
- package/lib/commands/config/unset.js +51 -0
- package/lib/commands/console.d.ts +11 -0
- package/lib/commands/console.js +30 -0
- package/lib/commands/domains/add.d.ts +19 -0
- package/lib/commands/domains/add.js +117 -0
- package/lib/commands/domains/clear.d.ts +11 -0
- package/lib/commands/domains/clear.js +26 -0
- package/lib/commands/domains/index.d.ts +40 -0
- package/lib/commands/domains/index.js +79 -0
- package/lib/commands/domains/info.d.ts +14 -0
- package/lib/commands/domains/info.js +25 -0
- package/lib/commands/domains/remove.d.ts +14 -0
- package/lib/commands/domains/remove.js +26 -0
- package/lib/commands/domains/update.d.ts +15 -0
- package/lib/commands/domains/update.js +40 -0
- package/lib/commands/domains/wait.d.ts +13 -0
- package/lib/commands/domains/wait.js +32 -0
- package/lib/commands/git/clone.d.ts +13 -0
- package/lib/commands/git/clone.js +29 -0
- package/lib/commands/git/credentials.d.ts +9 -0
- package/lib/commands/git/credentials.js +32 -0
- package/lib/commands/git/remote.d.ts +11 -0
- package/lib/commands/git/remote.js +44 -0
- package/lib/commands/labs/disable.d.ts +11 -0
- package/lib/commands/labs/disable.js +65 -0
- package/lib/commands/local/index.d.ts +17 -0
- package/lib/commands/local/index.js +75 -0
- package/lib/commands/local/run.d.ts +11 -0
- package/lib/commands/local/run.js +38 -0
- package/lib/commands/local/version.d.ts +5 -0
- package/lib/commands/local/version.js +13 -0
- package/lib/commands/logs.d.ts +16 -0
- package/lib/commands/logs.js +45 -0
- package/lib/commands/pipelines/add.d.ts +14 -0
- package/lib/commands/pipelines/add.js +61 -0
- package/lib/commands/pipelines/connect.d.ts +12 -0
- package/lib/commands/pipelines/connect.js +52 -0
- package/lib/commands/pipelines/create.d.ts +15 -0
- package/lib/commands/pipelines/create.js +91 -0
- package/lib/commands/pipelines/destroy.d.ts +9 -0
- package/lib/commands/pipelines/destroy.js +27 -0
- package/lib/commands/pipelines/diff.d.ts +19 -0
- package/lib/commands/pipelines/diff.js +152 -0
- package/lib/commands/pipelines/index.d.ts +9 -0
- package/lib/commands/pipelines/index.js +27 -0
- package/lib/commands/pipelines/info.d.ts +13 -0
- package/lib/commands/pipelines/info.js +43 -0
- package/lib/commands/pipelines/open.d.ts +9 -0
- package/lib/commands/pipelines/open.js +19 -0
- package/lib/commands/pipelines/promote.d.ts +12 -0
- package/lib/commands/pipelines/promote.js +216 -0
- package/lib/commands/pipelines/remove.d.ts +10 -0
- package/lib/commands/pipelines/remove.js +23 -0
- package/lib/commands/pipelines/rename.d.ts +10 -0
- package/lib/commands/pipelines/rename.js +33 -0
- package/lib/commands/pipelines/setup.d.ts +14 -0
- package/lib/commands/pipelines/setup.js +91 -0
- package/lib/commands/pipelines/transfer.d.ts +13 -0
- package/lib/commands/pipelines/transfer.js +65 -0
- package/lib/commands/pipelines/update.d.ts +11 -0
- package/lib/commands/pipelines/update.js +32 -0
- package/lib/commands/ps/autoscale/disable.d.ts +9 -0
- package/lib/commands/ps/autoscale/disable.js +35 -0
- package/lib/commands/ps/autoscale/enable.d.ts +13 -0
- package/lib/commands/ps/autoscale/enable.js +65 -0
- package/lib/commands/ps/wait.d.ts +12 -0
- package/lib/commands/ps/wait.js +78 -0
- package/lib/commands/rake.d.ts +14 -0
- package/lib/commands/rake.js +46 -0
- package/lib/commands/regions.d.ts +11 -0
- package/lib/commands/regions.js +45 -0
- package/lib/commands/reviewapps/disable.d.ts +17 -0
- package/lib/commands/reviewapps/disable.js +102 -0
- package/lib/commands/reviewapps/enable.d.ts +14 -0
- package/lib/commands/reviewapps/enable.js +89 -0
- package/lib/commands/run/detached.d.ts +15 -0
- package/lib/commands/run/detached.js +56 -0
- package/lib/commands/run/index.d.ts +18 -0
- package/lib/commands/run/index.js +64 -0
- package/lib/commands/run/inside.d.ts +15 -0
- package/lib/commands/run/inside.js +55 -0
- package/lib/commands/sessions/destroy.d.ts +8 -0
- package/lib/commands/sessions/destroy.js +18 -0
- package/lib/commands/sessions/index.d.ts +8 -0
- package/lib/commands/sessions/index.js +31 -0
- package/lib/commands/status.d.ts +8 -0
- package/lib/commands/status.js +46 -0
- package/lib/commands/webhooks/add.d.ts +16 -0
- package/lib/commands/webhooks/add.js +47 -0
- package/lib/commands/webhooks/deliveries/index.d.ts +12 -0
- package/lib/commands/webhooks/deliveries/index.js +80 -0
- package/lib/commands/webhooks/deliveries/info.d.ts +14 -0
- package/lib/commands/webhooks/deliveries/info.js +42 -0
- package/lib/commands/webhooks/events/index.d.ts +11 -0
- package/lib/commands/webhooks/events/index.js +46 -0
- package/lib/commands/webhooks/events/info.d.ts +14 -0
- package/lib/commands/webhooks/events/info.js +31 -0
- package/lib/commands/webhooks/index.d.ts +11 -0
- package/lib/commands/webhooks/index.js +45 -0
- package/lib/commands/webhooks/info.d.ts +14 -0
- package/lib/commands/webhooks/info.js +31 -0
- package/lib/commands/webhooks/remove.d.ts +14 -0
- package/lib/commands/webhooks/remove.js +29 -0
- package/lib/commands/webhooks/update.d.ts +19 -0
- package/lib/commands/webhooks/update.js +41 -0
- package/lib/file.js +2 -3
- package/lib/global_telemetry.d.ts +53 -0
- package/lib/global_telemetry.js +82 -0
- package/lib/hooks/command_not_found/performance_analytics.d.ts +3 -0
- package/lib/hooks/command_not_found/performance_analytics.js +7 -0
- package/lib/hooks/init/terms-of-service.js +3 -4
- package/lib/hooks/init/version.d.ts +2 -1
- package/lib/hooks/init/version.js +1 -2
- package/lib/hooks/postrun/performance_analytics.d.ts +3 -0
- package/lib/hooks/postrun/performance_analytics.js +11 -0
- package/lib/hooks/prerun/analytics.d.ts +2 -1
- package/lib/hooks/prerun/analytics.js +4 -4
- package/lib/hooks/recache.d.ts +3 -0
- package/lib/hooks/recache.js +56 -0
- package/lib/hooks/update/brew.d.ts +2 -1
- package/lib/hooks/update/brew.js +3 -5
- package/lib/hooks/update/completions.d.ts +2 -1
- package/lib/hooks/update/completions.js +2 -3
- package/lib/hooks/update/plugin-migrate.d.ts +2 -1
- package/lib/hooks/update/plugin-migrate.js +3 -5
- package/lib/hooks/update/tidy.d.ts +2 -1
- package/lib/hooks/update/tidy.js +3 -5
- package/lib/lib/authorizations/authorizations.d.ts +2 -0
- package/lib/lib/authorizations/authorizations.js +39 -0
- package/lib/lib/autocomplete/base.d.ts +11 -0
- package/lib/lib/autocomplete/base.js +44 -0
- package/lib/lib/autocomplete/cache.d.ts +2 -0
- package/lib/lib/autocomplete/cache.js +28 -0
- package/lib/lib/autocomplete/completions.d.ts +37 -0
- package/lib/lib/autocomplete/completions.js +261 -0
- package/lib/lib/buildpacks/buildpacks.d.ts +32 -0
- package/lib/lib/buildpacks/buildpacks.js +161 -0
- package/lib/lib/buildpacks/push.d.ts +0 -0
- package/lib/lib/buildpacks/push.js +4 -0
- package/lib/lib/ci/git.d.ts +8 -0
- package/lib/lib/ci/git.js +71 -0
- package/lib/lib/ci/interfaces/kolkrabbi.d.ts +311 -0
- package/lib/lib/ci/interfaces/kolkrabbi.js +7 -0
- package/lib/lib/ci/pipelines.d.ts +3 -0
- package/lib/lib/ci/pipelines.js +57 -0
- package/lib/lib/ci/source.d.ts +2 -0
- package/lib/lib/ci/source.js +42 -0
- package/lib/lib/ci/test-run.d.ts +5 -0
- package/lib/lib/ci/test-run.js +232 -0
- package/lib/lib/clients/clients.d.ts +1 -0
- package/lib/lib/clients/clients.js +25 -0
- package/lib/lib/config/quote.d.ts +2 -0
- package/lib/lib/config/quote.js +33 -0
- package/lib/lib/config/util.d.ts +3 -0
- package/lib/lib/config/util.js +12 -0
- package/lib/lib/domains/wait-for-domain.d.ts +3 -0
- package/lib/lib/domains/wait-for-domain.js +19 -0
- package/lib/lib/git/git.d.ts +8 -0
- package/lib/lib/git/git.js +56 -0
- package/lib/lib/local/fork-foreman.d.ts +1 -0
- package/lib/lib/local/fork-foreman.js +33 -0
- package/lib/lib/local/load-foreman-procfile.d.ts +0 -0
- package/lib/lib/local/load-foreman-procfile.js +2 -0
- package/lib/lib/local/run-foreman.d.ts +0 -0
- package/lib/lib/local/run-foreman.js +2 -0
- package/lib/lib/pipelines/api.d.ts +25 -0
- package/lib/lib/pipelines/api.js +130 -0
- package/lib/lib/pipelines/disambiguate.d.ts +3 -0
- package/lib/lib/pipelines/disambiguate.js +49 -0
- package/lib/lib/pipelines/github-api.d.ts +8 -0
- package/lib/lib/pipelines/github-api.js +18 -0
- package/lib/lib/pipelines/infer.d.ts +1 -0
- package/lib/lib/pipelines/infer.js +11 -0
- package/lib/lib/pipelines/key-by.d.ts +1 -0
- package/lib/lib/pipelines/key-by.js +11 -0
- package/lib/lib/pipelines/kolkrabbi-api.d.ts +14 -0
- package/lib/lib/pipelines/kolkrabbi-api.js +62 -0
- package/lib/lib/pipelines/ownership.d.ts +4 -0
- package/lib/lib/pipelines/ownership.js +40 -0
- package/lib/lib/pipelines/render-pipeline.d.ts +6 -0
- package/lib/lib/pipelines/render-pipeline.js +52 -0
- package/lib/lib/pipelines/setup/create-apps.d.ts +1 -0
- package/lib/lib/pipelines/setup/create-apps.js +44 -0
- package/lib/lib/pipelines/setup/get-ci-settings.d.ts +4 -0
- package/lib/lib/pipelines/setup/get-ci-settings.js +19 -0
- package/lib/lib/pipelines/setup/get-github-token.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-github-token.js +10 -0
- package/lib/lib/pipelines/setup/get-name-and-repo.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-name-and-repo.js +47 -0
- package/lib/lib/pipelines/setup/get-repo.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-repo.js +8 -0
- package/lib/lib/pipelines/setup/get-settings.d.ts +9 -0
- package/lib/lib/pipelines/setup/get-settings.js +39 -0
- package/lib/lib/pipelines/setup/poll-app-setups.d.ts +1 -0
- package/lib/lib/pipelines/setup/poll-app-setups.js +25 -0
- package/lib/lib/pipelines/setup/setup-pipeline.d.ts +1 -0
- package/lib/lib/pipelines/setup/setup-pipeline.js +15 -0
- package/lib/lib/pipelines/setup/validate.d.ts +9 -0
- package/lib/lib/pipelines/setup/validate.js +31 -0
- package/lib/lib/pipelines/stages.d.ts +7 -0
- package/lib/lib/pipelines/stages.js +22 -0
- package/lib/lib/run/colorize.d.ts +2 -0
- package/lib/lib/run/colorize.js +300 -0
- package/lib/lib/run/dyno.d.ts +72 -0
- package/lib/lib/run/dyno.js +397 -0
- package/lib/lib/run/helpers.d.ts +2 -0
- package/lib/lib/run/helpers.js +34 -0
- package/lib/lib/run/line-transform.d.ts +4 -0
- package/lib/lib/run/line-transform.js +26 -0
- package/lib/lib/run/log-displayer.d.ts +10 -0
- package/lib/lib/run/log-displayer.js +79 -0
- package/lib/lib/sessions/sessions.d.ts +7 -0
- package/lib/lib/sessions/sessions.js +2 -0
- package/lib/lib/status/util.d.ts +1 -0
- package/lib/lib/status/util.js +14 -0
- package/lib/lib/webhooks/base.d.ts +13 -0
- package/lib/lib/webhooks/base.js +28 -0
- package/lib/user-config.js +2 -3
- package/oclif.manifest.json +3376 -2
- package/package.json +79 -42
- package/lib/hooks/update/b.d.ts +0 -2
- package/lib/hooks/update/b.js +0 -48
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parse = exports.quote = void 0;
|
|
4
|
+
const shell = require('shell-quote');
|
|
5
|
+
// slightly modifed form of shell-quote to default to using single-quotes over backslashes
|
|
6
|
+
function quote(s) {
|
|
7
|
+
// eslint-disable-next-line no-useless-escape
|
|
8
|
+
if (/["\s#!$&'()*,:;<=>?@\[\\\]^`{|}]/.test(s)) {
|
|
9
|
+
if (/['\n]/.test(s))
|
|
10
|
+
return '"' +
|
|
11
|
+
s
|
|
12
|
+
.replace(/(["\\$`!])/g, '\\$1')
|
|
13
|
+
.replace(/\n/g, '\\n') +
|
|
14
|
+
'"';
|
|
15
|
+
return "'" + s.replace(/(['\\])/g, '\\$1') + "'";
|
|
16
|
+
}
|
|
17
|
+
return s;
|
|
18
|
+
}
|
|
19
|
+
exports.quote = quote;
|
|
20
|
+
function parse(a) {
|
|
21
|
+
if (a.startsWith('"')) {
|
|
22
|
+
a = a.replace(/\\n/g, '\n');
|
|
23
|
+
}
|
|
24
|
+
else if (a.startsWith("'")) {
|
|
25
|
+
a = a.replace(/\\\\/g, '\\');
|
|
26
|
+
}
|
|
27
|
+
const parsed = shell.parse(a);
|
|
28
|
+
if (parsed.length > 1)
|
|
29
|
+
throw new Error(`Invalid token: ${a}`);
|
|
30
|
+
return parsed[0];
|
|
31
|
+
// return parsed[0].replace(/\\\\n/g, '\n')
|
|
32
|
+
}
|
|
33
|
+
exports.parse = parse;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Editor = void 0;
|
|
4
|
+
const edit = require('edit-string');
|
|
5
|
+
// This indirection exists to give tests
|
|
6
|
+
// a way to stub calls to `edit(...)`
|
|
7
|
+
class Editor {
|
|
8
|
+
edit(input, options = {}) {
|
|
9
|
+
return edit(input, options);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.Editor = Editor;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const spinner_1 = require("@oclif/core/lib/cli-ux/action/spinner");
|
|
6
|
+
async function waitForDomain(app, heroku, domain) {
|
|
7
|
+
const action = new spinner_1.default();
|
|
8
|
+
action.start(`Waiting for ${color_1.color.green(domain.hostname || 'domain')}`);
|
|
9
|
+
while (domain.status === 'pending') {
|
|
10
|
+
await core_1.ux.wait(5000);
|
|
11
|
+
const { body: updatedDomain } = await heroku.get(`/apps/${app}/domains/${domain.id}`);
|
|
12
|
+
domain = updatedDomain;
|
|
13
|
+
}
|
|
14
|
+
action.stop();
|
|
15
|
+
if (domain.status === 'succeeded' || domain.status === 'none')
|
|
16
|
+
return;
|
|
17
|
+
throw new Error(`The domain creation finished with status ${domain.status}`);
|
|
18
|
+
}
|
|
19
|
+
exports.default = waitForDomain;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default class Git {
|
|
2
|
+
exec(args: string[]): Promise<string>;
|
|
3
|
+
spawn(args: string[]): Promise<unknown>;
|
|
4
|
+
remoteFromGitConfig(): Promise<string | void>;
|
|
5
|
+
httpGitUrl(app: string): string;
|
|
6
|
+
remoteUrl(name: string): Promise<string>;
|
|
7
|
+
url(app: string): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const cp = require("child_process");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const util_1 = require("util");
|
|
7
|
+
const execFile = (0, util_1.promisify)(cp.execFile);
|
|
8
|
+
const debug = require('debug')('git');
|
|
9
|
+
class Git {
|
|
10
|
+
async exec(args) {
|
|
11
|
+
debug('exec: git %o', args);
|
|
12
|
+
try {
|
|
13
|
+
const { stdout, stderr } = await execFile('git', args);
|
|
14
|
+
if (stderr)
|
|
15
|
+
process.stderr.write(stderr);
|
|
16
|
+
return stdout.trim();
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error.code === 'ENOENT') {
|
|
20
|
+
core_1.ux.error('Git must be installed to use the Heroku CLI. See instructions here: https://git-scm.com');
|
|
21
|
+
}
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
spawn(args) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
debug('spawn: git %o', args);
|
|
28
|
+
const s = cp.spawn('git', args, { stdio: [0, 1, 2] });
|
|
29
|
+
s.on('error', (err) => {
|
|
30
|
+
if (err.code === 'ENOENT') {
|
|
31
|
+
core_1.ux.error('Git must be installed to use the Heroku CLI. See instructions here: https://git-scm.com');
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
reject(err);
|
|
35
|
+
});
|
|
36
|
+
s.on('close', resolve);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
remoteFromGitConfig() {
|
|
40
|
+
return this.exec(['config', 'heroku.remote']).catch(() => { });
|
|
41
|
+
}
|
|
42
|
+
httpGitUrl(app) {
|
|
43
|
+
return `https://${command_1.vars.httpGitHost}/${app}.git`;
|
|
44
|
+
}
|
|
45
|
+
async remoteUrl(name) {
|
|
46
|
+
const remotes = await this.exec(['remote', '-v']);
|
|
47
|
+
return remotes.split('\n')
|
|
48
|
+
.map(r => r.split('\t'))
|
|
49
|
+
.find(r => r[0] === name)[1]
|
|
50
|
+
.split(' ')[0];
|
|
51
|
+
}
|
|
52
|
+
url(app) {
|
|
53
|
+
return this.httpGitUrl(app);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = Git;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fork(argv: string[]): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fork = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
// depending if this is being ran before or after compilation
|
|
8
|
+
// we need to check for `.ts` and `.js` extensions and use
|
|
9
|
+
// the appropriate one.
|
|
10
|
+
function getForemanScriptPath() {
|
|
11
|
+
const file = 'run-foreman';
|
|
12
|
+
const withJsExtension = path.join(__dirname, file + '.js');
|
|
13
|
+
const withTsExtension = path.join(__dirname, file + '.ts');
|
|
14
|
+
if (fs.existsSync(withJsExtension)) {
|
|
15
|
+
return withJsExtension;
|
|
16
|
+
}
|
|
17
|
+
if (fs.existsSync(withTsExtension)) {
|
|
18
|
+
return withTsExtension;
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`Path to ${file} not found`);
|
|
21
|
+
}
|
|
22
|
+
function fork(argv) {
|
|
23
|
+
const script = getForemanScriptPath();
|
|
24
|
+
const nf = (0, child_process_1.fork)(script, argv, { stdio: 'inherit' });
|
|
25
|
+
return new Promise(resolve => {
|
|
26
|
+
nf.on('exit', function (code) {
|
|
27
|
+
if (code !== 0)
|
|
28
|
+
process.exit(code);
|
|
29
|
+
resolve();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.fork = fork;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { APIClient } from '@heroku-cli/command';
|
|
2
|
+
import * as Heroku from '@heroku-cli/schema';
|
|
3
|
+
export declare const V3_HEADER = "application/vnd.heroku+json; version=3";
|
|
4
|
+
export declare const FILTERS_HEADER: string;
|
|
5
|
+
export declare const PIPELINES_HEADER: string;
|
|
6
|
+
export declare function createAppSetup(heroku: APIClient, body: {
|
|
7
|
+
body: any;
|
|
8
|
+
}): Promise<import("http-call").HTTP<unknown>>;
|
|
9
|
+
export declare function postCoupling(heroku: APIClient, pipeline: any, app: any, stage: string): Promise<import("http-call").HTTP<unknown>>;
|
|
10
|
+
export declare function createCoupling(heroku: APIClient, pipeline: any, app: string, stage: string): Promise<import("http-call").HTTP<unknown>>;
|
|
11
|
+
export declare function createPipeline(heroku: APIClient, name: any, owner: any): Promise<import("http-call").HTTP<unknown>>;
|
|
12
|
+
export declare function createPipelineTransfer(heroku: APIClient, pipeline: Heroku.Pipeline): Promise<import("http-call").HTTP<unknown>>;
|
|
13
|
+
export declare function destroyPipeline(heroku: APIClient, name: any, pipelineId: any): Promise<import("http-call").HTTP<unknown>>;
|
|
14
|
+
export declare function findPipelineByName(heroku: APIClient, idOrName: string): Promise<import("http-call").HTTP<Heroku.Pipeline[]>>;
|
|
15
|
+
export declare function getCoupling(heroku: APIClient, app: string): Promise<import("http-call").HTTP<Heroku.PipelineCoupling>>;
|
|
16
|
+
export declare function getPipeline(heroku: APIClient, id: string): Promise<import("http-call").HTTP<Heroku.Pipeline>>;
|
|
17
|
+
export declare function updatePipeline(heroku: APIClient, id: string, body: Heroku.Pipeline): Promise<import("http-call").HTTP<Heroku.Pipeline>>;
|
|
18
|
+
export declare function getTeam(heroku: APIClient, teamId: any): Promise<import("http-call").HTTP<Heroku.Team>>;
|
|
19
|
+
export declare function getAccountInfo(heroku: APIClient, id?: string): Promise<import("http-call").HTTP<Heroku.Account>>;
|
|
20
|
+
export declare function getAppSetup(heroku: APIClient, buildId: any): Promise<import("http-call").HTTP<unknown>>;
|
|
21
|
+
export declare function listPipelineApps(heroku: APIClient, pipelineId: string): Promise<Array<Heroku.App>>;
|
|
22
|
+
export declare function patchCoupling(heroku: APIClient, id: string, stage: string): Promise<import("http-call").HTTP<unknown>>;
|
|
23
|
+
export declare function removeCoupling(heroku: APIClient, app: string): Promise<import("http-call").HTTP<unknown>>;
|
|
24
|
+
export declare function updateCoupling(heroku: APIClient, app: string, stage: string): Promise<import("http-call").HTTP<unknown>>;
|
|
25
|
+
export declare function getReleases(heroku: APIClient, appId: string): Promise<import("http-call").HTTP<Heroku.Release[]>>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReleases = exports.updateCoupling = exports.removeCoupling = exports.patchCoupling = exports.listPipelineApps = exports.getAppSetup = exports.getAccountInfo = exports.getTeam = exports.updatePipeline = exports.getPipeline = exports.getCoupling = exports.findPipelineByName = exports.destroyPipeline = exports.createPipelineTransfer = exports.createPipeline = exports.createCoupling = exports.postCoupling = exports.createAppSetup = exports.PIPELINES_HEADER = exports.FILTERS_HEADER = exports.V3_HEADER = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
exports.V3_HEADER = 'application/vnd.heroku+json; version=3';
|
|
6
|
+
exports.FILTERS_HEADER = `${exports.V3_HEADER}.filters`;
|
|
7
|
+
exports.PIPELINES_HEADER = `${exports.V3_HEADER}.pipelines`;
|
|
8
|
+
function createAppSetup(heroku, body) {
|
|
9
|
+
return heroku.post('/app-setups', { body });
|
|
10
|
+
}
|
|
11
|
+
exports.createAppSetup = createAppSetup;
|
|
12
|
+
function postCoupling(heroku, pipeline, app, stage) {
|
|
13
|
+
return heroku.post('/pipeline-couplings', {
|
|
14
|
+
body: { app, pipeline, stage },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.postCoupling = postCoupling;
|
|
18
|
+
function createCoupling(heroku, pipeline, app, stage) {
|
|
19
|
+
return postCoupling(heroku, pipeline.id, app, stage);
|
|
20
|
+
}
|
|
21
|
+
exports.createCoupling = createCoupling;
|
|
22
|
+
function createPipeline(heroku, name, owner) {
|
|
23
|
+
return heroku.request('/pipelines', {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: { Accept: exports.PIPELINES_HEADER },
|
|
26
|
+
body: { name, owner },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.createPipeline = createPipeline;
|
|
30
|
+
function createPipelineTransfer(heroku, pipeline) {
|
|
31
|
+
return heroku.post('/pipeline-transfers', {
|
|
32
|
+
body: pipeline,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.createPipelineTransfer = createPipelineTransfer;
|
|
36
|
+
function deleteCoupling(heroku, id) {
|
|
37
|
+
return heroku.delete(`/pipeline-couplings/${id}`);
|
|
38
|
+
}
|
|
39
|
+
function destroyPipeline(heroku, name, pipelineId) {
|
|
40
|
+
return heroku.request(`/pipelines/${pipelineId}`, {
|
|
41
|
+
method: 'DELETE',
|
|
42
|
+
headers: { Accept: exports.PIPELINES_HEADER },
|
|
43
|
+
body: { name },
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.destroyPipeline = destroyPipeline;
|
|
47
|
+
function findPipelineByName(heroku, idOrName) {
|
|
48
|
+
return heroku.request(`/pipelines?eq[name]=${idOrName}`, {
|
|
49
|
+
method: 'GET',
|
|
50
|
+
headers: { Accept: exports.PIPELINES_HEADER },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.findPipelineByName = findPipelineByName;
|
|
54
|
+
function getCoupling(heroku, app) {
|
|
55
|
+
return heroku.get(`/apps/${app}/pipeline-couplings`);
|
|
56
|
+
}
|
|
57
|
+
exports.getCoupling = getCoupling;
|
|
58
|
+
function getPipeline(heroku, id) {
|
|
59
|
+
return heroku.request(`/pipelines/${id}`, {
|
|
60
|
+
method: 'GET',
|
|
61
|
+
headers: { Accept: exports.PIPELINES_HEADER },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
exports.getPipeline = getPipeline;
|
|
65
|
+
function updatePipeline(heroku, id, body) {
|
|
66
|
+
return heroku.patch(`/pipelines/${id}`, {
|
|
67
|
+
body,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
exports.updatePipeline = updatePipeline;
|
|
71
|
+
// function getApp(heroku: APIClient, app) {
|
|
72
|
+
// return heroku.get(`/apps/${app}`)
|
|
73
|
+
// }
|
|
74
|
+
function getTeam(heroku, teamId) {
|
|
75
|
+
return heroku.get(`/teams/${teamId}`);
|
|
76
|
+
}
|
|
77
|
+
exports.getTeam = getTeam;
|
|
78
|
+
function getAppFilter(heroku, appIds) {
|
|
79
|
+
return heroku.request('/filters/apps', {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
headers: { Accept: exports.FILTERS_HEADER, Range: 'id ..; max=1000;' },
|
|
82
|
+
body: { in: { id: appIds } },
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function getAccountInfo(heroku, id = '~') {
|
|
86
|
+
return heroku.get(`/users/${id}`);
|
|
87
|
+
}
|
|
88
|
+
exports.getAccountInfo = getAccountInfo;
|
|
89
|
+
function getAppSetup(heroku, buildId) {
|
|
90
|
+
return heroku.get(`/app-setups/${buildId}`);
|
|
91
|
+
}
|
|
92
|
+
exports.getAppSetup = getAppSetup;
|
|
93
|
+
function listCouplings(heroku, pipelineId) {
|
|
94
|
+
return heroku.get(`/pipelines/${pipelineId}/pipeline-couplings`);
|
|
95
|
+
}
|
|
96
|
+
function listPipelineApps(heroku, pipelineId) {
|
|
97
|
+
return listCouplings(heroku, pipelineId).then(({ body: couplings }) => {
|
|
98
|
+
const appIds = couplings.map(coupling => (coupling.app && coupling.app.id) || '');
|
|
99
|
+
return getAppFilter(heroku, appIds).then(({ body: apps }) => {
|
|
100
|
+
const couplingsByAppId = (0, lodash_1.keyBy)(couplings, coupling => coupling.app && coupling.app.id);
|
|
101
|
+
return apps.map(app => {
|
|
102
|
+
return Object.assign(Object.assign({}, app), { coupling: couplingsByAppId[app.id] });
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
exports.listPipelineApps = listPipelineApps;
|
|
108
|
+
function patchCoupling(heroku, id, stage) {
|
|
109
|
+
return heroku.patch(`/pipeline-couplings/${id}`, { body: { stage } });
|
|
110
|
+
}
|
|
111
|
+
exports.patchCoupling = patchCoupling;
|
|
112
|
+
function removeCoupling(heroku, app) {
|
|
113
|
+
return getCoupling(heroku, app)
|
|
114
|
+
.then(({ body }) => {
|
|
115
|
+
return deleteCoupling(heroku, body.id);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
exports.removeCoupling = removeCoupling;
|
|
119
|
+
function updateCoupling(heroku, app, stage) {
|
|
120
|
+
return getCoupling(heroku, app)
|
|
121
|
+
.then(({ body: coupling }) => patchCoupling(heroku, coupling.id, stage));
|
|
122
|
+
}
|
|
123
|
+
exports.updateCoupling = updateCoupling;
|
|
124
|
+
function getReleases(heroku, appId) {
|
|
125
|
+
return heroku.get(`/apps/${appId}/releases`, {
|
|
126
|
+
headers: { Accept: exports.V3_HEADER, Range: 'version ..; order=desc' },
|
|
127
|
+
partial: true,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
exports.getReleases = getReleases;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const inquirer_1 = require("inquirer");
|
|
4
|
+
const validator_1 = require("validator");
|
|
5
|
+
const api_1 = require("./api");
|
|
6
|
+
async function disambiguate(heroku, pipelineIDOrName) {
|
|
7
|
+
let pipeline;
|
|
8
|
+
if ((0, validator_1.isUUID)(pipelineIDOrName)) {
|
|
9
|
+
const result = (await (0, api_1.getPipeline)(heroku, pipelineIDOrName));
|
|
10
|
+
pipeline = result.body;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const { body: pipelines } = await (0, api_1.findPipelineByName)(heroku, pipelineIDOrName);
|
|
14
|
+
if (pipelines.length === 0) {
|
|
15
|
+
throw new Error('Pipeline not found');
|
|
16
|
+
}
|
|
17
|
+
else if (pipelines.length === 1) {
|
|
18
|
+
pipeline = pipelines[0];
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
// Disambiguate
|
|
22
|
+
const choices = pipelines.map(x => {
|
|
23
|
+
return {
|
|
24
|
+
name: new Date(x.created_at).toString(),
|
|
25
|
+
value: x,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
const questions = [{
|
|
29
|
+
type: 'list',
|
|
30
|
+
name: 'pipeline',
|
|
31
|
+
message: `Which ${pipelineIDOrName} pipeline?`,
|
|
32
|
+
choices,
|
|
33
|
+
}];
|
|
34
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
35
|
+
pipeline = await new Promise(async function (resolve, reject) {
|
|
36
|
+
const answers = await (0, inquirer_1.prompt)(questions);
|
|
37
|
+
if (answers.pipeline) {
|
|
38
|
+
resolve(answers.pipeline);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
42
|
+
reject('Must pick a pipeline');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return pipeline;
|
|
48
|
+
}
|
|
49
|
+
exports.default = disambiguate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const http_call_1 = require("http-call");
|
|
4
|
+
const GITHUB_API = 'https://api.github.com';
|
|
5
|
+
class GitHubAPI {
|
|
6
|
+
constructor(version, token) {
|
|
7
|
+
this.version = version;
|
|
8
|
+
this.token = token;
|
|
9
|
+
}
|
|
10
|
+
request(url, options = {}) {
|
|
11
|
+
options.headers = Object.assign({ Authorization: `Token ${this.token}`, 'User-Agent': this.version }, options.headers);
|
|
12
|
+
return http_call_1.default.get(`${GITHUB_API}${url}`, options);
|
|
13
|
+
}
|
|
14
|
+
getRepo(name) {
|
|
15
|
+
return this.request(`/repos/${name}`).then((res) => res.body);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = GitHubAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function infer(app: string): string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const stages_1 = require("./stages");
|
|
4
|
+
function infer(app) {
|
|
5
|
+
const inferredStage = stages_1.inferrableStages.find(stage => stage.inferRegex.test(app));
|
|
6
|
+
if (inferredStage) {
|
|
7
|
+
return [app.replace(inferredStage.inferRegex, ''), inferredStage.name];
|
|
8
|
+
}
|
|
9
|
+
return [app, 'production'];
|
|
10
|
+
}
|
|
11
|
+
exports.default = infer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function keyBy(list: any, propertyOrCb: any): any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function keyBy(list, propertyOrCb) {
|
|
4
|
+
const isCallback = typeof propertyOrCb === 'function';
|
|
5
|
+
return list.reduce((memo, item) => {
|
|
6
|
+
const key = isCallback ? propertyOrCb(item) : item[propertyOrCb];
|
|
7
|
+
memo[key] = item;
|
|
8
|
+
return memo;
|
|
9
|
+
}, {});
|
|
10
|
+
}
|
|
11
|
+
exports.default = keyBy;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default class {
|
|
2
|
+
version: any;
|
|
3
|
+
getToken: () => any;
|
|
4
|
+
constructor(version: any, getToken: () => any);
|
|
5
|
+
request(url: string, options?: any): Promise<any>;
|
|
6
|
+
getAccount(): Promise<any>;
|
|
7
|
+
createPipelineRepository(pipeline: any, repository: any): Promise<any>;
|
|
8
|
+
updatePipelineRepository(pipeline: any, body: any): Promise<any>;
|
|
9
|
+
updateAppLink(app: any, body: any): Promise<any>;
|
|
10
|
+
getAppLink(app: any): Promise<any>;
|
|
11
|
+
getPipelineRepository(pipeline: any): Promise<any>;
|
|
12
|
+
getPipelineGithub(pipeline: any): Promise<any>;
|
|
13
|
+
getArchiveURL(repo: any, ref: any): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const http_call_1 = require("http-call");
|
|
4
|
+
const KOLKRABBI_BASE_URL = 'https://kolkrabbi.heroku.com';
|
|
5
|
+
class default_1 {
|
|
6
|
+
constructor(version, getToken) {
|
|
7
|
+
this.version = version;
|
|
8
|
+
this.getToken = getToken;
|
|
9
|
+
}
|
|
10
|
+
request(url, options = {}) {
|
|
11
|
+
options.headers = {
|
|
12
|
+
Authorization: `Bearer ${this.getToken()}`,
|
|
13
|
+
'User-Agent': this.version,
|
|
14
|
+
};
|
|
15
|
+
if (['POST', 'PATCH', 'DELETE'].includes(options.method)) {
|
|
16
|
+
options.headers['Content-type'] = 'application/json';
|
|
17
|
+
}
|
|
18
|
+
return http_call_1.HTTP.request(KOLKRABBI_BASE_URL + url, options).then((res) => res.body);
|
|
19
|
+
}
|
|
20
|
+
getAccount() {
|
|
21
|
+
return this.request('/account/github/token');
|
|
22
|
+
}
|
|
23
|
+
createPipelineRepository(pipeline, repository) {
|
|
24
|
+
return this.request(`/pipelines/${pipeline}/repository`, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
body: { repository },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
updatePipelineRepository(pipeline, body) {
|
|
30
|
+
return this.request(`/pipelines/${pipeline}/repository`, {
|
|
31
|
+
method: 'PATCH',
|
|
32
|
+
body,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
updateAppLink(app, body) {
|
|
36
|
+
return this.request(`/apps/${app}/github`, {
|
|
37
|
+
method: 'PATCH',
|
|
38
|
+
body,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
getAppLink(app) {
|
|
42
|
+
return this.request(`/apps/${app}/github`, {
|
|
43
|
+
method: 'GET',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
getPipelineRepository(pipeline) {
|
|
47
|
+
return this.request(`/pipelines/${pipeline}/repository`, {
|
|
48
|
+
method: 'GET',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
getPipelineGithub(pipeline) {
|
|
52
|
+
return this.request(`/pipelines/${pipeline}/github`, {
|
|
53
|
+
method: 'GET',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
getArchiveURL(repo, ref) {
|
|
57
|
+
return this.request(`/github/repos/${repo}/tarball/${ref}`, {
|
|
58
|
+
followRedirect: false,
|
|
59
|
+
}).then(res => res.archive_link);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.default = default_1;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { APIClient } from '@heroku-cli/command';
|
|
2
|
+
import * as Heroku from '@heroku-cli/schema';
|
|
3
|
+
export declare function warnMixedOwnership(pipelineApps: Array<Heroku.App>, pipeline: Heroku.Pipeline, owner: string): void;
|
|
4
|
+
export declare function getOwner(heroku: APIClient, apps: Array<Heroku.App>, pipeline: Heroku.Pipeline): Promise<any>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOwner = exports.warnMixedOwnership = void 0;
|
|
4
|
+
const color_1 = require("@heroku-cli/color");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const api_1 = require("./api");
|
|
7
|
+
function warnMixedOwnership(pipelineApps, pipeline, owner) {
|
|
8
|
+
const hasMixedOwnership = pipelineApps.some(app => {
|
|
9
|
+
return (app.owner && app.owner.id) !== pipeline.owner.id;
|
|
10
|
+
});
|
|
11
|
+
if (hasMixedOwnership) {
|
|
12
|
+
core_1.ux.log();
|
|
13
|
+
let message = `Some apps in this pipeline do not belong to ${color_1.default.cmd(owner)}.`;
|
|
14
|
+
message += '\n\nAll apps in a pipeline must have the same owner as the pipeline owner.';
|
|
15
|
+
message += '\nTransfer these apps or change the pipeline owner in pipeline settings.';
|
|
16
|
+
message += `\nSee ${color_1.default.cyan('https://devcenter.heroku.com/articles/pipeline-ownership-transition')} for more info.`;
|
|
17
|
+
core_1.ux.warn(message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.warnMixedOwnership = warnMixedOwnership;
|
|
21
|
+
function getOwner(heroku, apps, pipeline) {
|
|
22
|
+
let owner;
|
|
23
|
+
let ownerPromise;
|
|
24
|
+
if (pipeline.owner.type === 'team') {
|
|
25
|
+
ownerPromise = (0, api_1.getTeam)(heroku, pipeline.owner.id).then(response => response.body);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const app = apps.find(app => {
|
|
29
|
+
return app.owner ? app.owner.id === pipeline.owner.id : false;
|
|
30
|
+
});
|
|
31
|
+
// If pipeline owner doesn't own any application and type is user (unlikely)
|
|
32
|
+
// We return the uuid as default
|
|
33
|
+
owner = app ? app.owner && app.owner.email : pipeline.owner.id;
|
|
34
|
+
ownerPromise = Promise.resolve(owner);
|
|
35
|
+
}
|
|
36
|
+
return ownerPromise.then(owner => {
|
|
37
|
+
return owner.name ? `${owner.name} (team)` : owner;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.getOwner = getOwner;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { APIClient } from '@heroku-cli/command';
|
|
2
|
+
import * as Heroku from '@heroku-cli/schema';
|
|
3
|
+
export default function renderPipeline(heroku: APIClient, pipeline: Heroku.Pipeline, pipelineApps: Array<Heroku.App>, { withOwners, showOwnerWarning }?: {
|
|
4
|
+
withOwners: boolean;
|
|
5
|
+
showOwnerWarning: boolean;
|
|
6
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const ownership_1 = require("./ownership");
|
|
7
|
+
async function renderPipeline(heroku, pipeline, pipelineApps,
|
|
8
|
+
// eslint-disable-next-line unicorn/no-object-as-default-parameter
|
|
9
|
+
{ withOwners, showOwnerWarning } = { withOwners: false, showOwnerWarning: false }) {
|
|
10
|
+
core_1.ux.styledHeader(pipeline.name);
|
|
11
|
+
let owner;
|
|
12
|
+
if (pipeline.owner) {
|
|
13
|
+
owner = await (0, ownership_1.getOwner)(heroku, pipelineApps, pipeline);
|
|
14
|
+
core_1.ux.log(`owner: ${owner}`);
|
|
15
|
+
}
|
|
16
|
+
core_1.ux.log('');
|
|
17
|
+
const columns = {
|
|
18
|
+
name: {
|
|
19
|
+
header: 'app name',
|
|
20
|
+
get(row) {
|
|
21
|
+
return color_1.default.app(row.name || '');
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
'coupling.stage': {
|
|
25
|
+
header: 'stage',
|
|
26
|
+
get(row) {
|
|
27
|
+
return row.coupling.stage;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
if (withOwners) {
|
|
32
|
+
columns['owner.email'] = {
|
|
33
|
+
header: 'owner',
|
|
34
|
+
get(row) {
|
|
35
|
+
const email = row.owner && row.owner.email;
|
|
36
|
+
if (email) {
|
|
37
|
+
return email.endsWith('@herokumanager.com') ? `${row.split('@')[0]} (team)` : email;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const developmentApps = (0, lodash_1.sortBy)(pipelineApps.filter(app => app.coupling.stage === 'development'), ['name']);
|
|
43
|
+
const reviewApps = (0, lodash_1.sortBy)(pipelineApps.filter(app => app.coupling.stage === 'review'), ['name']);
|
|
44
|
+
const stagingApps = (0, lodash_1.sortBy)(pipelineApps.filter(app => app.coupling.stage === 'staging'), ['name']);
|
|
45
|
+
const productionApps = (0, lodash_1.sortBy)(pipelineApps.filter(app => app.coupling.stage === 'production'), ['name']);
|
|
46
|
+
const apps = developmentApps.concat(reviewApps).concat(stagingApps).concat(productionApps);
|
|
47
|
+
core_1.ux.table(apps, columns);
|
|
48
|
+
if (showOwnerWarning && pipeline.owner) {
|
|
49
|
+
(0, ownership_1.warnMixedOwnership)(pipelineApps, pipeline, owner);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = renderPipeline;
|