heroku 9.3.0 → 9.3.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/lib/commands/local/run.js +2 -2
- package/lib/commands/run/index.js +2 -3
- package/lib/lib/run/helpers.d.ts +1 -0
- package/lib/lib/run/helpers.js +24 -1
- package/oclif.manifest.json +671 -671
- package/package.json +2 -2
|
@@ -4,13 +4,13 @@ const completions_1 = require("@heroku-cli/command/lib/completions");
|
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const color_1 = require("@heroku-cli/color");
|
|
6
6
|
const fork_foreman_1 = require("../../lib/local/fork-foreman");
|
|
7
|
+
const helpers_1 = require("../../lib/run/helpers");
|
|
7
8
|
const fs = require("fs");
|
|
8
9
|
class Run extends core_1.Command {
|
|
9
10
|
async run() {
|
|
10
11
|
const execArgv = ['run'];
|
|
11
12
|
const { argv, flags } = await this.parse(Run);
|
|
12
|
-
const
|
|
13
|
-
const commandArgs = (maybeOptionsIndex === -1 ? argv : process.argv.slice(maybeOptionsIndex + 1));
|
|
13
|
+
const commandArgs = (0, helpers_1.revertSortedArgs)(process.argv, argv);
|
|
14
14
|
if (commandArgs.length === 0) {
|
|
15
15
|
const errorMessage = 'Usage: heroku local:run [COMMAND]\nMust specify command to run';
|
|
16
16
|
this.error(errorMessage, { exit: -1 });
|
|
@@ -10,14 +10,13 @@ const debug = (0, debug_1.default)('heroku:run');
|
|
|
10
10
|
class Run extends command_1.Command {
|
|
11
11
|
async run() {
|
|
12
12
|
const { argv, flags } = await this.parse(Run);
|
|
13
|
-
const
|
|
14
|
-
const command = (0, helpers_1.buildCommand)((maybeOptionsIndex === -1 ? argv : process.argv.slice(maybeOptionsIndex + 1)));
|
|
13
|
+
const command = (0, helpers_1.revertSortedArgs)(process.argv, argv);
|
|
15
14
|
const opts = {
|
|
16
15
|
'exit-code': flags['exit-code'],
|
|
17
16
|
'no-tty': flags['no-tty'],
|
|
18
17
|
app: flags.app,
|
|
19
18
|
attach: true,
|
|
20
|
-
command,
|
|
19
|
+
command: (0, helpers_1.buildCommand)(command),
|
|
21
20
|
env: flags.env,
|
|
22
21
|
heroku: this.heroku,
|
|
23
22
|
listen: flags.listen,
|
package/lib/lib/run/helpers.d.ts
CHANGED
package/lib/lib/run/helpers.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildEnvFromFlag = exports.buildCommand = void 0;
|
|
3
|
+
exports.buildEnvFromFlag = exports.buildCommand = exports.revertSortedArgs = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
|
+
// this function exists because oclif sorts argv
|
|
7
|
+
// and to capture all non-flag command inputs
|
|
8
|
+
function revertSortedArgs(processArgs, argv) {
|
|
9
|
+
const originalInputOrder = [];
|
|
10
|
+
const flagRegex = /^--?/;
|
|
11
|
+
let isSeparatorPresent = false;
|
|
12
|
+
let argIsFlag = false;
|
|
13
|
+
// this for-loop performs 2 tasks
|
|
14
|
+
// 1. reorders the arguments in the order the user inputted
|
|
15
|
+
// 2. checks that no oclif flags are included in originalInputOrder
|
|
16
|
+
for (const processArg of processArgs) {
|
|
17
|
+
argIsFlag = flagRegex.test(processArg);
|
|
18
|
+
if (processArg === '--') {
|
|
19
|
+
isSeparatorPresent = true;
|
|
20
|
+
}
|
|
21
|
+
if ((argv.includes(processArg) && (!isSeparatorPresent && !argIsFlag)) ||
|
|
22
|
+
(argv.includes(processArg) && (isSeparatorPresent))) {
|
|
23
|
+
originalInputOrder.push(processArg);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return originalInputOrder;
|
|
27
|
+
}
|
|
28
|
+
exports.revertSortedArgs = revertSortedArgs;
|
|
6
29
|
function buildCommand(args) {
|
|
7
30
|
if (args.length === 1) {
|
|
8
31
|
// do not add quotes around arguments if there is only one argument
|