heroku 8.1.9 → 8.2.0-beta.1
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/README.md +5 -6
- 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 +80 -43
- package/lib/hooks/update/b.d.ts +0 -2
- package/lib/hooks/update/b.js +0 -48
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createApps(heroku: any, archiveURL: any, pipeline: any, pipelineName: any, stagingAppName: any, organization: any): Promise<void | import("http-call").HTTP<unknown>[]>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const api_1 = require("../api");
|
|
5
|
+
function createApp(heroku, { archiveURL, name, organization, pipeline, stage }) {
|
|
6
|
+
const params = {
|
|
7
|
+
source_blob: { url: archiveURL },
|
|
8
|
+
app: { name },
|
|
9
|
+
pipeline_coupling: {
|
|
10
|
+
stage,
|
|
11
|
+
pipeline: pipeline.id,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
if (organization) {
|
|
15
|
+
params.app.organization = organization;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
params.app.personal = true;
|
|
19
|
+
}
|
|
20
|
+
return (0, api_1.createAppSetup)(heroku, params).then(setup => setup);
|
|
21
|
+
}
|
|
22
|
+
function createApps(heroku, archiveURL, pipeline, pipelineName, stagingAppName, organization) {
|
|
23
|
+
const prodAppSetupPromise = createApp(heroku, {
|
|
24
|
+
archiveURL,
|
|
25
|
+
pipeline,
|
|
26
|
+
name: pipelineName,
|
|
27
|
+
stage: 'production',
|
|
28
|
+
organization,
|
|
29
|
+
});
|
|
30
|
+
const stagingAppSetupPromise = createApp(heroku, {
|
|
31
|
+
archiveURL,
|
|
32
|
+
pipeline,
|
|
33
|
+
name: stagingAppName,
|
|
34
|
+
stage: 'staging',
|
|
35
|
+
organization,
|
|
36
|
+
});
|
|
37
|
+
const promises = [prodAppSetupPromise, stagingAppSetupPromise];
|
|
38
|
+
return Promise.all(promises).then(appSetups => {
|
|
39
|
+
return appSetups;
|
|
40
|
+
}, error => {
|
|
41
|
+
core_1.ux.error(error, { exit: 1 });
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
exports.default = createApps;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
async function getCISettings(yes, organization) {
|
|
5
|
+
const settings = {
|
|
6
|
+
ci: true,
|
|
7
|
+
organization: undefined,
|
|
8
|
+
};
|
|
9
|
+
if (yes) {
|
|
10
|
+
delete settings.organization;
|
|
11
|
+
return settings;
|
|
12
|
+
}
|
|
13
|
+
settings.ci = await core_1.ux.confirm('Enable automatic Heroku CI test runs?');
|
|
14
|
+
if (settings.ci && organization) {
|
|
15
|
+
settings.organization = organization;
|
|
16
|
+
}
|
|
17
|
+
return settings;
|
|
18
|
+
}
|
|
19
|
+
exports.default = getCISettings;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getGitHubToken(kolkrabbi: any): any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function getGitHubToken(kolkrabbi) {
|
|
4
|
+
return kolkrabbi.getAccount().then((account) => {
|
|
5
|
+
return account.github.token;
|
|
6
|
+
}, () => {
|
|
7
|
+
throw new Error('Account not connected to GitHub.');
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
exports.default = getGitHubToken;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getNameAndRepo(args: any): Promise<any>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const validate_1 = require("./validate");
|
|
5
|
+
function filter(obj) {
|
|
6
|
+
const ret = {};
|
|
7
|
+
Object.keys(obj)
|
|
8
|
+
.filter((key) => obj[key] !== undefined)
|
|
9
|
+
.forEach((key) => {
|
|
10
|
+
ret[key] = obj[key];
|
|
11
|
+
});
|
|
12
|
+
return ret;
|
|
13
|
+
}
|
|
14
|
+
async function getNameAndRepo(args) {
|
|
15
|
+
const answer = {
|
|
16
|
+
name: '',
|
|
17
|
+
repo: '',
|
|
18
|
+
};
|
|
19
|
+
if (!args.name) {
|
|
20
|
+
const name = await core_1.ux.prompt('Pipeline name', {
|
|
21
|
+
required: true,
|
|
22
|
+
});
|
|
23
|
+
const [valid, msg] = (0, validate_1.pipelineName)(name);
|
|
24
|
+
if (valid) {
|
|
25
|
+
answer.name = name;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
core_1.ux.error(msg);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!args.repo) {
|
|
32
|
+
const repo = await core_1.ux.prompt('GitHub repository to connect to (e.g. rails/rails)', {
|
|
33
|
+
required: true,
|
|
34
|
+
});
|
|
35
|
+
const [valid, msg] = (0, validate_1.repoName)(repo);
|
|
36
|
+
if (valid) {
|
|
37
|
+
answer.repo = repo;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
core_1.ux.error(msg);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const reply = Object.assign(filter(answer), filter(args));
|
|
44
|
+
reply.name = reply.name.toLowerCase().replace(/\s/g, '-');
|
|
45
|
+
return reply;
|
|
46
|
+
}
|
|
47
|
+
exports.default = getNameAndRepo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getRepo(github: any, name: any): any;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const DEFAULT_SETTINGS = {
|
|
5
|
+
auto_deploy: true,
|
|
6
|
+
wait_for_ci: true,
|
|
7
|
+
pull_requests: {
|
|
8
|
+
enabled: true,
|
|
9
|
+
auto_deploy: true,
|
|
10
|
+
auto_destroy: true,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
async function getSettings(yes, branch) {
|
|
14
|
+
if (yes) {
|
|
15
|
+
return DEFAULT_SETTINGS;
|
|
16
|
+
}
|
|
17
|
+
const settings = {
|
|
18
|
+
auto_deploy: true,
|
|
19
|
+
wait_for_ci: true,
|
|
20
|
+
pull_requests: {
|
|
21
|
+
enabled: true,
|
|
22
|
+
auto_deploy: true,
|
|
23
|
+
auto_destroy: true,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
settings.auto_deploy = await core_1.ux.confirm(`Automatically deploy the ${branch} branch to staging?`);
|
|
27
|
+
if (settings.auto_deploy) {
|
|
28
|
+
settings.wait_for_ci = await core_1.ux.confirm(`Wait for CI to pass before deploying the ${branch} branch to staging?`);
|
|
29
|
+
}
|
|
30
|
+
settings.pull_requests.enabled = await core_1.ux.confirm('Enable review apps?');
|
|
31
|
+
if (settings.pull_requests.enabled) {
|
|
32
|
+
settings.pull_requests.auto_deploy = await core_1.ux.confirm('Automatically create review apps for every PR?');
|
|
33
|
+
}
|
|
34
|
+
if (settings.pull_requests.enabled) {
|
|
35
|
+
settings.pull_requests.auto_destroy = await core_1.ux.confirm('Automatically destroy idle review apps after 5 days?');
|
|
36
|
+
}
|
|
37
|
+
return settings;
|
|
38
|
+
}
|
|
39
|
+
exports.default = getSettings;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function pollAppSetups(heroku: any, appSetups: any): Promise<any[]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const api = require("../api");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const color_1 = require("@heroku-cli/color");
|
|
6
|
+
function wait(ms) {
|
|
7
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
8
|
+
}
|
|
9
|
+
function pollAppSetup(heroku, appSetup) {
|
|
10
|
+
return api.getAppSetup(heroku, appSetup.id).then(({ body: setup }) => {
|
|
11
|
+
if (setup.status === 'succeeded') {
|
|
12
|
+
return setup;
|
|
13
|
+
}
|
|
14
|
+
if (setup.status === 'failed') {
|
|
15
|
+
throw new Error(`Couldn't create application ${color_1.default.app(setup.app.name)}: ${setup.failure_message}`);
|
|
16
|
+
}
|
|
17
|
+
return wait(1000).then(() => pollAppSetup(heroku, appSetup));
|
|
18
|
+
}).catch((error) => {
|
|
19
|
+
return core_1.ux.error(error, { exit: 1 });
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function pollAppSetups(heroku, appSetups) {
|
|
23
|
+
return Promise.all(appSetups.map((appSetup) => pollAppSetup(heroku, appSetup)));
|
|
24
|
+
}
|
|
25
|
+
exports.default = pollAppSetups;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function setupPipeline(kolkrabbi: any, app: any, settings: any, pipelineID: any, ciSettings?: any): Promise<any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
function setupPipeline(kolkrabbi, app, settings, pipelineID, ciSettings = {}) {
|
|
5
|
+
const promises = [kolkrabbi.updateAppLink(app, settings)];
|
|
6
|
+
if (ciSettings.ci) {
|
|
7
|
+
promises.push(kolkrabbi.updatePipelineRepository(pipelineID, ciSettings));
|
|
8
|
+
}
|
|
9
|
+
return Promise.all(promises).then(([appLink]) => {
|
|
10
|
+
return appLink;
|
|
11
|
+
}, error => {
|
|
12
|
+
core_1.ux.error(error.body.message || error.message);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
exports.default = setupPipeline;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const STAGING_APP_INDICATOR = "-staging";
|
|
2
|
+
declare type ValidatedResponse = [true] | [false, string];
|
|
3
|
+
export declare function pipelineName(name: any): ValidatedResponse;
|
|
4
|
+
export declare function repoName(repo: any): ValidatedResponse;
|
|
5
|
+
export declare function nameAndRepo({ name, repo }: {
|
|
6
|
+
name?: string;
|
|
7
|
+
repo?: string;
|
|
8
|
+
}): string[];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nameAndRepo = exports.repoName = exports.pipelineName = exports.STAGING_APP_INDICATOR = void 0;
|
|
4
|
+
exports.STAGING_APP_INDICATOR = '-staging';
|
|
5
|
+
const PIPELINE_MIN_LENGTH = 2;
|
|
6
|
+
const PIPELINE_MAX_LENGTH = 30 - exports.STAGING_APP_INDICATOR.length;
|
|
7
|
+
const ERR_PIPELINE_NAME_LENGTH = `Please choose a pipeline name between 2 and ${PIPELINE_MAX_LENGTH} characters long`;
|
|
8
|
+
const ERR_REPO_FORMAT = 'Repository name must be in the format organization/repo';
|
|
9
|
+
const REPO_REGEX = /.+\/.+/;
|
|
10
|
+
function pipelineName(name) {
|
|
11
|
+
const isValid = name.length >= PIPELINE_MIN_LENGTH &&
|
|
12
|
+
name.length <= PIPELINE_MAX_LENGTH;
|
|
13
|
+
return isValid ? [isValid] : [isValid, ERR_PIPELINE_NAME_LENGTH];
|
|
14
|
+
}
|
|
15
|
+
exports.pipelineName = pipelineName;
|
|
16
|
+
function repoName(repo) {
|
|
17
|
+
const isValid = Boolean(repo.match(REPO_REGEX));
|
|
18
|
+
return isValid ? [isValid] : [isValid, ERR_REPO_FORMAT];
|
|
19
|
+
}
|
|
20
|
+
exports.repoName = repoName;
|
|
21
|
+
function nameAndRepo({ name, repo }) {
|
|
22
|
+
const errors = [];
|
|
23
|
+
const [nameIsValid, nameMsg] = pipelineName(name || '');
|
|
24
|
+
const [repoIsValid, repoMsg] = repoName(repo || '');
|
|
25
|
+
if (name && !nameIsValid)
|
|
26
|
+
errors.push(nameMsg);
|
|
27
|
+
if (repo && !repoIsValid)
|
|
28
|
+
errors.push(repoMsg);
|
|
29
|
+
return errors;
|
|
30
|
+
}
|
|
31
|
+
exports.nameAndRepo = nameAndRepo;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const INFERRABLE_STAGES: {
|
|
2
|
+
name: string;
|
|
3
|
+
inferRegex: RegExp;
|
|
4
|
+
}[];
|
|
5
|
+
declare const INFERRABLE_STAGE_NAMES: string[];
|
|
6
|
+
declare const STAGE_NAMES: string[];
|
|
7
|
+
export { INFERRABLE_STAGES as inferrableStages, INFERRABLE_STAGE_NAMES as inferrableStageNames, STAGE_NAMES as names, };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.names = exports.inferrableStageNames = exports.inferrableStages = void 0;
|
|
4
|
+
const INFERRABLE_STAGES = [
|
|
5
|
+
{
|
|
6
|
+
name: 'development',
|
|
7
|
+
inferRegex: /-(dev|development|uat|tst|test|qa)$/,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'staging',
|
|
11
|
+
inferRegex: /-(stg|staging)$/,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'production',
|
|
15
|
+
inferRegex: /-(prd|prod|production|admin|demo)$/,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
exports.inferrableStages = INFERRABLE_STAGES;
|
|
19
|
+
const INFERRABLE_STAGE_NAMES = INFERRABLE_STAGES.map(stage => stage.name);
|
|
20
|
+
exports.inferrableStageNames = INFERRABLE_STAGE_NAMES;
|
|
21
|
+
const STAGE_NAMES = ['review'].concat(INFERRABLE_STAGE_NAMES);
|
|
22
|
+
exports.names = STAGE_NAMES;
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COLORS = void 0;
|
|
4
|
+
const color_1 = require("@heroku-cli/color");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
exports.COLORS = [
|
|
7
|
+
s => color_1.default.yellow(s),
|
|
8
|
+
s => color_1.default.green(s),
|
|
9
|
+
s => color_1.default.cyan(s),
|
|
10
|
+
s => color_1.default.magenta(s),
|
|
11
|
+
s => color_1.default.blue(s),
|
|
12
|
+
s => color_1.default.bold.green(s),
|
|
13
|
+
s => color_1.default.bold.cyan(s),
|
|
14
|
+
s => color_1.default.bold.magenta(s),
|
|
15
|
+
s => color_1.default.bold.yellow(s),
|
|
16
|
+
s => color_1.default.bold.blue(s),
|
|
17
|
+
];
|
|
18
|
+
const assignedColors = {};
|
|
19
|
+
function getColorForIdentifier(i) {
|
|
20
|
+
i = i.split('.')[0];
|
|
21
|
+
if (assignedColors[i])
|
|
22
|
+
return assignedColors[i];
|
|
23
|
+
assignedColors[i] = exports.COLORS[Object.keys(assignedColors).length % exports.COLORS.length];
|
|
24
|
+
return assignedColors[i];
|
|
25
|
+
}
|
|
26
|
+
// get initial colors so they are the same every time
|
|
27
|
+
getColorForIdentifier('run');
|
|
28
|
+
getColorForIdentifier('router');
|
|
29
|
+
getColorForIdentifier('web');
|
|
30
|
+
getColorForIdentifier('postgres');
|
|
31
|
+
getColorForIdentifier('heroku-postgres');
|
|
32
|
+
const lineRegex = /^(.*?\[([\w-]+)([\d.]+)?]:)(.*)?$/;
|
|
33
|
+
const red = color_1.default.red;
|
|
34
|
+
const dim = (i) => color_1.default.dim(i);
|
|
35
|
+
const other = dim;
|
|
36
|
+
const path = (i) => color_1.default.green(i);
|
|
37
|
+
const method = (i) => color_1.default.bold.magenta(i);
|
|
38
|
+
const status = (code) => {
|
|
39
|
+
if (code < 200)
|
|
40
|
+
return code;
|
|
41
|
+
if (code < 300)
|
|
42
|
+
return color_1.default.green(code);
|
|
43
|
+
if (code < 400)
|
|
44
|
+
return color_1.default.cyan(code);
|
|
45
|
+
if (code < 500)
|
|
46
|
+
return color_1.default.yellow(code);
|
|
47
|
+
if (code < 600)
|
|
48
|
+
return color_1.default.red(code);
|
|
49
|
+
return code;
|
|
50
|
+
};
|
|
51
|
+
const ms = (s) => {
|
|
52
|
+
const ms = Number.parseInt(s, 10);
|
|
53
|
+
if (!ms)
|
|
54
|
+
return s;
|
|
55
|
+
if (ms < 100)
|
|
56
|
+
return color_1.default.greenBright(s);
|
|
57
|
+
if (ms < 500)
|
|
58
|
+
return color_1.default.green(s);
|
|
59
|
+
if (ms < 5000)
|
|
60
|
+
return color_1.default.yellow(s);
|
|
61
|
+
if (ms < 10000)
|
|
62
|
+
return color_1.default.yellowBright(s);
|
|
63
|
+
return color_1.default.red(s);
|
|
64
|
+
};
|
|
65
|
+
function colorizeRouter(body) {
|
|
66
|
+
const encodeColor = ([k, v]) => {
|
|
67
|
+
switch (k) {
|
|
68
|
+
case 'at': return [k, v === 'error' ? red(v) : other(v)];
|
|
69
|
+
case 'code': return [k, red.bold(v)];
|
|
70
|
+
case 'method': return [k, method(v)];
|
|
71
|
+
case 'dyno': return [k, getColorForIdentifier(v)(v)];
|
|
72
|
+
case 'status': return [k, status(v)];
|
|
73
|
+
case 'path': return [k, path(v)];
|
|
74
|
+
case 'connect': return [k, ms(v)];
|
|
75
|
+
case 'service': return [k, ms(v)];
|
|
76
|
+
default: return [k, other(v)];
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
try {
|
|
80
|
+
const tokens = body.split(/\s+/).map(sub => {
|
|
81
|
+
const parts = sub.split('=');
|
|
82
|
+
if (parts.length === 1) {
|
|
83
|
+
return parts;
|
|
84
|
+
}
|
|
85
|
+
if (parts.length === 2) {
|
|
86
|
+
return encodeColor(parts);
|
|
87
|
+
}
|
|
88
|
+
return encodeColor([parts[0], parts.splice(1).join('=')]);
|
|
89
|
+
});
|
|
90
|
+
return tokens.map(([k, v]) => {
|
|
91
|
+
if (v === undefined) {
|
|
92
|
+
return other(k);
|
|
93
|
+
}
|
|
94
|
+
return other(k + '=') + v;
|
|
95
|
+
}).join(' ');
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
core_1.ux.warn(error);
|
|
99
|
+
return body;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const state = (s) => {
|
|
103
|
+
switch (s) {
|
|
104
|
+
case 'down': return red(s);
|
|
105
|
+
case 'up': return color_1.default.greenBright(s);
|
|
106
|
+
case 'starting': return color_1.default.yellowBright(s);
|
|
107
|
+
case 'complete': return color_1.default.greenBright(s);
|
|
108
|
+
default: return s;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
function colorizeRun(body) {
|
|
112
|
+
try {
|
|
113
|
+
if (body.match(/^Stopping all processes with SIGTERM$/))
|
|
114
|
+
return color_1.default.red(body);
|
|
115
|
+
const starting = body.match(/^(Starting process with command )(`.+`)(by user )?(.*)?$/);
|
|
116
|
+
if (starting) {
|
|
117
|
+
return [
|
|
118
|
+
starting[1],
|
|
119
|
+
color_1.default.cmd(starting[2]),
|
|
120
|
+
starting[3] || '',
|
|
121
|
+
color_1.default.green(starting[4] || ''),
|
|
122
|
+
].join('');
|
|
123
|
+
}
|
|
124
|
+
const stateChange = body.match(/^(State changed from )(\w+)( to )(\w+)$/);
|
|
125
|
+
if (stateChange) {
|
|
126
|
+
return [
|
|
127
|
+
stateChange[1],
|
|
128
|
+
state(stateChange[2]),
|
|
129
|
+
stateChange[3] || '',
|
|
130
|
+
state(stateChange[4] || ''),
|
|
131
|
+
].join('');
|
|
132
|
+
}
|
|
133
|
+
const exited = body.match(/^(Process exited with status )(\d+)$/);
|
|
134
|
+
if (exited) {
|
|
135
|
+
return [
|
|
136
|
+
exited[1],
|
|
137
|
+
exited[2] === '0' ? color_1.default.greenBright(exited[2]) : color_1.default.red(exited[2]),
|
|
138
|
+
].join('');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
core_1.ux.warn(error);
|
|
143
|
+
}
|
|
144
|
+
return body;
|
|
145
|
+
}
|
|
146
|
+
function colorizeWeb(body) {
|
|
147
|
+
try {
|
|
148
|
+
if (body.match(/^Unidling$/))
|
|
149
|
+
return color_1.default.yellow(body);
|
|
150
|
+
if (body.match(/^Restarting$/))
|
|
151
|
+
return color_1.default.yellow(body);
|
|
152
|
+
if (body.match(/^Stopping all processes with SIGTERM$/))
|
|
153
|
+
return color_1.default.red(body);
|
|
154
|
+
const starting = body.match(/^(Starting process with command )(`.+`)(by user )?(.*)?$/);
|
|
155
|
+
if (starting) {
|
|
156
|
+
return [
|
|
157
|
+
(starting[1]),
|
|
158
|
+
color_1.default.cmd(starting[2]),
|
|
159
|
+
(starting[3] || ''),
|
|
160
|
+
color_1.default.green(starting[4] || ''),
|
|
161
|
+
].join('');
|
|
162
|
+
}
|
|
163
|
+
const exited = body.match(/^(Process exited with status )(\d+)$/);
|
|
164
|
+
if (exited) {
|
|
165
|
+
return [
|
|
166
|
+
exited[1],
|
|
167
|
+
exited[2] === '0' ? color_1.default.greenBright(exited[2]) : color_1.default.red(exited[2]),
|
|
168
|
+
].join('');
|
|
169
|
+
}
|
|
170
|
+
const stateChange = body.match(/^(State changed from )(\w+)( to )(\w+)$/);
|
|
171
|
+
if (stateChange) {
|
|
172
|
+
return [
|
|
173
|
+
stateChange[1],
|
|
174
|
+
state(stateChange[2]),
|
|
175
|
+
stateChange[3],
|
|
176
|
+
state(stateChange[4]),
|
|
177
|
+
].join('');
|
|
178
|
+
}
|
|
179
|
+
const apache = body.match(/^(\d+\.\d+\.\d+\.\d+ -[^-]*- \[[^\]]+] ")(\w+)( )([^ ]+)( HTTP\/\d+\.\d+" )(\d+)( .+$)/);
|
|
180
|
+
if (apache) {
|
|
181
|
+
const [, ...tokens] = apache;
|
|
182
|
+
return [
|
|
183
|
+
other(tokens[0]),
|
|
184
|
+
method(tokens[1]),
|
|
185
|
+
other(tokens[2]),
|
|
186
|
+
path(tokens[3]),
|
|
187
|
+
other(tokens[4]),
|
|
188
|
+
status(tokens[5]),
|
|
189
|
+
other(tokens[6]),
|
|
190
|
+
].join('');
|
|
191
|
+
}
|
|
192
|
+
const route = body.match(/^(.* ")(\w+)(.+)(HTTP\/\d+\.\d+" .*)$/);
|
|
193
|
+
if (route) {
|
|
194
|
+
return [
|
|
195
|
+
route[1],
|
|
196
|
+
method(route[2]),
|
|
197
|
+
path(route[3]),
|
|
198
|
+
route[4],
|
|
199
|
+
].join('');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
core_1.ux.warn(error);
|
|
204
|
+
}
|
|
205
|
+
return body;
|
|
206
|
+
}
|
|
207
|
+
function colorizeAPI(body) {
|
|
208
|
+
if (body.match(/^Build succeeded$/))
|
|
209
|
+
return color_1.default.greenBright(body);
|
|
210
|
+
// eslint-disable-next-line unicorn/prefer-starts-ends-with
|
|
211
|
+
if (body.match(/^Build failed/))
|
|
212
|
+
return color_1.default.red(body);
|
|
213
|
+
const build = body.match(/^(Build started by user )(.+)$/);
|
|
214
|
+
if (build) {
|
|
215
|
+
return [
|
|
216
|
+
build[1],
|
|
217
|
+
color_1.default.green(build[2]),
|
|
218
|
+
].join('');
|
|
219
|
+
}
|
|
220
|
+
const deploy = body.match(/^(Deploy )([\w]+)( by user )(.+)$/);
|
|
221
|
+
if (deploy) {
|
|
222
|
+
return [
|
|
223
|
+
deploy[1],
|
|
224
|
+
color_1.default.cyan(deploy[2]),
|
|
225
|
+
deploy[3],
|
|
226
|
+
color_1.default.green(deploy[4]),
|
|
227
|
+
].join('');
|
|
228
|
+
}
|
|
229
|
+
const release = body.match(/^(Release )(v[\d]+)( created by user )(.+)$/);
|
|
230
|
+
if (release) {
|
|
231
|
+
return [
|
|
232
|
+
release[1],
|
|
233
|
+
color_1.default.magenta(release[2]),
|
|
234
|
+
release[3],
|
|
235
|
+
color_1.default.green(release[4]),
|
|
236
|
+
].join('');
|
|
237
|
+
}
|
|
238
|
+
const starting = body.match(/^(Starting process with command )(`.+`)(by user )?(.*)?$/);
|
|
239
|
+
if (starting) {
|
|
240
|
+
return [
|
|
241
|
+
(starting[1]),
|
|
242
|
+
color_1.default.cmd(starting[2]),
|
|
243
|
+
(starting[3] || ''),
|
|
244
|
+
color_1.default.green(starting[4] || ''),
|
|
245
|
+
].join('');
|
|
246
|
+
}
|
|
247
|
+
return body;
|
|
248
|
+
}
|
|
249
|
+
function colorizeRedis(body) {
|
|
250
|
+
if (body.match(/source=\w+ sample#/)) {
|
|
251
|
+
body = dim(body);
|
|
252
|
+
}
|
|
253
|
+
return body;
|
|
254
|
+
}
|
|
255
|
+
function colorizePG(body) {
|
|
256
|
+
const create = body.match(/^(\[DATABASE].*)(CREATE TABLE)(.*)$/);
|
|
257
|
+
if (create) {
|
|
258
|
+
return [
|
|
259
|
+
other(create[1]),
|
|
260
|
+
color_1.default.magenta(create[2]),
|
|
261
|
+
color_1.default.cyan(create[3]),
|
|
262
|
+
].join('');
|
|
263
|
+
}
|
|
264
|
+
if (body.match(/source=\w+ sample#/)) {
|
|
265
|
+
body = dim(body);
|
|
266
|
+
}
|
|
267
|
+
return body;
|
|
268
|
+
}
|
|
269
|
+
function colorize(line) {
|
|
270
|
+
if (process.env.HEROKU_LOGS_COLOR === '0')
|
|
271
|
+
return line;
|
|
272
|
+
const parsed = line.match(lineRegex);
|
|
273
|
+
if (!parsed)
|
|
274
|
+
return line;
|
|
275
|
+
const header = parsed[1];
|
|
276
|
+
const identifier = parsed[2];
|
|
277
|
+
let body = (parsed[4] || '').trim();
|
|
278
|
+
switch (identifier) {
|
|
279
|
+
case 'api':
|
|
280
|
+
body = colorizeAPI(body);
|
|
281
|
+
break;
|
|
282
|
+
case 'router':
|
|
283
|
+
body = colorizeRouter(body);
|
|
284
|
+
break;
|
|
285
|
+
case 'run':
|
|
286
|
+
body = colorizeRun(body);
|
|
287
|
+
break;
|
|
288
|
+
case 'web':
|
|
289
|
+
body = colorizeWeb(body);
|
|
290
|
+
break;
|
|
291
|
+
case 'heroku-redis':
|
|
292
|
+
body = colorizeRedis(body);
|
|
293
|
+
break;
|
|
294
|
+
case 'heroku-postgres':
|
|
295
|
+
case 'postgres':
|
|
296
|
+
body = colorizePG(body);
|
|
297
|
+
}
|
|
298
|
+
return getColorForIdentifier(identifier)(header) + ' ' + body;
|
|
299
|
+
}
|
|
300
|
+
exports.default = colorize;
|