@fromeroc9/testform 1.0.3 → 1.0.5
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/action/index.js +1 -1
- package/dist/action.js +60 -0
- package/dist/adapters/github.js +467 -0
- package/dist/adapters/resources.js +363 -0
- package/dist/cli/index.js +3 -3
- package/dist/commands/apply.js +390 -0
- package/dist/commands/destroy.js +85 -0
- package/dist/commands/diff.js +131 -0
- package/dist/commands/fmt.js +166 -0
- package/dist/commands/force-unlock.js +55 -0
- package/dist/commands/generate.js +143 -0
- package/dist/commands/graph.js +159 -0
- package/dist/commands/import.js +222 -0
- package/dist/commands/init.js +167 -0
- package/dist/commands/login.js +71 -0
- package/dist/commands/logout.js +20 -0
- package/dist/commands/plan.js +250 -0
- package/dist/commands/refresh.js +165 -0
- package/dist/commands/report.js +724 -0
- package/dist/commands/show.js +61 -0
- package/dist/commands/state.js +197 -0
- package/dist/commands/taint.js +49 -0
- package/dist/commands/validate.js +128 -0
- package/dist/commands/workspace.js +102 -0
- package/dist/const.js +105 -0
- package/dist/core/backends/azurerm.js +201 -0
- package/dist/core/backends/backend.js +2 -0
- package/dist/core/backends/gcs.js +200 -0
- package/dist/core/backends/local.js +162 -0
- package/dist/core/backends/s3.js +224 -0
- package/dist/core/command-context.js +59 -0
- package/dist/core/config.js +131 -0
- package/dist/core/credentials.js +53 -0
- package/dist/core/parser.js +62 -0
- package/dist/core/parsers/base-parser.js +215 -0
- package/dist/core/parsers/testcase-parser.js +115 -0
- package/dist/core/parsers/testplan-parser.js +41 -0
- package/dist/core/parsers/testrun-parser.js +43 -0
- package/dist/core/policy.js +341 -0
- package/dist/core/prompt.js +109 -0
- package/dist/core/state.js +185 -0
- package/dist/core/utils.js +94 -0
- package/dist/core/variables.js +108 -0
- package/dist/core/workspace.js +56 -0
- package/dist/help.js +797 -0
- package/dist/index.js +650 -0
- package/dist/logger.js +134 -0
- package/dist/notify.js +36 -0
- package/dist/types.js +2 -0
- package/package.json +1 -1
package/dist/logger.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logger = exports.Logger = void 0;
|
|
4
|
+
const chalk_1 = require("chalk");
|
|
5
|
+
class Logger {
|
|
6
|
+
verbose = false;
|
|
7
|
+
isJson = false;
|
|
8
|
+
constructor(verbose = false, isJson = false) {
|
|
9
|
+
this.verbose = verbose;
|
|
10
|
+
this.isJson = isJson;
|
|
11
|
+
}
|
|
12
|
+
applyStyle(text, options) {
|
|
13
|
+
let styled = text;
|
|
14
|
+
if (options?.bold)
|
|
15
|
+
styled = (0, chalk_1.bold)(styled);
|
|
16
|
+
if (options?.dim)
|
|
17
|
+
styled = (0, chalk_1.dim)(styled);
|
|
18
|
+
return styled;
|
|
19
|
+
}
|
|
20
|
+
emitJson(level, message, data) {
|
|
21
|
+
const payload = {
|
|
22
|
+
"@level": level,
|
|
23
|
+
"@message": message,
|
|
24
|
+
"@module": "testform.ui",
|
|
25
|
+
"@timestamp": new Date().toISOString(),
|
|
26
|
+
"type": "log"
|
|
27
|
+
};
|
|
28
|
+
if (data) {
|
|
29
|
+
payload.data = data;
|
|
30
|
+
}
|
|
31
|
+
console.log(JSON.stringify(payload));
|
|
32
|
+
}
|
|
33
|
+
formatMessage(message) {
|
|
34
|
+
return Array.isArray(message) ? message.join('\n') : message;
|
|
35
|
+
}
|
|
36
|
+
debug(message, options) {
|
|
37
|
+
if (!this.verbose)
|
|
38
|
+
return;
|
|
39
|
+
const msgStr = this.formatMessage(message);
|
|
40
|
+
if (this.isJson) {
|
|
41
|
+
this.emitJson("debug", msgStr, options?.data);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const showPrefix = options?.prefix !== false;
|
|
45
|
+
const prefix = showPrefix ? (0, chalk_1.dim)(`[DEBUG] `) : '';
|
|
46
|
+
const styledMsg = this.applyStyle(msgStr, options);
|
|
47
|
+
console.log(`${prefix}${(0, chalk_1.gray)(styledMsg)}`);
|
|
48
|
+
if (options?.data)
|
|
49
|
+
console.log((0, chalk_1.gray)(JSON.stringify(options.data, null, 2)));
|
|
50
|
+
}
|
|
51
|
+
info(message, options) {
|
|
52
|
+
const msgStr = this.formatMessage(message);
|
|
53
|
+
if (this.isJson) {
|
|
54
|
+
this.emitJson("info", msgStr, options?.data);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const showPrefix = options?.prefix === true; // No prefix by default
|
|
58
|
+
const prefix = showPrefix ? (0, chalk_1.cyan)(`[INFO] `) : '';
|
|
59
|
+
const styledMsg = this.applyStyle(msgStr, options);
|
|
60
|
+
console.log(`${prefix}${styledMsg}`);
|
|
61
|
+
if (options?.data && this.verbose)
|
|
62
|
+
console.log((0, chalk_1.gray)(JSON.stringify(options.data, null, 2)));
|
|
63
|
+
}
|
|
64
|
+
success(message, options) {
|
|
65
|
+
const msgStr = this.formatMessage(message);
|
|
66
|
+
if (this.isJson) {
|
|
67
|
+
this.emitJson("info", msgStr, options?.data);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const showPrefix = options?.prefix === true; // No prefix by default
|
|
71
|
+
const prefix = showPrefix ? (0, chalk_1.green)(`[✓] `) : '';
|
|
72
|
+
const styledMsg = this.applyStyle((0, chalk_1.green)(msgStr), options);
|
|
73
|
+
console.log(`${prefix}${styledMsg}`);
|
|
74
|
+
if (options?.data && this.verbose)
|
|
75
|
+
console.log((0, chalk_1.gray)(JSON.stringify(options.data, null, 2)));
|
|
76
|
+
}
|
|
77
|
+
warn(message, options) {
|
|
78
|
+
const msgStr = this.formatMessage(message);
|
|
79
|
+
if (this.isJson) {
|
|
80
|
+
this.emitJson("warn", msgStr, options?.data);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
console.error((0, chalk_1.yellow)('╷'));
|
|
84
|
+
const prefix = (0, chalk_1.bold)((0, chalk_1.yellow)('Warning:'));
|
|
85
|
+
const styledMsg = this.applyStyle(msgStr, options);
|
|
86
|
+
console.error(`${(0, chalk_1.yellow)('│')} ${prefix} ${styledMsg}`);
|
|
87
|
+
if (options?.data && this.verbose) {
|
|
88
|
+
console.error((0, chalk_1.yellow)('│'));
|
|
89
|
+
const dataStr = JSON.stringify(options.data, null, 2);
|
|
90
|
+
dataStr.split('\n').forEach(line => console.error(`${(0, chalk_1.yellow)('│')} ${line}`));
|
|
91
|
+
}
|
|
92
|
+
console.error((0, chalk_1.yellow)('╵'));
|
|
93
|
+
}
|
|
94
|
+
error(message, error) {
|
|
95
|
+
const msgStr = this.formatMessage(message);
|
|
96
|
+
if (this.isJson) {
|
|
97
|
+
this.emitJson("error", msgStr, error ? (error instanceof Error ? error.stack : error) : undefined);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
console.error((0, chalk_1.red)('╷'));
|
|
102
|
+
const prefix = (0, chalk_1.bold)((0, chalk_1.red)('Error:'));
|
|
103
|
+
const lines = msgStr.split('\n');
|
|
104
|
+
console.error(`${(0, chalk_1.red)('│')} ${prefix} ${(0, chalk_1.bold)(lines[0])}`);
|
|
105
|
+
for (let i = 1; i < lines.length; i++) {
|
|
106
|
+
console.error(`${(0, chalk_1.red)('│')} ${lines[i]}`);
|
|
107
|
+
}
|
|
108
|
+
if (error) {
|
|
109
|
+
console.error((0, chalk_1.red)('│'));
|
|
110
|
+
if (error instanceof Error) {
|
|
111
|
+
console.error(`${(0, chalk_1.red)('│')} ${error.message}`);
|
|
112
|
+
if (this.verbose && error.stack) {
|
|
113
|
+
error.stack.split('\n').forEach(line => console.error(`${(0, chalk_1.red)('│')} ${(0, chalk_1.dim)(line)}`));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else if (typeof error === 'object') {
|
|
117
|
+
const str = JSON.stringify(error, null, 2);
|
|
118
|
+
str.split('\n').forEach(line => console.error(`${(0, chalk_1.red)('│')} ${line}`));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.error(`${(0, chalk_1.red)('│')} ${String(error)}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
console.error((0, chalk_1.red)('╵'));
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
blank() {
|
|
128
|
+
if (this.isJson)
|
|
129
|
+
return;
|
|
130
|
+
console.log('');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.Logger = Logger;
|
|
134
|
+
exports.logger = new Logger();
|
package/dist/notify.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notify = void 0;
|
|
4
|
+
const chalk_1 = require("chalk");
|
|
5
|
+
class Notify {
|
|
6
|
+
push(options) {
|
|
7
|
+
const isWarning = options.type === 'warning';
|
|
8
|
+
const prefix = isWarning ? (0, chalk_1.bold)((0, chalk_1.yellow)('Warning:')) : (0, chalk_1.bold)((0, chalk_1.red)('Error:'));
|
|
9
|
+
const lineColor = isWarning ? chalk_1.yellow : chalk_1.red;
|
|
10
|
+
const title = (0, chalk_1.bold)(options.title);
|
|
11
|
+
const close = options.close ?? false;
|
|
12
|
+
console.log(lineColor('╷'));
|
|
13
|
+
console.log(`${lineColor('│')} ${prefix} ${title}`);
|
|
14
|
+
console.log(lineColor('│'));
|
|
15
|
+
if (options.detail) {
|
|
16
|
+
const detailLines = options.detail;
|
|
17
|
+
for (const line of detailLines) {
|
|
18
|
+
console.log(`${lineColor('│')} ${line}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (options.extra) {
|
|
22
|
+
const extraLines = options.extra;
|
|
23
|
+
for (const line of extraLines) {
|
|
24
|
+
console.log(`${lineColor('│')} ${line}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
console.log(lineColor('╵'));
|
|
28
|
+
if (close)
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
refresh(resourceId, remoteId) {
|
|
32
|
+
const state = remoteId ? (0, chalk_1.dim)(`[id=${remoteId}]`) : '';
|
|
33
|
+
console.log(`${(0, chalk_1.cyan)(resourceId)}: Refreshing state... ${state}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.notify = new Notify();
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fromeroc9/testform",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Testform transforms standard issue trackers into full-fledged Test Management ecosystems using declarative Gherkin configurations that can be shared, reviewed, and versioned as code.",
|
|
5
5
|
"author": "Flavio Romero <flavio.arc9@gmail.com>",
|
|
6
6
|
"main": "dist/cli/index.js",
|