@player-tools/cli 0.9.0-next.1 → 0.9.0-next.3
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/dist/commands/dependency-versions/check.d.ts +1 -0
- package/dist/commands/dsl/compile.d.ts +1 -0
- package/dist/commands/dsl/compile.js +7 -2
- package/dist/commands/dsl/validate.d.ts +1 -0
- package/dist/commands/json/validate.d.ts +2 -0
- package/dist/commands/json/validate.js +19 -8
- package/dist/commands/xlr/compile.d.ts +1 -0
- package/dist/commands/xlr/convert.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/base-command.d.ts +1 -0
- package/dist/utils/base-command.js +7 -0
- package/dist/utils/diag-renderer.d.ts +5 -2
- package/dist/utils/diag-renderer.js +54 -19
- package/dist/utils/log-levels.d.ts +11 -0
- package/dist/utils/log-levels.js +21 -0
- package/dist/utils/task-runner.d.ts +8 -1
- package/dist/utils/task-runner.js +3 -2
- package/package.json +7 -8
|
@@ -8,6 +8,7 @@ export default class DependencyVersionsCheck extends BaseCommand {
|
|
|
8
8
|
path: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
ignore: import("@oclif/core/lib/interfaces").OptionFlag<string[]>;
|
|
10
10
|
config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
11
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
11
12
|
};
|
|
12
13
|
private getOptions;
|
|
13
14
|
run(): Promise<{
|
|
@@ -9,6 +9,7 @@ export default class DSLCompile extends BaseCommand {
|
|
|
9
9
|
exp: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
severity: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
11
11
|
config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
12
13
|
};
|
|
13
14
|
private getOptions;
|
|
14
15
|
run(): Promise<{
|
|
@@ -37,7 +37,7 @@ class DSLCompile extends base_command_1.BaseCommand {
|
|
|
37
37
|
}),
|
|
38
38
|
severity: core_1.Flags.string({
|
|
39
39
|
char: "s",
|
|
40
|
-
description: "The severity of
|
|
40
|
+
description: "The severity of validation issues",
|
|
41
41
|
options: ["error", "warn"],
|
|
42
42
|
default: "error",
|
|
43
43
|
}),
|
|
@@ -56,10 +56,11 @@ class DSLCompile extends base_command_1.BaseCommand {
|
|
|
56
56
|
skipValidation: flags["skip-validation"] ?? config.dsl?.skipValidation ?? false,
|
|
57
57
|
exp,
|
|
58
58
|
severity: flags.severity,
|
|
59
|
+
loglevel: flags.loglevel
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
async run() {
|
|
62
|
-
const { input, output, skipValidation, exp, severity } = await this.getOptions();
|
|
63
|
+
const { input, output, skipValidation, exp, severity, loglevel } = await this.getOptions();
|
|
63
64
|
const files = await (0, globby_1.default)((0, fs_2.convertToFileGlob)([input], "**/*.(tsx|jsx|js|ts)"), {
|
|
64
65
|
expandDirectories: true,
|
|
65
66
|
});
|
|
@@ -148,6 +149,10 @@ class DSLCompile extends base_command_1.BaseCommand {
|
|
|
148
149
|
return result.output?.outputFile ?? "";
|
|
149
150
|
}),
|
|
150
151
|
...(exp ? ["--exp"] : []),
|
|
152
|
+
"-s",
|
|
153
|
+
severity,
|
|
154
|
+
"-v",
|
|
155
|
+
loglevel,
|
|
151
156
|
]);
|
|
152
157
|
}
|
|
153
158
|
else {
|
|
@@ -6,6 +6,7 @@ export default class Validate extends BaseCommand {
|
|
|
6
6
|
files: import("@oclif/core/lib/interfaces").OptionFlag<string[]>;
|
|
7
7
|
severity: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
8
|
config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
9
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
9
10
|
};
|
|
10
11
|
private getOptions;
|
|
11
12
|
private getTSConfig;
|
|
@@ -5,7 +5,9 @@ export default class Validate extends BaseCommand {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
files: import("@oclif/core/lib/interfaces").OptionFlag<string[]>;
|
|
7
7
|
exp: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
severity: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
9
|
config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
9
11
|
};
|
|
10
12
|
private getOptions;
|
|
11
13
|
run(): Promise<{
|
|
@@ -10,6 +10,7 @@ const base_command_1 = require("../../utils/base-command");
|
|
|
10
10
|
const diag_renderer_1 = require("../../utils/diag-renderer");
|
|
11
11
|
const fs_2 = require("../../utils/fs");
|
|
12
12
|
const task_runner_1 = require("../../utils/task-runner");
|
|
13
|
+
const log_levels_1 = require("../../utils/log-levels");
|
|
13
14
|
/** A command to validate JSON content */
|
|
14
15
|
class Validate extends base_command_1.BaseCommand {
|
|
15
16
|
static description = "Validate Player JSON content";
|
|
@@ -24,6 +25,12 @@ class Validate extends base_command_1.BaseCommand {
|
|
|
24
25
|
description: "Use experimental language features",
|
|
25
26
|
default: false,
|
|
26
27
|
}),
|
|
28
|
+
severity: core_1.Flags.string({
|
|
29
|
+
char: "s",
|
|
30
|
+
description: "The severity of validation issues",
|
|
31
|
+
options: ["error", "warn"],
|
|
32
|
+
default: "error",
|
|
33
|
+
}),
|
|
27
34
|
};
|
|
28
35
|
async getOptions() {
|
|
29
36
|
const { flags } = await this.parse(Validate);
|
|
@@ -36,10 +43,12 @@ class Validate extends base_command_1.BaseCommand {
|
|
|
36
43
|
return {
|
|
37
44
|
files: Array.isArray(files) ? files : [files],
|
|
38
45
|
exp,
|
|
46
|
+
severity: flags.severity,
|
|
47
|
+
loglevel: flags.loglevel
|
|
39
48
|
};
|
|
40
49
|
}
|
|
41
50
|
async run() {
|
|
42
|
-
const { files: inputFiles, exp } = await this.getOptions();
|
|
51
|
+
const { files: inputFiles, exp, severity, loglevel } = await this.getOptions();
|
|
43
52
|
const expandedFilesList = (0, fs_2.convertToFileGlob)(inputFiles, "**/*.json");
|
|
44
53
|
this.debug("Searching for files using: %o", expandedFilesList);
|
|
45
54
|
const files = await (0, globby_1.default)(expandedFilesList, {
|
|
@@ -58,19 +67,21 @@ class Validate extends base_command_1.BaseCommand {
|
|
|
58
67
|
},
|
|
59
68
|
run: async () => {
|
|
60
69
|
const contents = await fs_1.promises.readFile(f, "utf-8");
|
|
61
|
-
const lsp = await this.createLanguageService(exp);
|
|
62
70
|
const validations = (await lsp.validateTextDocument(vscode_languageserver_textdocument_1.TextDocument.create(`file://${f}`, "json", 1, contents))) ?? [];
|
|
63
71
|
return validations;
|
|
64
72
|
},
|
|
65
73
|
})),
|
|
74
|
+
loglevel: (0, log_levels_1.stringToLogLevel)(loglevel)
|
|
66
75
|
});
|
|
67
76
|
const taskResults = await taskRunner.run();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
t.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
if (severity !== "error") {
|
|
78
|
+
taskResults.forEach((t) => {
|
|
79
|
+
if (t.error ||
|
|
80
|
+
t.output.some((d) => d.severity === vscode_languageserver_types_1.DiagnosticSeverity.Error)) {
|
|
81
|
+
results.exitCode = 100;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
74
85
|
this.debug("finished");
|
|
75
86
|
this.exit(results.exitCode);
|
|
76
87
|
return results;
|
|
@@ -9,6 +9,7 @@ export default class XLRCompile extends BaseCommand {
|
|
|
9
9
|
output: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
10
10
|
mode: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
11
11
|
config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
12
13
|
};
|
|
13
14
|
private getOptions;
|
|
14
15
|
run(): Promise<{
|
|
@@ -9,6 +9,7 @@ export default class XLRConvert extends BaseCommand {
|
|
|
9
9
|
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
10
|
lang: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
11
11
|
config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
12
13
|
};
|
|
13
14
|
private getOptions;
|
|
14
15
|
run(): Promise<{
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,4 +8,5 @@ tslib_1.__exportStar(require("./config"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./plugins"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./utils/base-command"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./utils/compilation-context"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./utils/log-levels"), exports);
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -9,6 +9,7 @@ import { CompilationContext } from "./compilation-context";
|
|
|
9
9
|
export declare abstract class BaseCommand extends Command {
|
|
10
10
|
static flags: {
|
|
11
11
|
config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
12
13
|
};
|
|
13
14
|
static strict: boolean;
|
|
14
15
|
private resolvedConfig;
|
|
@@ -8,6 +8,7 @@ const cosmiconfig_1 = require("cosmiconfig");
|
|
|
8
8
|
const json_language_service_1 = require("@player-tools/json-language-service");
|
|
9
9
|
const dsl_1 = require("@player-tools/dsl");
|
|
10
10
|
const compilation_context_1 = require("./compilation-context");
|
|
11
|
+
const log_levels_1 = require("./log-levels");
|
|
11
12
|
const configLoader = (0, cosmiconfig_1.cosmiconfig)("player");
|
|
12
13
|
/** The common configs for all */
|
|
13
14
|
class BaseCommand extends core_1.Command {
|
|
@@ -16,6 +17,12 @@ class BaseCommand extends core_1.Command {
|
|
|
16
17
|
description: "Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load",
|
|
17
18
|
char: "c",
|
|
18
19
|
}),
|
|
20
|
+
loglevel: core_1.Flags.string({
|
|
21
|
+
char: "v",
|
|
22
|
+
description: "How verbose logs should be",
|
|
23
|
+
options: log_levels_1.LogLevels,
|
|
24
|
+
default: "warn",
|
|
25
|
+
}),
|
|
19
26
|
};
|
|
20
27
|
static strict = false;
|
|
21
28
|
resolvedConfig;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Diagnostic } from "vscode-languageserver-types";
|
|
2
|
+
import { DiagnosticSeverity } from "vscode-languageserver-types";
|
|
2
3
|
import type { Task, TaskProgressRenderer } from "./task-runner";
|
|
3
4
|
/** Get the lines representing the summary of the results */
|
|
4
5
|
export declare function getSummary({ errors, warnings, skipped, fileCount, duration, }: {
|
|
@@ -14,10 +15,12 @@ export declare function getSummary({ errors, warnings, skipped, fileCount, durat
|
|
|
14
15
|
duration: number | undefined;
|
|
15
16
|
}): string;
|
|
16
17
|
/** Format the results for printing on the console */
|
|
17
|
-
export declare function formatDiagnosticResults(filePath: string, results: Diagnostic[],
|
|
18
|
+
export declare function formatDiagnosticResults(filePath: string, results: Diagnostic[], loglevel: DiagnosticSeverity): {
|
|
18
19
|
lines: string[];
|
|
19
20
|
errors: number;
|
|
20
21
|
warnings: number;
|
|
22
|
+
info: number;
|
|
23
|
+
trace: number;
|
|
21
24
|
};
|
|
22
25
|
/** Get the symbol for a given task */
|
|
23
26
|
export declare const getTaskSymbol: (task: Task<any, any>) => string;
|
|
@@ -59,9 +59,22 @@ function getSummary({ errors, warnings, skipped, fileCount, duration, }) {
|
|
|
59
59
|
}
|
|
60
60
|
/** Format a diag for printing on the console */
|
|
61
61
|
function formatDiagnostic(diag, longestLine, fName) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
let type;
|
|
63
|
+
if (diag.severity === vscode_languageserver_types_1.DiagnosticSeverity.Error) {
|
|
64
|
+
type = chalk_1.default.red(`${log_symbols_1.default.error} `);
|
|
65
|
+
}
|
|
66
|
+
else if (diag.severity === vscode_languageserver_types_1.DiagnosticSeverity.Warning) {
|
|
67
|
+
type = chalk_1.default.yellow(`${log_symbols_1.default.warning} `);
|
|
68
|
+
}
|
|
69
|
+
else if (diag.severity === vscode_languageserver_types_1.DiagnosticSeverity.Information) {
|
|
70
|
+
type = chalk_1.default.blue(`${log_symbols_1.default.info} `);
|
|
71
|
+
}
|
|
72
|
+
else if (diag.severity === vscode_languageserver_types_1.DiagnosticSeverity.Hint) {
|
|
73
|
+
type = chalk_1.default.gray(`${log_symbols_1.default.info} `);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
type = chalk_1.default.green(`${log_symbols_1.default.info} `);
|
|
77
|
+
}
|
|
65
78
|
const msg = chalk_1.default.bold(diag.message);
|
|
66
79
|
const range = getLineRange(diag.range);
|
|
67
80
|
return [
|
|
@@ -72,10 +85,12 @@ function formatDiagnostic(diag, longestLine, fName) {
|
|
|
72
85
|
].join(" ");
|
|
73
86
|
}
|
|
74
87
|
/** Format the results for printing on the console */
|
|
75
|
-
function formatDiagnosticResults(filePath, results,
|
|
88
|
+
function formatDiagnosticResults(filePath, results, loglevel) {
|
|
76
89
|
const count = {
|
|
77
90
|
errors: 0,
|
|
78
91
|
warnings: 0,
|
|
92
|
+
info: 0,
|
|
93
|
+
trace: 0
|
|
79
94
|
};
|
|
80
95
|
const linePrefix = " ";
|
|
81
96
|
const longestLine = Math.max(...results.map((r) => getLineRange(r.range).length));
|
|
@@ -87,7 +102,13 @@ function formatDiagnosticResults(filePath, results, verbose = false) {
|
|
|
87
102
|
else if (diag.severity === vscode_languageserver_types_1.DiagnosticSeverity.Warning) {
|
|
88
103
|
count.warnings += 1;
|
|
89
104
|
}
|
|
90
|
-
if (diag.severity === vscode_languageserver_types_1.DiagnosticSeverity.
|
|
105
|
+
else if (diag.severity === vscode_languageserver_types_1.DiagnosticSeverity.Information) {
|
|
106
|
+
count.info += 1;
|
|
107
|
+
}
|
|
108
|
+
else if (diag.severity === vscode_languageserver_types_1.DiagnosticSeverity.Hint) {
|
|
109
|
+
count.trace += 1;
|
|
110
|
+
}
|
|
111
|
+
if (diag.severity && loglevel >= diag.severity) {
|
|
91
112
|
return linePrefix + formatDiagnostic(diag, longestLine + 1, filePath);
|
|
92
113
|
}
|
|
93
114
|
return "";
|
|
@@ -96,18 +117,32 @@ function formatDiagnosticResults(filePath, results, verbose = false) {
|
|
|
96
117
|
if (count.errors > 0) {
|
|
97
118
|
lines = ["", `${chalk_1.default.red(log_symbols_1.default.error)} ${filePath}`, ...lines, ""];
|
|
98
119
|
}
|
|
99
|
-
else if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
120
|
+
else if (count.warnings > 0 && loglevel >= vscode_languageserver_types_1.DiagnosticSeverity.Warning) {
|
|
121
|
+
lines = [
|
|
122
|
+
"",
|
|
123
|
+
`${chalk_1.default.yellow(log_symbols_1.default.warning)} ${filePath}`,
|
|
124
|
+
...lines,
|
|
125
|
+
"",
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
else if (count.info > 0 && loglevel >= vscode_languageserver_types_1.DiagnosticSeverity.Information) {
|
|
129
|
+
lines = [
|
|
130
|
+
"",
|
|
131
|
+
`${chalk_1.default.blue(log_symbols_1.default.info)} ${filePath}`,
|
|
132
|
+
...lines,
|
|
133
|
+
"",
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
else if (count.trace > 0 && loglevel >= vscode_languageserver_types_1.DiagnosticSeverity.Hint) {
|
|
137
|
+
lines = [
|
|
138
|
+
"",
|
|
139
|
+
`${chalk_1.default.gray(log_symbols_1.default.info)} ${filePath}`,
|
|
140
|
+
...lines,
|
|
141
|
+
"",
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
lines = [`${chalk_1.default.green(log_symbols_1.default.success)} ${filePath}`, ...lines];
|
|
111
146
|
}
|
|
112
147
|
return {
|
|
113
148
|
...count,
|
|
@@ -137,7 +172,7 @@ exports.validationRenderer = {
|
|
|
137
172
|
const output = ["Validating content"];
|
|
138
173
|
tasks.forEach((task) => {
|
|
139
174
|
if (task.state === "completed" && task.output) {
|
|
140
|
-
const formattedDiags = formatDiagnosticResults(task.data?.file ? (0, fs_1.normalizePath)(task.data.file) : "", sortDiagnostics(task.output),
|
|
175
|
+
const formattedDiags = formatDiagnosticResults(task.data?.file ? (0, fs_1.normalizePath)(task.data.file) : "", sortDiagnostics(task.output), ctx.loglevel);
|
|
141
176
|
output.push(...formattedDiags.lines);
|
|
142
177
|
}
|
|
143
178
|
else {
|
|
@@ -156,7 +191,7 @@ exports.validationRenderer = {
|
|
|
156
191
|
};
|
|
157
192
|
ctx.tasks.forEach((t) => {
|
|
158
193
|
if (t.state === "completed" && t.output) {
|
|
159
|
-
const formattedDiags = formatDiagnosticResults(t.data?.file ?? "", t.output,
|
|
194
|
+
const formattedDiags = formatDiagnosticResults(t.data?.file ?? "", t.output, ctx.loglevel);
|
|
160
195
|
count.errors += formattedDiags.errors;
|
|
161
196
|
count.warnings += formattedDiags.warnings;
|
|
162
197
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DiagnosticSeverity } from "vscode-languageserver-types";
|
|
2
|
+
export declare const LogLevelsMap: {
|
|
3
|
+
error: 1;
|
|
4
|
+
warn: 2;
|
|
5
|
+
info: 3;
|
|
6
|
+
trace: 4;
|
|
7
|
+
};
|
|
8
|
+
export type LogLevelsType = keyof typeof LogLevelsMap;
|
|
9
|
+
export declare const LogLevels: string[];
|
|
10
|
+
export declare function stringToLogLevel(level: string): DiagnosticSeverity;
|
|
11
|
+
//# sourceMappingURL=log-levels.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogLevels = exports.LogLevelsMap = void 0;
|
|
4
|
+
exports.stringToLogLevel = stringToLogLevel;
|
|
5
|
+
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
6
|
+
exports.LogLevelsMap = {
|
|
7
|
+
error: vscode_languageserver_types_1.DiagnosticSeverity.Error,
|
|
8
|
+
warn: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
|
9
|
+
info: vscode_languageserver_types_1.DiagnosticSeverity.Information,
|
|
10
|
+
trace: vscode_languageserver_types_1.DiagnosticSeverity.Hint,
|
|
11
|
+
};
|
|
12
|
+
exports.LogLevels = Object.keys(exports.LogLevelsMap);
|
|
13
|
+
function isValidLogLevel(level) {
|
|
14
|
+
return exports.LogLevels.includes(level);
|
|
15
|
+
}
|
|
16
|
+
function stringToLogLevel(level) {
|
|
17
|
+
return isValidLogLevel(level)
|
|
18
|
+
? exports.LogLevelsMap[level]
|
|
19
|
+
: vscode_languageserver_types_1.DiagnosticSeverity.Warning;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=log-levels.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DiagnosticSeverity } from "vscode-languageserver-types";
|
|
1
2
|
interface BaseTask<Results, Data> {
|
|
2
3
|
/** The state of the task */
|
|
3
4
|
state: "idle" | "pending";
|
|
@@ -26,6 +27,8 @@ export interface TaskProgressRenderer<ResultType, Data = unknown> {
|
|
|
26
27
|
onUpdate: (ctx: {
|
|
27
28
|
/** The tasks that are running */
|
|
28
29
|
tasks: Array<Task<ResultType, Data>>;
|
|
30
|
+
/** What level of information to log */
|
|
31
|
+
loglevel: DiagnosticSeverity;
|
|
29
32
|
}) => string;
|
|
30
33
|
/** Called for a summary */
|
|
31
34
|
onEnd: (ctx: {
|
|
@@ -33,6 +36,8 @@ export interface TaskProgressRenderer<ResultType, Data = unknown> {
|
|
|
33
36
|
tasks: Array<CompletedTask<ResultType, Data>>;
|
|
34
37
|
/** Number of ms it took to run */
|
|
35
38
|
duration: number;
|
|
39
|
+
/** What level of information to log */
|
|
40
|
+
loglevel: DiagnosticSeverity;
|
|
36
41
|
}) => string;
|
|
37
42
|
}
|
|
38
43
|
interface TaskRunner<R, Data> {
|
|
@@ -42,11 +47,13 @@ interface TaskRunner<R, Data> {
|
|
|
42
47
|
run: () => Promise<Array<CompletedTask<R, Data>>>;
|
|
43
48
|
}
|
|
44
49
|
/** Create a runner to kick off tasks in parallel */
|
|
45
|
-
export declare const createTaskRunner: <R, D>({ tasks, renderer, }: {
|
|
50
|
+
export declare const createTaskRunner: <R, D>({ tasks, renderer, loglevel, }: {
|
|
46
51
|
/** A list of tasks to run */
|
|
47
52
|
tasks: Array<Pick<BaseTask<R, D>, "data" | "run">>;
|
|
48
53
|
/** How to report progress */
|
|
49
54
|
renderer: TaskProgressRenderer<R, D>;
|
|
55
|
+
/** What level of logs to write */
|
|
56
|
+
loglevel: DiagnosticSeverity;
|
|
50
57
|
}) => TaskRunner<R, D>;
|
|
51
58
|
export {};
|
|
52
59
|
//# sourceMappingURL=task-runner.d.ts.map
|
|
@@ -4,7 +4,7 @@ exports.createTaskRunner = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const log_update_1 = tslib_1.__importDefault(require("log-update"));
|
|
6
6
|
/** Create a runner to kick off tasks in parallel */
|
|
7
|
-
const createTaskRunner = ({ tasks, renderer, }) => {
|
|
7
|
+
const createTaskRunner = ({ tasks, renderer, loglevel, }) => {
|
|
8
8
|
const statefulTasks = tasks.map((t) => {
|
|
9
9
|
return {
|
|
10
10
|
...t,
|
|
@@ -19,7 +19,7 @@ const createTaskRunner = ({ tasks, renderer, }) => {
|
|
|
19
19
|
if (ended) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const output = renderer.onUpdate({ tasks: statefulTasks });
|
|
22
|
+
const output = renderer.onUpdate({ tasks: statefulTasks, loglevel });
|
|
23
23
|
if (process.stdout.isTTY) {
|
|
24
24
|
(0, log_update_1.default)(output);
|
|
25
25
|
}
|
|
@@ -44,6 +44,7 @@ const createTaskRunner = ({ tasks, renderer, }) => {
|
|
|
44
44
|
const output = renderer.onEnd({
|
|
45
45
|
duration,
|
|
46
46
|
tasks: statefulTasks,
|
|
47
|
+
loglevel
|
|
47
48
|
});
|
|
48
49
|
console.log(output);
|
|
49
50
|
log_update_1.default.done();
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
7
7
|
"name": "@player-tools/cli",
|
|
8
|
-
"version": "0.9.0-next.
|
|
8
|
+
"version": "0.9.0-next.3",
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"oclif": {
|
|
@@ -21,19 +21,18 @@
|
|
|
21
21
|
"player": "bin/run"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@player-tools/dsl": "0.9.0-next.
|
|
25
|
-
"@player-tools/json-language-service": "0.9.0-next.
|
|
26
|
-
"@player-tools/xlr": "0.9.0-next.
|
|
27
|
-
"@player-tools/xlr-converters": "0.9.0-next.
|
|
28
|
-
"@player-tools/xlr-sdk": "0.9.0-next.
|
|
29
|
-
"@player-tools/xlr-utils": "0.9.0-next.
|
|
24
|
+
"@player-tools/dsl": "0.9.0-next.3",
|
|
25
|
+
"@player-tools/json-language-service": "0.9.0-next.3",
|
|
26
|
+
"@player-tools/xlr": "0.9.0-next.3",
|
|
27
|
+
"@player-tools/xlr-converters": "0.9.0-next.3",
|
|
28
|
+
"@player-tools/xlr-sdk": "0.9.0-next.3",
|
|
29
|
+
"@player-tools/xlr-utils": "0.9.0-next.3",
|
|
30
30
|
"@babel/plugin-transform-react-jsx-source": "^7.23.3",
|
|
31
31
|
"@babel/preset-env": "^7.23.3",
|
|
32
32
|
"@babel/preset-react": "^7.23.3",
|
|
33
33
|
"@babel/preset-typescript": "^7.23.3",
|
|
34
34
|
"@babel/register": "^7.23.3",
|
|
35
35
|
"@oclif/core": "1.9.0",
|
|
36
|
-
"@oclif/plugin-legacy": "^1.2.7",
|
|
37
36
|
"@oclif/plugin-plugins": "^1.9.0",
|
|
38
37
|
"chalk": "^4.0.1",
|
|
39
38
|
"cosmiconfig": "^7.0.1",
|