@heroku-cli/plugin-buildpack-registry 1.0.2 → 2.0.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.
@@ -2,9 +2,7 @@ import { Command } from '@heroku-cli/command';
2
2
  export default class Archive extends Command {
3
3
  static description: string;
4
4
  static args: {
5
- name: string;
6
- required: boolean;
7
- description: string;
8
- }[];
5
+ buildpack: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ };
9
7
  run(): Promise<void>;
10
8
  }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const heroku_cli_util_1 = require("@heroku/heroku-cli-util");
5
+ const core_1 = require("@oclif/core");
6
+ const buildpack_registry_1 = require("@heroku/buildpack-registry");
7
+ const true_myth_1 = require("true-myth");
8
+ class Archive extends command_1.Command {
9
+ static description = 'archive a buildpack';
10
+ static args = {
11
+ buildpack: core_1.Args.string({ required: true, description: 'namespace/name of the buildpack' }),
12
+ };
13
+ async run() {
14
+ const { args } = await this.parse(Archive);
15
+ const herokuAuth = this.heroku.auth || '';
16
+ if (herokuAuth === '') {
17
+ this.error('You need to be logged in to run this command.');
18
+ }
19
+ const registry = new buildpack_registry_1.BuildpackRegistry();
20
+ true_myth_1.Result.match({
21
+ Ok: _ => { },
22
+ Err: err => {
23
+ this.error(`Could not publish the buildpack.\n${err}`);
24
+ },
25
+ }, buildpack_registry_1.BuildpackRegistry.isValidBuildpackSlug(args.buildpack));
26
+ let secondFactor;
27
+ if ((await registry.requiresTwoFactor(args.buildpack)).unwrapOr(false) === true) {
28
+ secondFactor = await heroku_cli_util_1.hux.prompt('Two-factor code', { type: 'mask' });
29
+ }
30
+ const result = await registry.archive(args.buildpack, herokuAuth, secondFactor);
31
+ true_myth_1.Result.match({
32
+ Ok: _ => core_1.ux.log(`Archived ${args.buildpack}`),
33
+ Err: err => {
34
+ if (err.status === 404) {
35
+ core_1.ux.error(`Buildpack '${args.buildpack}' not found`);
36
+ }
37
+ else if (err.status === 401) {
38
+ core_1.ux.error(`Do not have permission on '${args.buildpack}'`);
39
+ }
40
+ else {
41
+ core_1.ux.error(`Could not archive '${args.buildpack}', ${err.status}: ${err.description}`);
42
+ }
43
+ },
44
+ }, result);
45
+ }
46
+ }
47
+ exports.default = Archive;
@@ -2,10 +2,8 @@ import { Command } from '@heroku-cli/command';
2
2
  export default class Init extends Command {
3
3
  static description: string;
4
4
  static args: {
5
- name: string;
6
- required: boolean;
7
- description: string;
8
- }[];
5
+ name: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ };
9
7
  run(): Promise<void>;
10
8
  existMessage(filename: string): string;
11
9
  createMessage(filename: string): string;
@@ -1,27 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const color_1 = require("@heroku-cli/color");
3
+ const tslib_1 = require("tslib");
4
+ const color_1 = tslib_1.__importDefault(require("@heroku-cli/color"));
4
5
  const command_1 = require("@heroku-cli/command");
5
- const fs = require("fs");
6
+ const fs = tslib_1.__importStar(require("fs"));
7
+ const core_1 = require("@oclif/core");
6
8
  const DETECT = `#!/usr/bin/env bash
7
9
  # bin/detect <build-dir>
8
10
 
9
- echo \"Hello World\"
11
+ echo "Hello World"
10
12
  exit 0
11
13
  `;
12
14
  const COMPILE = `#!/usr/bin/env bash
13
15
  # bin/compile <build-dir> <cache-dir>
14
16
 
15
- echo \"-----> Nothing to do.\"
17
+ echo "-----> Nothing to do."
16
18
  `;
