Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
578 changes: 113 additions & 465 deletions CHANGELOG.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"@heroku/function-toml": "^0.0.3",
"@heroku/functions-core": "^0.5.5",
"@heroku/project-descriptor": "0.0.6",
"@oclif/core": "^1.26.1",
"@salesforce/core": "^3.32.12",
"@salesforce/sf-plugins-core": "^1.22.3",
"@oclif/core": "^2.0.7",
"@salesforce/core": "^3.33.1",
"@salesforce/sf-plugins-core": "^2.0.1",
"@salesforce/ts-types": "^1.7.3",
"axios": "^0.27.2",
"axios-debug-log": "^0.8.4",
Expand All @@ -40,7 +40,7 @@
"@oclif/plugin-command-snapshot": "^3.3.2",
"@oclif/plugin-help": "^5",
"@oclif/plugin-which": "^1.0.4",
"@oclif/test": "^1",
"@oclif/test": "^2",
"@salesforce/dev-config": "^3.0.0",
"@salesforce/dev-scripts": "^2.0.3",
"@salesforce/plugin-command-reference": "^1.6.2",
Expand Down Expand Up @@ -71,7 +71,7 @@
"lint-staged": "^12.3.6",
"mocha": "^9.2.2",
"nyc": "^15.1.0",
"oclif": "^2.6.0",
"oclif": "^3.6.1",
"prettier": "^2.8.3",
"pretty-quick": "^3.1.3",
"shx": "^0.3.4",
Expand Down Expand Up @@ -190,4 +190,4 @@
"access": "public"
},
"main": "lib/index.js"
}
}
17 changes: 6 additions & 11 deletions src/commands/env/var/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import herokuColor from '@heroku-cli/color';
import * as Heroku from '@heroku-cli/schema';
import { Messages } from '@salesforce/core';
import { Errors } from '@oclif/core';
import { Args, Errors } from '@oclif/core';
import { FunctionsFlagBuilder } from '../../../lib/flags';

import Command from '../../../lib/base';
Expand All @@ -34,12 +34,9 @@ export default class VarGet extends Command {
}),
};

static args = [
{
name: 'key',
required: true,
},
];
static args = {
key: Args.string({ required: true }),
};

