inclusion-md 0.2.2 → 0.2.4
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/init.js +0 -4
- package/package.json +1 -1
- package/lib/ascii.js +0 -59
package/lib/init.js
CHANGED
|
@@ -6,7 +6,6 @@ const path = require("path");
|
|
|
6
6
|
const c = require("./colors");
|
|
7
7
|
const { createPrompter } = require("./prompt");
|
|
8
8
|
const { loadTemplate, renderGeneric, VARIANTS } = require("./template");
|
|
9
|
-
const ascii = require("./ascii");
|
|
10
9
|
const { runQuestionnaire, TOTAL_QUESTIONS } = require("./questionnaire");
|
|
11
10
|
|
|
12
11
|
const REPO_URL = "https://github.com/BranonConor/inclusion.md";
|
|
@@ -14,9 +13,6 @@ const ESSAY_URL = "https://branon.dev/blog/posts/the-need-for-inclusion-md";
|
|
|
14
13
|
|
|
15
14
|
async function welcome(args) {
|
|
16
15
|
c.set(args.color);
|
|
17
|
-
await ascii.play({
|
|
18
|
-
enabled: ascii.shouldAnimate({ noColor: !args.color, yes: args.yes }),
|
|
19
|
-
});
|
|
20
16
|
process.stdout.write(
|
|
21
17
|
"\n" +
|
|
22
18
|
c.magenta(c.bold("Welcome to the INCLUSION.md CLI!")) +
|
package/package.json
CHANGED
package/lib/ascii.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const c = require("./colors");
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Gentle 3-frame welcome animation. Conveys "coming together" via dots that
|
|
7
|
-
* gradually connect. ASCII-only, no flashing, no inverted colors, no Unicode.
|
|
8
|
-
*
|
|
9
|
-
* Accessibility:
|
|
10
|
-
* - Skipped automatically when stdout is not a TTY (CI, piped output).
|
|
11
|
-
* - Skipped when --no-color is passed (color is the cue, not motion).
|
|
12
|
-
* - Skipped when --yes is passed (non-interactive runs).
|
|
13
|
-
* - Frames change appearance gradually (dim -> normal -> bold), not flashing.
|
|
14
|
-
* - Total runtime under 1 second.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const FRAMES = [
|
|
18
|
-
[" . . . ", " ", " . . . "],
|
|
19
|
-
[" o o o ", " ", " o o o "],
|
|
20
|
-
[" o-----o-----o ", " | ", " o-----o-----o "],
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
function renderFrame(frame, intensity) {
|
|
24
|
-
// intensity: 0 = dim, 1 = normal, 2 = bold
|
|
25
|
-
const stylize = intensity === 0 ? c.dim : intensity === 2 ? c.bold : (s) => s;
|
|
26
|
-
return frame.map((line) => stylize(line)).join("\n");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function clearFrame(lineCount) {
|
|
30
|
-
for (let i = 0; i < lineCount; i++) {
|
|
31
|
-
process.stdout.write("\x1b[1A\x1b[2K");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function sleep(ms) {
|
|
36
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function play({ enabled = true, frameMs = 220 } = {}) {
|
|
40
|
-
if (!enabled) return;
|
|
41
|
-
for (let i = 0; i < FRAMES.length; i++) {
|
|
42
|
-
const intensity = i === FRAMES.length - 1 ? 2 : i;
|
|
43
|
-
process.stdout.write(renderFrame(FRAMES[i], intensity) + "\n");
|
|
44
|
-
if (i < FRAMES.length - 1) {
|
|
45
|
-
await sleep(frameMs);
|
|
46
|
-
clearFrame(FRAMES[i].length + 1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function shouldAnimate({ noColor, yes }) {
|
|
52
|
-
if (yes) return false;
|
|
53
|
-
if (noColor) return false;
|
|
54
|
-
if (!process.stdout.isTTY) return false;
|
|
55
|
-
if (process.env.CI) return false;
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
module.exports = { play, shouldAnimate, FRAMES };
|