17
19
  const RELEASE = `
18
20
  #!/usr/bin/env bash
19
21
 
20
- echo \"--- {}\"
22
+ echo "--- {}"
21
23
  `;
22
24
  class Init extends command_1.Command {
25
+ static description = 'bootstrap a new buildpack';
26
+ static args = {
27
+ name: core_1.Args.string({ required: true, description: 'name of the buildpack' }),
28
+ };
23
29
  async run() {
24
- const { args } = this.parse(Init);
30
+ const { args } = await this.parse(Init);
25
31
  this.createDir(args.name);
26
32
  this.createDir('bin', args.name);
27
33
  this.createFile('bin/detect', args.name, DETECT);
@@ -35,7 +41,7 @@ class Init extends command_1.Command {
35
41
  return ` ${color_1.default.green.bold('create')} ${filename}`;
36
42
  }
37
43
  createFile(filename, parent, template) {
38
- let fullPath = `${parent}/${filename}`;
44
+ const fullPath = `${parent}/${filename}`;
39
45
  if (fs.existsSync(fullPath)) {
40
46
  this.log(this.existMessage(filename));
41
47
  }
@@ -63,12 +69,4 @@ class Init extends command_1.Command {
63
69
  }
64
70
  }
65
71
  }
66
- Init.description = 'bootstrap a new buildpack';
67
- Init.args = [
68
- {
69
- name: 'name',
70
- required: true,
71
- description: 'name of the buildpack'
72
- }
73
- ];
74
72
  exports.default = Init;
@@ -0,0 +1,9 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Publish extends Command {
3
+ static description: string;
4
+ static args: {
5
+ buildpack: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ tag_or_branch: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const buildpack_registry_1 = require("@heroku/buildpack-registry");
5
+ const core_1 = require("@oclif/core");
6
+ const heroku_cli_util_1 = require("@heroku/heroku-cli-util");
7
+ const true_myth_1 = require("true-myth");
8
+ class Publish extends command_1.Command {
9
+ static description = 'publish new revision of buildpack';
10
+ static args = {
11
+ buildpack: core_1.Args.string({ required: true, description: 'namespace/name of the buildpack' }),
12
+ tag_or_branch: core_1.Args.string({ required: true, description: 'a tag or branch for publishing' }),
13
+ };
14
+ async run() {
15
+ const { args } = await this.parse(Publish);
16
+ const herokuAuth = this.heroku.auth || '';
17
+ if (herokuAuth === '') {
18
+ this.error('You need to be logged in to run this command.');
19
+ }
20
+ const registry = new buildpack_registry_1.BuildpackRegistry();
21
+ true_myth_1.Result.match({
22
+ Ok: _ => { },
23
+ Err: err => {
24
+ this.error(`Could not find the buildpack.\n${err}`);
25
+ },
26
+ }, buildpack_registry_1.BuildpackRegistry.isValidBuildpackSlug(args.buildpack));
27
+ let secondFactor;
28
+ if ((await registry.requiresTwoFactor(args.buildpack)).unwrapOr(false) === true) {
29
+ secondFactor = await heroku_cli_util_1.hux.prompt('Two-factor code', { type: 'mask' });
30
+ }
31
+ const result = await registry.publish(args.buildpack, args.tag_or_branch, herokuAuth, secondFactor);
32
+ await true_myth_1.Result.match({
33
+ Ok: revision => {
34
+ core_1.ux.action.start(`Publishing buildpack ${args.buildpack}`);
35
+ return registry.waitForRelease(revision.buildpack_id, revision.id).then((status) => {
36
+ core_1.ux.action.stop();
37
+ switch (status) {
38
+ case 'failed':
39
+ core_1.ux.error('Failed to publish buildpack');
40
+ break;
41
+ case 'published':
42
+ core_1.ux.log('Publishing buildpack was successful');
43
+ break;
44
+ case 'pending':
45
+ core_1.ux.error('Process timed out buildpack revision is still pending');
46
+ break;
47
+ default:
48
+ core_1.ux.error(`Publishing buildpack ended with status: ${status}`);
49
+ }
50
+ });
51
+ },
52
+ Err: err => {
53
+ return err.status === 404 ?
54
+ core_1.ux.error(`Could not find buildpack '${args.buildpack}'`) :
55
+ core_1.ux.error(`Could not publish '${args.buildpack}': ${err.status}, ${err.description}`);
56
+ },
57
+ }, result);
58
+ }
59
+ }
60
+ exports.default = Publish;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const open_1 = tslib_1.__importDefault(require("open"));
6
+ const PARTNER_PORTAL = `https://addons-next.${process.env.HEROKU_HOST || 'heroku.com'}/buildpacks/new`;
7
+ class Register extends command_1.Command {
8
+ static description = 'create a buildpack';
9
+ async run() {
10
+ this.log('Opening the buildpack registration page...');
11
+ await (0, open_1.default)(PARTNER_PORTAL);
12
+ }
13
+ }
14
+ exports.default = Register;
@@ -2,9 +2,7 @@ import { Command } from '@heroku-cli/command';
2
2
  export default class Rollback extends Command {
3
3
  static description: string;
4
4
  static args: {
5
- name: string;
6
- required: boolean;
7
- description: string;
8
- }[];
5
+ buildpack: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ };
9
7
  run(): Promise<void>;
10
8
  }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const heroku_cli_util_1 = require("@heroku/heroku-cli-util");
5
+ const core_1 = require("@oclif/core");
6
+ const buildpack_registry_1 = require("@heroku/buildpack-registry");
7
+ const true_myth_1 = require("true-myth");
8
+ class Rollback extends command_1.Command {
9
+ static description = 'rollback to a previous revision of the buildpack';
10
+ static args = {
11
+ buildpack: core_1.Args.string({ required: true, description: 'namespace/name of the buildpack' }),
12
+ };
13
+ async run() {
14
+ const { args } = await this.parse(Rollback);
15
+ const registry = new buildpack_registry_1.BuildpackRegistry();
16
+ const herokuAuth = this.heroku.auth || '';
17
+ if (herokuAuth === '') {
18
+ this.error('You need to be logged in to run this command.');
19
+ }
20
+ true_myth_1.Result.match({
21
+ Ok: _ => { },
22
+ Err: err => {
23
+ this.error(`Could not rollback the buildpack.\n${err}`);
24
+ },
25
+ }, buildpack_registry_1.BuildpackRegistry.isValidBuildpackSlug(args.buildpack));
26
+ let secondFactor;
27
+ if ((await registry.requiresTwoFactor(args.buildpack)).unwrapOr(false) === true) {
28
+ secondFactor = await heroku_cli_util_1.hux.prompt('Two-factor code', { type: 'mask' });
29
+ }
30
+ const result = await registry.rollback(args.buildpack, herokuAuth, secondFactor);
31
+ await true_myth_1.Result.match({
32
+ Ok: revision => {
33
+ core_1.ux.action.start(`Rolling back buildpack ${args.buildpack}`);
34
+ return registry.waitForRelease(revision.buildpack_id, revision.id).then((status) => {
35
+ core_1.ux.action.stop();
36
+ // eslint-disable-next-line unicorn/prefer-switch
37
+ if (status === 'failed') {
38
+ this.error('Failed to rollback buildpack');
39
+ }
40
+ else if (status === 'published') {
41
+ this.log(`Rolling back buildpack to '${revision.ref}' was successful`);
42
+ }
43
+ else if (status === 'pending') {
44
+ this.error('Process timed out buildpack revision is still pending');
45
+ }
46
+ else {
47
+ this.error(`Rolling back buildpack ended with status: ${status}`);
48
+ }
49
+ });
50
+ },
51
+ Err: err => {
52
+ return err.status === 404 ?
53
+ this.error(`Could not find buildpack '${args.buildpack}'`) :
54
+ this.error(`Could not rollback '${args.buildpack}', ${err.status}: ${err.description}`);
55
+ },
56
+ }, result);
57
+ }
58
+ }
59
+ exports.default = Rollback;
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/commands/buildpacks/archive.ts","../src/commands/buildpacks/init.ts","../src/commands/buildpacks/publish.ts","../src/commands/buildpacks/register.ts","../src/commands/buildpacks/rollback.ts"],"version":"5.8.3"}
@@ -20,7 +20,7 @@
20
20
  "strict": true,
21
21
  "isESM": false,
22
22
  "relativePath": [
23
- "lib",
23
+ "dist",
24
24
  "commands",
25
25
  "buildpacks",
26
26
  "archive.js"
@@ -46,7 +46,7 @@
46
46
  "strict": true,
47
47
  "isESM": false,
48
48
  "relativePath": [
49
- "lib",
49
+ "dist",
50
50
  "commands",
51
51
  "buildpacks",
52
52
  "init.js"
@@ -77,7 +77,7 @@
77
77
  "strict": true,
78
78
  "isESM": false,
79
79
  "relativePath": [
80
- "lib",
80
+ "dist",
81
81
  "commands",
82
82
  "buildpacks",
83
83
  "publish.js"
@@ -97,7 +97,7 @@
97
97
  "strict": true,
98
98
  "isESM": false,
99
99
  "relativePath": [
100
- "lib",
100
+ "dist",
101
101
  "commands",
102
102
  "buildpacks",
103
103
  "register.js"
@@ -123,12 +123,12 @@
123
123
  "strict": true,
124
124
  "isESM": false,
125
125
  "relativePath": [
126
- "lib",
126
+ "dist",
127
127
  "commands",
128
128
  "buildpacks",
129
129
  "rollback.js"
130
130
  ]
131
131
  }
132
132
  },
133
- "version": "1.0.2"
133
+ "version": "2.0.0-beta.1"
134
134
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@heroku-cli/plugin-buildpack-registry",
3
- "version": "1.0.2",
4
- "description": "",
5
- "main": "lib/index.js",
3
+ "version": "2.0.0-beta.1",
4
+ "description": "Create and publish buildpacks",
5
+ "main": "dist/index.js",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/heroku/plugin-buildpack-registry.git"
9
9
  },
10
- "author": "Terence Lee <hone02@gmail.com>",
10
+ "author": "Heroku",
11
11
  "license": "MIT",
12
12
  "keywords": [
13
13
  "heroku-plugin"
@@ -16,70 +16,72 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
+ "build": "rm -rf dist && tsc -b && oclif manifest && oclif readme",
20
+ "lint": "eslint . --ext .ts --config .eslintrc.json",
21
+ "prepack": "yarn build",
19
22
  "postpack": "rm -f oclif.manifest.json",
20
- "posttest": "tsc -p test --noEmit && tslint -p test -t stylish",
21
- "prepack": "rm -rf lib && tsc && oclif manifest && oclif readme",
22
- "test": "nyc mocha --forbid-only \"test/**/*.test.ts\"",
23
- "version": "oclif-dev readme && git add README.md"
23
+ "posttest": "yarn lint",
24
+ "test": "nyc mocha --forbid-only",
25
+ "test:local": "nyc mocha",
26
+ "version": "oclif readme && git add README.md"
24
27
  },
25
28
  "dependencies": {
26
- "@heroku-cli/color": "^1.1.5",
27
- "@heroku-cli/command": "^8.1.15",
28
- "@heroku/heroku-cli-util": "^8.0.14",
29
- "@oclif/config": "^1.6.17",
30
- "@oclif/plugin-legacy": "^1.0.15",
29
+ "@heroku-cli/color": "^2.0.0",
30
+ "@heroku-cli/command": "^11.6.0",
31
+ "@heroku/buildpack-registry": "^1.0.1",
32
+ "@heroku/heroku-cli-util": "^9.0.1",
33
+ "@oclif/core": "^2.16.0",
34
+ "@oclif/plugin-help": "^5.0.0",
31
35
  "@types/ansi-styles": "^3.2.0",
32
36
  "@types/lodash": "^4.14.108",
33
37
  "@types/supports-color": "^5.3.0",
34
- "buildpack-registry": "^1.0.1",
35
- "cli-ux": "^4.2.1",
36
38
  "lodash": "^4.14.0",
37
39
  "lodash.findindex": "^4.6.0",
40
+ "open": "^8.4.2",
38
41
  "true-myth": "^2.0.0",
39
42
  "valid-url": "^1.0.9"
40
43
  },
41
44
  "devDependencies": {
42
45
  "@fancy-test/nock": "^0.1.1",
43
- "@oclif/plugin-help": "5.2.20",
44
- "@oclif/test": "^1.2.4",
45
- "@oclif/tslint": "^1",
46
+ "@oclif/plugin-help": "^5.0.0",
47
+ "@oclif/test": "^2.3.28",
46
48
  "@types/chai": "^4",
49
+ "@types/glob": "^8.1.0",
47
50
  "@types/mocha": "^10.0.6",
48
51
  "@types/node": "16.11.7",
52
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
53
+ "@typescript-eslint/parser": "^6.0.0",
49
54
  "chai": "^4",
55
+ "eslint": "^7.0.0",
56
+ "eslint-config-oclif": "^4.0.0",
57
+ "eslint-config-oclif-typescript": "^1.0.0",
58
+ "eslint-import-resolver-typescript": "^3.0.0",
59
+ "eslint-plugin-import": "^2.0.0",
60
+ "eslint-plugin-mocha": "^10.0.0",
50
61
  "globby": "^13.2.2",
51
62
  "mocha": "^10.4.0",
52
63
  "nock": "^13.5.1",
53
64
  "nyc": "^15.1.0",
54
- "oclif": "^4.14.29",
65
+ "oclif": "^4.18.0",
55
66
  "tmp": "^0.0.33",
56
- "ts-node": "^6",
57
- "tslib": "^1",
58
- "tslint": "^5",
59
- "typescript": "^5.5.4"
67
+ "ts-node": "^10.0.0",
68
+ "typescript": "^5.0.0"
60
69
  },
61
70
  "engines": {
62
- "node": ">=16.0.0"
71
+ "node": ">=20 <22.18"
63
72
  },
64
73
  "files": [
65
- "/lib",
66
- "/oclif.manifest.json"
74
+ "/dist",
75
+ "oclif.manifest.json"
67
76
  ],
68
- "mocha": {
69
- "require": [
70
- "ts-node/register",
71
- "source-map-support/register"
72
- ],
73
- "watch-extensions": "ts",
74
- "recursive": true,
75
- "reporter": "spec",
76
- "timeout": 360000
77
- },
78
77
  "oclif": {
79
- "commands": "./lib/commands",
78
+ "commands": "./dist/commands",
80
79
  "bin": "heroku",
81
80
  "devPlugins": [
82
81
  "@oclif/plugin-help"
82
+ ],
83
+ "additionalHelpFlags": [
84
+ "-h"
83
85
  ]
84
86
  }
85
87
  }
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@heroku-cli/command");
4
- const buildpack_registry_1 = require("buildpack-registry");
5
- const cli_ux_1 = require("cli-ux");
6
- const true_myth_1 = require("true-myth");
7
- class Archive extends command_1.Command {
8
- async run() {
9
- let { args } = this.parse(Archive);
10
- let registry;
11
- let herokuAuth = this.heroku.auth || '';
12
- if (herokuAuth === '') {
13
- this.error('You need to be logged in to run this command.');
14
- }
15
- registry = new buildpack_registry_1.BuildpackRegistry();
16
- true_myth_1.Result.match({
17
- Ok: _ => { },
18
- Err: err => {
19
- this.error(`Could not publish the buildpack.\n${err}`);
20
- },
21
- }, buildpack_registry_1.BuildpackRegistry.isValidBuildpackSlug(args.buildpack));
22
- let secondFactor;
23
- if ((await registry.requiresTwoFactor(args.buildpack)).unwrapOr(false) === true) {
24
- secondFactor = await cli_ux_1.cli.prompt('Two-factor code', { type: 'mask' });
25
- }
26
- let result = await registry.archive(args.buildpack, herokuAuth, secondFactor);
27
- true_myth_1.Result.match({
28
- Ok: _ => cli_ux_1.cli.log(`Archived ${args.buildpack}`),
29
- Err: err => {
30
- if (err.status === 404) {
31
- cli_ux_1.cli.error(`Buildpack '${args.buildpack}' not found`);
32
- }
33
- else if (err.status === 401) {
34
- cli_ux_1.cli.error(`Do not have permission on '${args.buildpack}'`);
35
- }
36
- else {
37
- cli_ux_1.cli.error(`Could not archive '${args.buildpack}', ${err.status}: ${err.description}`);
38
- }
39
- }
40
- }, result);
41
- }
42
- }
43
- Archive.description = 'archive a buildpack';
44
- Archive.args = [
45
- {
46
- name: 'buildpack',
47
- required: true,
48
- description: 'namespace/name of the buildpack'
49
- }
50
- ];
51
- exports.default = Archive;
@@ -1,10 +0,0 @@
1
- import { Command } from '@heroku-cli/command';
2
- export default class Publish extends Command {
3
- static description: string;
4
- static args: {
5
- name: string;
6
- required: boolean;
7
- description: string;
8
- }[];
9
- run(): Promise<void>;
10
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@heroku-cli/command");
4
- const buildpack_registry_1 = require("buildpack-registry");
5
- const cli_ux_1 = require("cli-ux");
6
- const true_myth_1 = require("true-myth");
7
- class Publish extends command_1.Command {
8
- async run() {
9
- let { args } = this.parse(Publish);
10
- let registry;
11
- let herokuAuth = this.heroku.auth || '';
12
- if (herokuAuth === '') {
13
- this.error('You need to be logged in to run this command.');
14
- }
15
- registry = new buildpack_registry_1.BuildpackRegistry();
16
- true_myth_1.Result.match({
17
- Ok: _ => { },
18
- Err: err => {
19
- this.error(`Could not find the buildpack.\n${err}`);
20
- },
21
- }, buildpack_registry_1.BuildpackRegistry.isValidBuildpackSlug(args.buildpack));
22
- let secondFactor;
23
- if ((await registry.requiresTwoFactor(args.buildpack)).unwrapOr(false) === true) {
24
- secondFactor = await cli_ux_1.cli.prompt('Two-factor code', { type: 'mask' });
25
- }
26
- let result = await registry.publish(args.buildpack, args.tag_or_branch, herokuAuth, secondFactor);
27
- await true_myth_1.Result.match({
28
- Ok: revision => {
29
- cli_ux_1.cli.action.start(`Publishing buildpack ${args.buildpack}`);
30
- return registry.waitForRelease(revision.buildpack_id, revision.id).then((status) => {
31
- cli_ux_1.cli.action.stop();
32
- if (status === 'failed') {
33
- cli_ux_1.cli.error('Failed to publish buildpack');
34
- }
35
- else if (status === 'published') {
36
- cli_ux_1.cli.log('Publishing buildpack was successful');
37
- }
38
- else if (status === 'pending') {
39
- cli_ux_1.cli.error('Process timed out buildpack revision is still pending');
40
- }
41
- else {
42
- cli_ux_1.cli.error(`Publishing buildpack ended with status: ${status}`);
43
- }
44
- });
45
- },
46
- Err: err => {
47
- if (err.status === 404) {
48
- return cli_ux_1.cli.error(`Could not find buildpack '${args.buildpack}'`);
49
- }
50
- else {
51
- return cli_ux_1.cli.error(`Could not publish '${args.buildpack}': ${err.status}, ${err.description}`);
52
- }
53
- },
54
- }, result);
55
- }
56
- }
57
- Publish.description = 'publish new revision of buildpack';
58
- Publish.args = [
59
- {
60
- name: 'buildpack',
61
- required: true,
62
- description: 'namespace/name of the buildpack'
63
- },
64
- {
65
- name: 'tag_or_branch',
66
- required: true,
67
- description: 'a tag or branch for publishing'
68
- }
69
- ];
70
- exports.default = Publish;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@heroku-cli/command");
4
- const cli = require('@heroku/heroku-cli-util');
5
- const PARTNER_PORTAL = 'https://addons-next.heroku.com/buildpacks/new';
6
- class Register extends command_1.Command {
7
- async run() {
8
- this.log('Opening the buildpack registration page...');
9
- cli.open(PARTNER_PORTAL);
10
- }
11
- }
12
- Register.description = 'create a buildpack';
13
- exports.default = Register;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@heroku-cli/command");
4
- const buildpack_registry_1 = require("buildpack-registry");
5
- const cli_ux_1 = require("cli-ux");
6
- const true_myth_1 = require("true-myth");
7
- class Rollback extends command_1.Command {
8
- async run() {
9
- let { args } = this.parse(Rollback);
10
- let registry;
11
- let herokuAuth = this.heroku.auth || '';
12
- if (herokuAuth === '') {
13
- this.error('You need to be logged in to run this command.');
14
- }
15
- registry = new buildpack_registry_1.BuildpackRegistry();
16
- true_myth_1.Result.match({
17
- Ok: _ => { },
18
- Err: err => {
19
- this.error(`Could not rollback the buildpack.\n${err}`);
20
- },
21
- }, buildpack_registry_1.BuildpackRegistry.isValidBuildpackSlug(args.buildpack));
22
- let secondFactor;
23
- if ((await registry.requiresTwoFactor(args.buildpack)).unwrapOr(false) === true) {
24
- secondFactor = await cli_ux_1.cli.prompt('Two-factor code', { type: 'mask' });
25
- }
26
- let result = await registry.rollback(args.buildpack, herokuAuth, secondFactor);
27
- await true_myth_1.Result.match({
28
- Ok: revision => {
29
- cli_ux_1.cli.action.start(`Rolling back buildpack ${args.buildpack}`);
30
- return registry.waitForRelease(revision.buildpack_id, revision.id).then((status) => {
31
- cli_ux_1.cli.action.stop();
32
- if (status === 'failed') {
33
- cli_ux_1.cli.error('Failed to rollback buildpack');
34
- }
35
- else if (status === 'published') {
36
- cli_ux_1.cli.log(`Rolling back buildpack to '${revision.ref}' was successful`);
37
- }
38
- else if (status === 'pending') {
39
- cli_ux_1.cli.error('Process timed out buildpack revision is still pending');
40
- }
41
- else {
42
- cli_ux_1.cli.error(`Rolling back buildpack ended with status: ${status}`);
43
- }
44
- });
45
- },
46
- Err: err => {
47
- if (err.status === 404) {
48
- return cli_ux_1.cli.error(`Could not find buildpack '${args.buildpack}'`);
49
- }
50
- else {
51
- return cli_ux_1.cli.error(`Could not rollback '${args.buildpack}', ${err.status}: ${err.description}`);
52
- }
53
- }
54
- }, result);
55
- }
56
- }
57
- Rollback.description = 'rollback to a previous revision of the buildpack';
58
- Rollback.args = [
59
- {
60
- name: 'buildpack',
61
- required: true,
62
- description: 'namespace/name of the buildpack'
63
- }
64
- ];
65
- exports.default = Rollback;
File without changes
File without changes
File without changes