@cedarjs/tui 6.0.0-canary.2739 → 6.0.0-canary.2742
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/index.d.ts +12 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -56
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import stream from 'stream';
|
|
2
2
|
import type { AnsiColors } from 'ansis';
|
|
3
|
-
import
|
|
3
|
+
import Enquirer from 'enquirer';
|
|
4
|
+
declare const enquirerPrompt: typeof Enquirer.prompt;
|
|
4
5
|
/**
|
|
5
6
|
* A default set of styling for the TUI, designed for a cohesive look and feel around the Redwood CLI, CRWA and vairous plugins
|
|
6
7
|
*/
|
|
7
8
|
export declare const RedwoodStyling: {
|
|
8
|
-
error: import("ansis"
|
|
9
|
-
warning: import("ansis"
|
|
10
|
-
success: import("ansis"
|
|
11
|
-
info: import("ansis"
|
|
12
|
-
header: import("ansis"
|
|
13
|
-
cmd: import("ansis"
|
|
14
|
-
redwood: import("ansis"
|
|
15
|
-
love: import("ansis"
|
|
16
|
-
green: import("ansis"
|
|
9
|
+
error: import("ansis").Ansis;
|
|
10
|
+
warning: import("ansis").Ansis;
|
|
11
|
+
success: import("ansis").Ansis;
|
|
12
|
+
info: import("ansis").Ansis;
|
|
13
|
+
header: import("ansis").Ansis;
|
|
14
|
+
cmd: import("ansis").Ansis;
|
|
15
|
+
redwood: import("ansis").Ansis;
|
|
16
|
+
love: import("ansis").Ansis;
|
|
17
|
+
green: import("ansis").Ansis;
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
19
20
|
* An object used to describe a "reactive" TUI element, that is an element that is updated a number of times per second
|
|
@@ -143,4 +144,5 @@ export declare class RedwoodTUI {
|
|
|
143
144
|
*/
|
|
144
145
|
displayWarning(title: string, message: string): void;
|
|
145
146
|
}
|
|
147
|
+
export {};
|
|
146
148
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAG3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAG3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAKvC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAG/B,QAAA,MAAM,cAAc,wBAAkB,CAAA;AAEtC;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;CAY1B,CAAA;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAiB;IAEnC,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAGd;IACD,OAAO,CAAC,aAAa,CAAQ;IAI7B,OAAO,CAAC,YAAY,CAAI;gBAEZ,OAAO,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;QACxB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,EAAE,OAAO,CAAA;YACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;SACtB,CAAA;QACD,SAAS,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAA;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB;IA2CD,MAAM,CAAC,OAAO,EAAE;QACd,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;QACxB,MAAM,CAAC,EA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CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAYhE;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAM3C;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK9C"}
|
package/dist/index.js
CHANGED
|
@@ -1,52 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var index_exports = {};
|
|
30
|
-
__export(index_exports, {
|
|
31
|
-
ReactiveTUIContent: () => ReactiveTUIContent,
|
|
32
|
-
RedwoodStyling: () => RedwoodStyling,
|
|
33
|
-
RedwoodTUI: () => RedwoodTUI
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(index_exports);
|
|
36
|
-
var import_stream = __toESM(require("stream"));
|
|
37
|
-
var import_ansis = __toESM(require("ansis"));
|
|
38
|
-
var import_enquirer = require("enquirer");
|
|
39
|
-
var import_stdout_update = require("stdout-update");
|
|
1
|
+
import stream from "stream";
|
|
2
|
+
import ansis from "ansis";
|
|
3
|
+
import Enquirer from "enquirer";
|
|
4
|
+
import { UpdateManager } from "stdout-update";
|
|
5
|
+
const enquirerPrompt = Enquirer.prompt;
|
|
40
6
|
const RedwoodStyling = {
|
|
41
|
-
error:
|
|
42
|
-
warning:
|
|
43
|
-
success:
|
|
44
|
-
info:
|
|
45
|
-
header:
|
|
46
|
-
cmd:
|
|
47
|
-
redwood:
|
|
48
|
-
love:
|
|
49
|
-
green:
|
|
7
|
+
error: ansis.bold.red,
|
|
8
|
+
warning: ansis.hex("#ffa500"),
|
|
9
|
+
success: ansis.greenBright,
|
|
10
|
+
info: ansis.gray,
|
|
11
|
+
header: ansis.bold.underline.hex("#e8e8e8"),
|
|
12
|
+
cmd: ansis.hex("#808080"),
|
|
13
|
+
redwood: ansis.hex("#ff845e"),
|
|
14
|
+
love: ansis.redBright,
|
|
15
|
+
green: ansis.green
|
|
50
16
|
};
|
|
51
17
|
class ReactiveTUIContent {
|
|
52
18
|
outStream;
|
|
@@ -114,7 +80,7 @@ class ReactiveTUIContent {
|
|
|
114
80
|
}
|
|
115
81
|
}
|
|
116
82
|
setOutStream(out) {
|
|
117
|
-
this.outStream = new
|
|
83
|
+
this.outStream = new stream.Writable({
|
|
118
84
|
write: (chunk, _encoding, next) => {
|
|
119
85
|
if (this.content === "stream") {
|
|
120
86
|
this.content += chunk.toString("utf-8");
|
|
@@ -157,7 +123,7 @@ class RedwoodTUI {
|
|
|
157
123
|
constructor({ out, err } = {}) {
|
|
158
124
|
this.outStream = out || process.stdout;
|
|
159
125
|
this.errStream = err || process.stderr;
|
|
160
|
-
this.manager =
|
|
126
|
+
this.manager = UpdateManager.getInstance(this.outStream, this.errStream);
|
|
161
127
|
process.on("exit", () => {
|
|
162
128
|
this.stopReactive();
|
|
163
129
|
});
|
|
@@ -259,7 +225,7 @@ class RedwoodTUI {
|
|
|
259
225
|
if (wasReactive) {
|
|
260
226
|
this.stopReactive();
|
|
261
227
|
}
|
|
262
|
-
const result = await (
|
|
228
|
+
const result = await enquirerPrompt(questions);
|
|
263
229
|
if (wasReactive) {
|
|
264
230
|
this.startReactive();
|
|
265
231
|
}
|
|
@@ -273,10 +239,10 @@ class RedwoodTUI {
|
|
|
273
239
|
drawFencedText(color, title, message) {
|
|
274
240
|
const width = Math.min(80, (this.outStream.columns || 80) - 2);
|
|
275
241
|
const headerText = `\u2500\u2500\u2500\u2500 ${title} `;
|
|
276
|
-
const header =
|
|
242
|
+
const header = ansis[color](
|
|
277
243
|
headerText + "\u2500".repeat(Math.max(0, width - headerText.length))
|
|
278
244
|
);
|
|
279
|
-
const line =
|
|
245
|
+
const line = ansis[color]("\u2500".repeat(width));
|
|
280
246
|
this.outStream.write(`
|
|
281
247
|
${header}
|
|
282
248
|
${line}
|
|
@@ -307,9 +273,8 @@ ${line}
|
|
|
307
273
|
this.drawFencedText("yellow", headerText, message);
|
|
308
274
|
}
|
|
309
275
|
}
|
|
310
|
-
|
|
311
|
-
0 && (module.exports = {
|
|
276
|
+
export {
|
|
312
277
|
ReactiveTUIContent,
|
|
313
278
|
RedwoodStyling,
|
|
314
279
|
RedwoodTUI
|
|
315
|
-
}
|
|
280
|
+
};
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/tui",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2742",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
7
7
|
"directory": "packages/tui"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"type": "
|
|
10
|
+
"type": "module",
|
|
11
11
|
"main": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "node ./build.mts
|
|
17
|
+
"build": "node ./build.mts",
|
|
18
18
|
"build:pack": "yarn pack -o cedarjs-tui.tgz",
|
|
19
|
-
"build:types": "tsc --build --verbose",
|
|
19
|
+
"build:types": "tsc --build --verbose ./tsconfig.build.json",
|
|
20
20
|
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
|
|
21
21
|
"prepublishOnly": "NODE_ENV=production yarn build"
|
|
22
22
|
},
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"stdout-update": "1.6.8"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cedarjs/framework-tools": "6.0.0-canary.
|
|
29
|
+
"@cedarjs/framework-tools": "6.0.0-canary.2742",
|
|
30
30
|
"typescript": "5.9.3"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|