@hurshb50/setup-ubuntu 1.2.1 → 1.3.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.
|
@@ -11,13 +11,16 @@ import util from "util";
|
|
|
11
11
|
import childProcess from "child_process";
|
|
12
12
|
//#region package.json
|
|
13
13
|
var name = "@hurshb50/setup-ubuntu";
|
|
14
|
-
var version = "1.2.
|
|
14
|
+
var version = "1.2.2";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region source/modules/logger/logger.ts
|
|
17
17
|
var Logger = class Logger {
|
|
18
18
|
status;
|
|
19
19
|
tasks;
|
|
20
20
|
tick;
|
|
21
|
+
cursorHidden;
|
|
22
|
+
onExit;
|
|
23
|
+
onSignal;
|
|
21
24
|
static check = "✔";
|
|
22
25
|
static dots = [
|
|
23
26
|
"⠋",
|
|
@@ -36,6 +39,12 @@ var Logger = class Logger {
|
|
|
36
39
|
this.status = "idle";
|
|
37
40
|
this.tasks = [];
|
|
38
41
|
this.tick = 0;
|
|
42
|
+
this.cursorHidden = false;
|
|
43
|
+
this.onExit = () => this.restore();
|
|
44
|
+
this.onSignal = (signal) => {
|
|
45
|
+
this.restore();
|
|
46
|
+
process.kill(process.pid, signal);
|
|
47
|
+
};
|
|
39
48
|
}
|
|
40
49
|
add(task) {
|
|
41
50
|
this.tasks.push(task);
|
|
@@ -43,6 +52,9 @@ var Logger = class Logger {
|
|
|
43
52
|
start() {
|
|
44
53
|
if (this.status !== "idle") throw new Error(`Cannot start task logger when status is '${this.status}'.`);
|
|
45
54
|
this.status = "in-progress";
|
|
55
|
+
process.once("exit", this.onExit);
|
|
56
|
+
process.once("SIGINT", this.onSignal);
|
|
57
|
+
process.once("SIGTERM", this.onSignal);
|
|
46
58
|
this.loop();
|
|
47
59
|
}
|
|
48
60
|
stop() {
|
|
@@ -51,6 +63,8 @@ var Logger = class Logger {
|
|
|
51
63
|
}
|
|
52
64
|
async loop() {
|
|
53
65
|
const minimumIntervalMilliSeconds = 80;
|
|
66
|
+
this.log(escapes.cursorHide);
|
|
67
|
+
this.cursorHidden = true;
|
|
54
68
|
this.newline();
|
|
55
69
|
this.banner("Ubuntu Setup");
|
|
56
70
|
this.newline();
|
|
@@ -63,7 +77,16 @@ var Logger = class Logger {
|
|
|
63
77
|
}
|
|
64
78
|
this.write();
|
|
65
79
|
this.newline(this.tasks.length + 1);
|
|
80
|
+
this.restore();
|
|
81
|
+
}
|
|
82
|
+
restore() {
|
|
83
|
+
if (!this.cursorHidden) return;
|
|
66
84
|
this.log(styles.reset.close);
|
|
85
|
+
this.log(escapes.cursorShow);
|
|
86
|
+
this.cursorHidden = false;
|
|
87
|
+
process.off("exit", this.onExit);
|
|
88
|
+
process.off("SIGINT", this.onSignal);
|
|
89
|
+
process.off("SIGTERM", this.onSignal);
|
|
67
90
|
}
|
|
68
91
|
write() {
|
|
69
92
|
if (this.status === "idle") throw new Error("Cannot write to stdout if status is 'idle'.");
|
|
@@ -364,6 +387,25 @@ var Browser = class {
|
|
|
364
387
|
}
|
|
365
388
|
};
|
|
366
389
|
//#endregion
|
|
390
|
+
//#region source/modules/clipboard/clipboard.ts
|
|
391
|
+
var Clipboard = class {
|
|
392
|
+
async install(context) {
|
|
393
|
+
const task = new Task("Clipboard");
|
|
394
|
+
context.logger.add(task);
|
|
395
|
+
task.start();
|
|
396
|
+
const dependencies = ["wl-clipboard", "xclip"];
|
|
397
|
+
if (await context.dependencyManager.isInstalled(dependencies)) {
|
|
398
|
+
task.finish();
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
task.continue("Update package manager");
|
|
402
|
+
await context.dependencyManager.update(task);
|
|
403
|
+
task.continue(`Installing dependencies: ${dependencies.join(", ")}`);
|
|
404
|
+
await context.dependencyManager.install(dependencies, task);
|
|
405
|
+
task.finish();
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
//#endregion
|
|
367
409
|
//#region source/modules/code-editor/code-editor.ts
|
|
368
410
|
var CodeEditor = class {
|
|
369
411
|
async install(context) {
|
|
@@ -603,7 +645,11 @@ var VersionControlSystem = class {
|
|
|
603
645
|
const task = new Task("Version Control System");
|
|
604
646
|
context.logger.add(task);
|
|
605
647
|
task.start();
|
|
606
|
-
const dependencies = [
|
|
648
|
+
const dependencies = [
|
|
649
|
+
"git",
|
|
650
|
+
"git-lfs",
|
|
651
|
+
"build-essential"
|
|
652
|
+
];
|
|
607
653
|
if (!await context.dependencyManager.isInstalled(dependencies)) {
|
|
608
654
|
task.continue("Update package manager");
|
|
609
655
|
await context.dependencyManager.update(task);
|
|
@@ -655,6 +701,7 @@ program.name(name).version(version).description("Sets up a fresh Ubuntu machine
|
|
|
655
701
|
new AgentSkills(),
|
|
656
702
|
new AutoSuggestion(),
|
|
657
703
|
new Browser(),
|
|
704
|
+
new Clipboard(),
|
|
658
705
|
new CodeEditor(),
|
|
659
706
|
new CodeHost(),
|
|
660
707
|
new ContainerEngine(),
|