heroku 10.5.0-beta.0 → 10.5.1-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/README.md CHANGED
@@ -34,6 +34,7 @@ For other issues, [submit a support ticket](https://help.heroku.com/).
34
34
  # Command Topics
35
35
 
36
36
  * [`heroku access`](docs/access.md) - manage user access to apps
37
+ * [`heroku accounts`](docs/accounts.md) - list the Heroku accounts in your cache
37
38
  * [`heroku addons`](docs/addons.md) - tools and services for developing, extending, and operating your app
38
39
  * [`heroku apps`](docs/apps.md) - manage apps on Heroku
39
40
  * [`heroku auth`](docs/auth.md) - manage authentication for your Heroku account
@@ -73,7 +74,7 @@ For other issues, [submit a support ticket](https://help.heroku.com/).
73
74
  * [`heroku teams`](docs/teams.md) - manage teams
74
75
  * [`heroku telemetry`](docs/telemetry.md) - list telemetry drains
75
76
  * [`heroku update`](docs/update.md) - update the Heroku CLI
76
- * [`heroku usage`](docs/usage.md) - list usage values for metered addons associated with a given app or team
77
+ * [`heroku usage`](docs/usage.md) - list usage for metered add-ons attached to an app or apps within a team
77
78
  * [`heroku version`](docs/version.md)
78
79
  * [`heroku webhooks`](docs/webhooks.md) - list webhooks on an app
79
80
 
@@ -0,0 +1,9 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Add extends Command {
3
+ static description: string;
4
+ static args: {
5
+ name: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static example: string;
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const accounts_1 = require("../../lib/accounts/accounts");
6
+ class Add extends command_1.Command {
7
+ async run() {
8
+ const { args } = await this.parse(Add);
9
+ const { name } = args;
10
+ const logInMessage = 'You must be logged in to run this command.';
11
+ if ((0, accounts_1.list)().some(a => a.name === name)) {
12
+ core_1.ux.error(`${name} already exists`);
13
+ }
14
+ const { body: account } = await this.heroku.get('/account');
15
+ const email = account.email || '';
16
+ const token = this.heroku.auth || '';
17
+ if (token === '') {
18
+ core_1.ux.error(logInMessage);
19
+ }
20
+ if (email === '') {
21
+ core_1.ux.error(logInMessage);
22
+ }
23
+ (0, accounts_1.add)(name, email, token);
24
+ }
25
+ }
26
+ exports.default = Add;
27
+ Add.description = 'add a Heroku account to your cache';
28
+ Add.args = {
29
+ name: core_1.Args.string({ description: 'name of Heroku account to add', required: true }),
30
+ };
31
+ Add.example = 'heroku accounts:add my-account';
@@ -0,0 +1,6 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Current extends Command {
3
+ static description: string;
4
+ static example: string;
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const accounts_1 = require("../../lib/accounts/accounts");
6
+ const color_1 = require("@heroku-cli/color");
7
+ class Current extends command_1.Command {
8
+ async run() {
9
+ const account = (0, accounts_1.current)();
10
+ if (account) {
11
+ core_1.ux.styledHeader(`Current account is ${account}`);
12
+ }
13
+ else {
14
+ core_1.ux.error(`You haven't set an account. Run ${color_1.default.cmd('heroku accounts:add <account-name>')} to add an account to your cache or ${color_1.default.cmd('heroku accounts:set <account-name>')} to set the current account.`);
15
+ }
16
+ }
17
+ }
18
+ exports.default = Current;
19
+ Current.description = 'display the current Heroku account';
20
+ Current.example = 'heroku accounts:current';
@@ -0,0 +1,6 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class AccountsIndex extends Command {
3
+ static description: string;
4
+ static example: string;
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const accounts_1 = require("../../lib/accounts/accounts");
6
+ class AccountsIndex extends command_1.Command {
7
+ async run() {
8
+ const accounts = (0, accounts_1.list)();
9
+ if (accounts.length === 0) {
10
+ core_1.ux.error('You don\'t have any accounts in your cache.');
11
+ }
12
+ for (const account of accounts) {
13
+ if (account.name === (0, accounts_1.current)()) {
14
+ core_1.ux.log(`* ${account.name}`);
15
+ }
16
+ else {
17
+ core_1.ux.log(` ${account.name}`);
18
+ }
19
+ }
20
+ }
21
+ }
22
+ exports.default = AccountsIndex;
23
+ AccountsIndex.description = 'list the Heroku accounts in your cache';
24
+ AccountsIndex.example = 'heroku accounts';
@@ -0,0 +1,9 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Remove extends Command {
3
+ static description: string;
4
+ static args: {
5
+ name: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static example: string;
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const accounts_1 = require("../../lib/accounts/accounts");
6
+ class Remove extends command_1.Command {
7
+ async run() {
8
+ const { args } = await this.parse(Remove);
9
+ const { name } = args;
10
+ if (!(0, accounts_1.list)().some(a => a.name === name)) {
11
+ core_1.ux.error(`${name} doesn't exist in your accounts cache.`);
12
+ }
13
+ if ((0, accounts_1.current)() === name) {
14
+ core_1.ux.error(`${name} is the current account.`);
15
+ }
16
+ (0, accounts_1.remove)(name);
17
+ }
18
+ }
19
+ exports.default = Remove;
20
+ Remove.description = 'remove a Heroku account from your cache';
21
+ Remove.args = {
22
+ name: core_1.Args.string({ description: 'name of Heroku account to remove', required: true }),
23
+ };
24
+ Remove.example = 'heroku accounts:remove my-account';
@@ -0,0 +1,9 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class Set extends Command {
3
+ static description: string;
4
+ static args: {
5
+ name: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static example: string;
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const accounts_1 = require("../../lib/accounts/accounts");
6
+ class Set extends command_1.Command {
7
+ async run() {
8
+ const { args } = await this.parse(Set);
9
+ const { name } = args;
10
+ if (!(0, accounts_1.list)().some(a => a.name === name)) {
11
+ core_1.ux.error(`${name} does not exist in your accounts cache.`);
12
+ }
13
+ (0, accounts_1.set)(name);
14
+ }
15
+ }
16
+ exports.default = Set;
17
+ Set.description = 'set the current Heroku account from your cache';
18
+ Set.args = {
19
+ name: core_1.Args.string({ description: 'name of account to set', required: true }),
20
+ };
21
+ Set.example = 'heroku accounts:set my-account';
@@ -22,6 +22,35 @@ const COST_MONTHLY = {
22
22
  'Performance-L-RAM': 500,
23
23
  'Performance-XL': 750,
24
24
  'Performance-2XL': 1500,
25
+ 'Private-S': 225,
26
+ 'Private-M': 450,
27
+ 'Private-L': 900,
28
+ 'Shield-M': 540,
29
+ 'Shield-L': 1080,
30
+ 'Shield-S': 270,
31
+ 'Private-Memory-L': 500,
32
+ 'Private-Memory-XL': 750,
33
+ 'Private-Memory-2XL': 1500,
34
+ 'Shield-Memory-L': 600,
35
+ 'Shield-Memory-XL': 900,
36
+ 'Shield-Memory-2XL': 1800,
37
+ 'dyno-1c-0.5gb': 25,
38
+ 'dyno-2c-1gb': 50,
39
+ 'dyno-1c-4gb': 80,
40
+ 'dyno-2c-8gb': 160,
41
+ 'dyno-4c-16gb': 320,
42
+ 'dyno-8c-32gb': 640,
43
+ 'dyno-16c-64gb': 1000,
44
+ 'dyno-2c-4gb': 150,
45
+ 'dyno-4c-8gb': 300,
46
+ 'dyno-8c-16gb': 600,
47
+ 'dyno-16c-32gb': 1200,
48
+ 'dyno-32c-64gb': 2400,
49
+ 'dyno-1c-8gb': 100,
50
+ 'dyno-2c-16gb': 250,
51
+ 'dyno-4c-32gb': 500,
52
+ 'dyno-8c-64gb': 750,
53
+ 'dyno-16c-128gb': 1500,
25
54
  };
26
55
  const calculateHourly = (size) => COST_MONTHLY[size] / 720;
27
56
  const emptyFormationErr = (app) => {
@@ -12,7 +12,7 @@ class UsageAddons extends command_1.Command {
12
12
  })));
13
13
  core_1.ux.styledHeader(`Usage for ${color_1.default.app(app)}`);
14
14
  core_1.ux.table(metersArray, {
15
- Addon: {
15
+ 'Add-on': {
16
16
  get: row => {
17
17
  const matchingAddon = appAddons.find(a => a.id === row.addonId);
18
18
  return (matchingAddon === null || matchingAddon === void 0 ? void 0 : matchingAddon.name) || row.addonId;
@@ -111,8 +111,8 @@ class UsageAddons extends command_1.Command {
111
111
  }
112
112
  exports.default = UsageAddons;
113
113
  UsageAddons.topic = 'usage';
114
- UsageAddons.description = 'list usage values for metered addons associated with a given app or team';
114
+ UsageAddons.description = 'list usage for metered add-ons attached to an app or apps within a team';
115
115
  UsageAddons.flags = {
116
- app: command_1.flags.string(),
117
- team: command_1.flags.string(),
116
+ app: command_1.flags.string({ char: 'a', description: 'app to list metered add-ons usage for' }),
117
+ team: command_1.flags.team({ description: 'team to list metered add-ons usage for' }),
118
118
  };
@@ -0,0 +1,6 @@
1
+ import * as Heroku from '@heroku-cli/schema';
2
+ export declare function list(): Heroku.Account[] | [];
3
+ export declare function current(): string | null;
4
+ export declare function add(name: string, username: string, password: string): void;
5
+ export declare function remove(name: string): void;
6
+ export declare function set(name: string): void;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.set = exports.remove = exports.add = exports.current = exports.list = void 0;
4
+ const yaml_1 = require("yaml");
5
+ const fs = require("fs");
6
+ const os = require("node:os");
7
+ const path = require("node:path");
8
+ const netrc_parser_1 = require("netrc-parser");
9
+ function configDir() {
10
+ const legacyDir = path.join(os.homedir(), '.heroku');
11
+ if (fs.existsSync(legacyDir)) {
12
+ return legacyDir;
13
+ }
14
+ return path.join(os.homedir(), '.config', 'heroku');
15
+ }
16
+ function account(name) {
17
+ const basedir = path.join(configDir(), 'accounts');
18
+ const file = fs.readFileSync(path.join(basedir, name), 'utf8');
19
+ const account = (0, yaml_1.parse)(file);
20
+ if (account[':username']) {
21
+ // convert from ruby symbols
22
+ account.username = account[':username'];
23
+ account.password = account[':password'];
24
+ delete account[':username'];
25
+ delete account[':password'];
26
+ }
27
+ return account;
28
+ }
29
+ function list() {
30
+ const basedir = path.join(configDir(), 'accounts');
31
+ try {
32
+ return fs.readdirSync(basedir)
33
+ .map(name => Object.assign(account(name), { name }));
34
+ }
35
+ catch (_a) {
36
+ return [];
37
+ }
38
+ }
39
+ exports.list = list;
40
+ function current() {
41
+ if (netrc_parser_1.default.machines['api.heroku.com']) {
42
+ const current = list().find(a => a.username === netrc_parser_1.default.machines['api.heroku.com'].login);
43
+ return current && current.name ? current.name : null;
44
+ }
45
+ return null;
46
+ }
47
+ exports.current = current;
48
+ function add(name, username, password) {
49
+ const basedir = path.join(configDir(), 'accounts');
50
+ fs.mkdirSync(basedir, { recursive: true });
51
+ fs.writeFileSync(path.join(basedir, name), (0, yaml_1.stringify)({ username, password }), 'utf8');
52
+ fs.chmodSync(path.join(basedir, name), 0o600);
53
+ }
54
+ exports.add = add;
55
+ function remove(name) {
56
+ const basedir = path.join(configDir(), 'accounts');
57
+ fs.unlinkSync(path.join(basedir, name));
58
+ }
59
+ exports.remove = remove;
60
+ function set(name) {
61
+ const current = account(name);
62
+ netrc_parser_1.default.machines['git.heroku.com'] = {};
63
+ netrc_parser_1.default.machines['api.heroku.com'] = {};
64
+ netrc_parser_1.default.machines['git.heroku.com'].login = current.username;
65
+ netrc_parser_1.default.machines['api.heroku.com'].login = current.username;
66
+ netrc_parser_1.default.machines['git.heroku.com'].password = current.password;
67
+ netrc_parser_1.default.machines['api.heroku.com'].password = current.password;
68
+ netrc_parser_1.default.saveSync();
69
+ }
70
+ exports.set = set;