async run() {
const { flags, args } = await this.parse(VarGet);
Expand Down Expand Up @@ -68,12 +65,10 @@ export default class VarGet extends Command {

if (!value) {
if (flags.json) {
this.warn(`No config var named ${args.key as string} found for environment ${targetCompute}`);
this.warn(`No config var named ${args.key} found for environment ${targetCompute}`);
} else {
this.warn(
`No config var named ${herokuColor.cyan(args.key as string)} found for environment ${herokuColor.cyan(
targetCompute
)}`
`No config var named ${herokuColor.cyan(args.key)} found for environment ${herokuColor.cyan(targetCompute)}`
);
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/env/var/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class ConfigSet extends Command {

const appName = await resolveAppNameForEnvironment(targetCompute);

const configPairs = this.parseKeyValuePairs(argv);
const configPairs = this.parseKeyValuePairs(argv as string[]);

cli.action.start(
`Setting ${Object.keys(configPairs)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/env/var/unset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class ConfigUnset extends Command {

try {
const { data: config } = await this.client.get<Heroku.ConfigVars>(`/apps/${appName}/config-vars`);
const value = config[argv[0]];
const value = config[argv[0] as string];

if (!value) {
this.error('not correct config var', { exit: 401 });
Expand All @@ -84,7 +84,7 @@ export default class ConfigUnset extends Command {
this.error(error);
}

const configPairs = argv.reduce((acc: any, elem: any) => {
const configPairs = (argv as string[]).reduce((acc: any, elem: any) => {
return {
...acc,
[elem]: null,
Expand Down
5 changes: 3 additions & 2 deletions src/commands/generate/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ export default class GenerateFunction extends Command {
char: 'n',
hidden: true,
}),
language: Flags.enum({
language: Flags.custom<Language>({
options: languageOptions,
})({
description: messages.getMessage('flags.language.summary'),
char: 'l',
required: true,
Expand All @@ -70,7 +71,7 @@ export default class GenerateFunction extends Command {
this.warn(messages.getMessage('flags.name.deprecation'));
}

const { name, path, language, welcomeText } = await generateFunction(fnName, flags.language as Language);
const { name, path, language, welcomeText } = await generateFunction(fnName, flags.language);
this.log(`Created ${language} function ${herokuColor.green(name)} in ${herokuColor.green(path)}.`);
if (welcomeText) {
this.log('');
Expand Down
6 changes: 4 additions & 2 deletions src/commands/run/function/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as path from 'path';
import { Messages } from '@salesforce/core';
import { Flags } from '@oclif/core';

import { Language } from '@heroku/functions-core';
import Local, { languageOptions } from './start/local';

Messages.importMessagesDirectory(__dirname);
Expand Down Expand Up @@ -43,9 +44,10 @@ export default class Start extends Local {
multiple: true,
hidden: true,
}),
language: Flags.enum({
description: messages.getMessage('flags.language.summary'),
language: Flags.custom<Language | 'auto'>({
options: languageOptions,
})({
description: messages.getMessage('flags.language.summary'),
char: 'l',
default: 'auto',
}),
Expand Down
5 changes: 3 additions & 2 deletions src/commands/run/function/start/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import * as path from 'path';
import * as process from 'process';
import { Command, Flags } from '@oclif/core';
import { LocalRun } from '@heroku/functions-core';
import { Language, LocalRun } from '@heroku/functions-core';
import { Messages } from '@salesforce/core';
import { LangRunnerOpts } from '@heroku/functions-core/dist/lang-runner';

Expand Down Expand Up @@ -40,8 +40,9 @@ export default class Local extends Command {
description: messages.getMessage('flags.debug-port.summary'),
default: 9229,
}),
language: Flags.enum({
language: Flags.custom<Language | 'auto'>({
options: languageOptions,
})({
description: messages.getMessage('flags.language.summary'),
char: 'l',
default: 'auto',
Expand Down
13 changes: 7 additions & 6 deletions src/lib/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { Flags, Errors, Interfaces } from '@oclif/core';
import { Flags, Errors } from '@oclif/core';
import { cli } from 'cli-ux';
import { Messages } from '@salesforce/core';
import { FlagInput } from '@oclif/core/lib/interfaces/parser';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-functions', 'lib.flags');

export const FunctionsFlagBuilder = {
environment: Flags.build({
environment: Flags.custom<string>({
char: 'e',
description: messages.getMessage('flags.target-compute.summary'),
required: false,
}),

connectedOrg: Flags.build({
connectedOrg: Flags.custom<string>({
char: 'o',
description: messages.getMessage('flags.connectedOrg.summary'),
required: false,
}),

keyValueFlag: Flags.build({
keyValueFlag: Flags.custom({
description: messages.getMessage('flags.keyValueFlag.summary'),
async parse(input) {
const [key, ...rest] = input.split('=');
Expand Down Expand Up @@ -58,11 +59,11 @@ export const waitFlag = Flags.boolean({
description: messages.getMessage('flags.waitFlag.summary'),
});

export const FunctionsTableFlags: Interfaces.FlagInput<any> = {
export const FunctionsTableFlags: FlagInput<any> = {
// only let supertable alternatively
// output in json & csv for now
// Cast until cli-us uses oclif/core
...(cli.table.flags({ except: ['csv', 'output'] }) as unknown as Interfaces.FlagInput<any>),
...(cli.table.flags({ except: ['csv', 'output'] }) as unknown as FlagInput<any>),
output: Flags.string({
exclusive: ['no-truncate', 'csv'],
description: messages.getMessage('flags.FunctionsTableFlags.summary'),
Expand Down
Loading