@learnpack/learnpack 2.1.53 → 2.1.56
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +10 -10
- package/lib/commands/start.js +29 -0
- package/lib/managers/socket.js +11 -1
- package/lib/managers/telemetry.d.ts +1 -1
- package/lib/managers/telemetry.js +10 -2
- package/lib/models/action.d.ts +1 -1
- package/lib/models/config.d.ts +1 -0
- package/lib/models/socket.d.ts +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/start.ts +358 -320
- package/src/managers/socket.ts +13 -1
- package/src/managers/telemetry.ts +353 -346
- package/src/models/action.ts +11 -10
- package/src/models/config.ts +93 -91
- package/src/models/socket.ts +60 -59
- package/src/models/status.ts +16 -16
package/src/models/action.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
export type TAction =
|
2
|
-
| "test"
|
3
|
-
| "log"
|
4
|
-
| "reload"
|
5
|
-
| "ready"
|
6
|
-
| "clean"
|
7
|
-
| "ask"
|
8
|
-
| "file_change"
|
9
|
-
|
10
|
-
|
1
|
+
export type TAction =
|
2
|
+
| "test"
|
3
|
+
| "log"
|
4
|
+
| "reload"
|
5
|
+
| "ready"
|
6
|
+
| "clean"
|
7
|
+
| "ask"
|
8
|
+
| "file_change"
|
9
|
+
| "dialog";
|
10
|
+
|
11
|
+
export type ICallback = (...agrs: any[]) => any;
|
package/src/models/config.ts
CHANGED
@@ -1,91 +1,93 @@
|
|
1
|
-
import { IExercise } from "./exercise-obj"
|
2
|
-
import { TTelemetryUrls } from "../managers/telemetry"
|
3
|
-
|
4
|
-
export type TGrading = "isolated" | "incremental" | "no-grading";
|
5
|
-
|
6
|
-
export type TMode = "preview" | "extension";
|
7
|
-
|
8
|
-
export type TConfigAction =
|
9
|
-
| "test"
|
10
|
-
| "build"
|
11
|
-
| "tutorial"
|
12
|
-
| "reset"
|
13
|
-
| "generate";
|
14
|
-
|
15
|
-
export type TConfigObjAttributes = "config" | "exercises" | "grading";
|
16
|
-
|
17
|
-
export type TCompiler =
|
18
|
-
| "webpack"
|
19
|
-
| "vanillajs"
|
20
|
-
| "react"
|
21
|
-
| "html"
|
22
|
-
| "node"
|
23
|
-
| "python"
|
24
|
-
| "css";
|
25
|
-
|
26
|
-
export interface IConfigPath {
|
27
|
-
base: string;
|
28
|
-
}
|
29
|
-
|
30
|
-
type TAgent = "vscode" | "os";
|
31
|
-
|
32
|
-
export interface IEditor {
|
33
|
-
mode?: TMode;
|
34
|
-
version: string;
|
35
|
-
agent?: TAgent;
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
1
|
+
import { IExercise } from "./exercise-obj"
|
2
|
+
import { TTelemetryUrls } from "../managers/telemetry"
|
3
|
+
|
4
|
+
export type TGrading = "isolated" | "incremental" | "no-grading";
|
5
|
+
|
6
|
+
export type TMode = "preview" | "extension";
|
7
|
+
|
8
|
+
export type TConfigAction =
|
9
|
+
| "test"
|
10
|
+
| "build"
|
11
|
+
| "tutorial"
|
12
|
+
| "reset"
|
13
|
+
| "generate";
|
14
|
+
|
15
|
+
export type TConfigObjAttributes = "config" | "exercises" | "grading";
|
16
|
+
|
17
|
+
export type TCompiler =
|
18
|
+
| "webpack"
|
19
|
+
| "vanillajs"
|
20
|
+
| "react"
|
21
|
+
| "html"
|
22
|
+
| "node"
|
23
|
+
| "python"
|
24
|
+
| "css";
|
25
|
+
|
26
|
+
export interface IConfigPath {
|
27
|
+
base: string;
|
28
|
+
}
|
29
|
+
|
30
|
+
type TAgent = "vscode" | "os";
|
31
|
+
|
32
|
+
export interface IEditor {
|
33
|
+
mode?: TMode;
|
34
|
+
version: string;
|
35
|
+
agent?: TAgent;
|
36
|
+
hideTerminal?: boolean;
|
37
|
+
}
|
38
|
+
|
39
|
+
export interface TEntries {
|
40
|
+
python3?: string;
|
41
|
+
html?: string;
|
42
|
+
node?: string;
|
43
|
+
react?: string;
|
44
|
+
java?: string;
|
45
|
+
}
|
46
|
+
|
47
|
+
export interface IConfig {
|
48
|
+
os: string;
|
49
|
+
port?: string;
|
50
|
+
repository?: string;
|
51
|
+
description?: string;
|
52
|
+
slug?: string;
|
53
|
+
dirPath: string;
|
54
|
+
preview?: string; // Picture thumbnail
|
55
|
+
entries: TEntries;
|
56
|
+
grading: TGrading;
|
57
|
+
configPath: string;
|
58
|
+
translations: Array<string>;
|
59
|
+
outputPath?: string;
|
60
|
+
editor: IEditor;
|
61
|
+
language: string;
|
62
|
+
title: string;
|
63
|
+
duration: number;
|
64
|
+
difficulty?: string;
|
65
|
+
exercisesPath: string;
|
66
|
+
disableGrading: boolean; // TODO: Deprecate
|
67
|
+
actions: Array<string>; // TODO: Deprecate
|
68
|
+
autoPlay: boolean;
|
69
|
+
projectType?: string;
|
70
|
+
// TODO: nameExerciseValidation
|
71
|
+
contact?: string;
|
72
|
+
disabledActions?: Array<TConfigAction>;
|
73
|
+
compiler: TCompiler;
|
74
|
+
compilers: Array<TCompiler>;
|
75
|
+
publicPath: string;
|
76
|
+
publicUrl?: string;
|
77
|
+
bugsLink?: string;
|
78
|
+
videoSolutions?: boolean;
|
79
|
+
skills: Array<string>;
|
80
|
+
telemetry?: TTelemetryUrls;
|
81
|
+
|
82
|
+
runHook: (...agrs: Array<any>) => void;
|
83
|
+
testingFinishedCallback: (arg: any | undefined) => void;
|
84
|
+
}
|
85
|
+
|
86
|
+
export interface IConfigObj {
|
87
|
+
session?: number;
|
88
|
+
currentExercise?: any;
|
89
|
+
config?: IConfig;
|
90
|
+
exercises?: Array<IExercise>;
|
91
|
+
confPath?: IConfigPath;
|
92
|
+
address?: string; // Maybe
|
93
|
+
}
|
package/src/models/socket.ts
CHANGED
@@ -1,59 +1,60 @@
|
|
1
|
-
import { IConfig } from "./config"
|
2
|
-
import { Server } from "socket.io"
|
3
|
-
import { DefaultEventsMap } from "socket.io/dist/typed-events"
|
4
|
-
import { TAction, ICallback } from "./action"
|
5
|
-
import { TStatus } from "./status"
|
6
|
-
|
7
|
-
export type TPossibleActions =
|
8
|
-
| "build"
|
9
|
-
| "test"
|
10
|
-
| "reset"
|
11
|
-
| "tutorial"
|
12
|
-
| "generate";
|
13
|
-
|
14
|
-
export interface ISocket {
|
15
|
-
socket: Server<
|
16
|
-
DefaultEventsMap,
|
17
|
-
DefaultEventsMap,
|
18
|
-
DefaultEventsMap,
|
19
|
-
any
|
20
|
-
> | null;
|
21
|
-
config: IConfig | null;
|
22
|
-
allowedActions: Array<TPossibleActions>;
|
23
|
-
actionCallBacks: { [key: string]: ICallback };
|
24
|
-
possibleActions: Array<TPossibleActions>;
|
25
|
-
isTestingEnvironment: boolean;
|
26
|
-
addAllowed: (actions: any) => void;
|
27
|
-
removeAllowed: (actions: any) => void;
|
28
|
-
start: (config: IConfig, server: any, isTestingEnvironment: boolean) => void;
|
29
|
-
on: (action: any, callBack: any) => void;
|
30
|
-
clean: (_: string, logs: Array<any>) => void;
|
31
|
-
complete: () => void;
|
32
|
-
ask: (questions: Array<string>) => void;
|
33
|
-
reload: (files: Array<string> | null, exercises: Array<string>) => void;
|
34
|
-
openWindow: (id: string) => void;
|
35
|
-
log: (
|
36
|
-
status: TStatus,
|
37
|
-
messages?: string | Array<string>,
|
38
|
-
report?: Array<string>,
|
39
|
-
data?: any
|
40
|
-
) => void;
|
41
|
-
emit: (
|
42
|
-
action: TAction,
|
43
|
-
status: TStatus | string,
|
44
|
-
logs: string | Array<string>,
|
45
|
-
inputs?: Array<string>,
|
46
|
-
report?: Array<string>,
|
47
|
-
data?: any
|
48
|
-
) => void;
|
49
|
-
ready: (message: string) => void;
|
50
|
-
error: (type: any, stdout: string) => void;
|
51
|
-
fatal: (msg: string) => void;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
1
|
+
import { IConfig } from "./config"
|
2
|
+
import { Server } from "socket.io"
|
3
|
+
import { DefaultEventsMap } from "socket.io/dist/typed-events"
|
4
|
+
import { TAction, ICallback } from "./action"
|
5
|
+
import { TStatus } from "./status"
|
6
|
+
|
7
|
+
export type TPossibleActions =
|
8
|
+
| "build"
|
9
|
+
| "test"
|
10
|
+
| "reset"
|
11
|
+
| "tutorial"
|
12
|
+
| "generate";
|
13
|
+
|
14
|
+
export interface ISocket {
|
15
|
+
socket: Server<
|
16
|
+
DefaultEventsMap,
|
17
|
+
DefaultEventsMap,
|
18
|
+
DefaultEventsMap,
|
19
|
+
any
|
20
|
+
> | null;
|
21
|
+
config: IConfig | null;
|
22
|
+
allowedActions: Array<TPossibleActions>;
|
23
|
+
actionCallBacks: { [key: string]: ICallback };
|
24
|
+
possibleActions: Array<TPossibleActions>;
|
25
|
+
isTestingEnvironment: boolean;
|
26
|
+
addAllowed: (actions: any) => void;
|
27
|
+
removeAllowed: (actions: any) => void;
|
28
|
+
start: (config: IConfig, server: any, isTestingEnvironment: boolean) => void;
|
29
|
+
on: (action: any, callBack: any) => void;
|
30
|
+
clean: (_: string, logs: Array<any>) => void;
|
31
|
+
complete: () => void;
|
32
|
+
ask: (questions: Array<string>) => void;
|
33
|
+
reload: (files: Array<string> | null, exercises: Array<string>) => void;
|
34
|
+
openWindow: (id: string) => void;
|
35
|
+
log: (
|
36
|
+
status: TStatus,
|
37
|
+
messages?: string | Array<string>,
|
38
|
+
report?: Array<string>,
|
39
|
+
data?: any
|
40
|
+
) => void;
|
41
|
+
emit: (
|
42
|
+
action: TAction,
|
43
|
+
status: TStatus | string,
|
44
|
+
logs: string | Array<string>,
|
45
|
+
inputs?: Array<string>,
|
46
|
+
report?: Array<string>,
|
47
|
+
data?: any
|
48
|
+
) => void;
|
49
|
+
ready: (message: string) => void;
|
50
|
+
error: (type: any, stdout: string) => void;
|
51
|
+
fatal: (msg: string) => void;
|
52
|
+
dialog: (message: string) => void;
|
53
|
+
success: (type: any, stdout: string) => void;
|
54
|
+
onTestingFinished: (obj: any) => void;
|
55
|
+
}
|
56
|
+
|
57
|
+
export type TOpenWindowData = {
|
58
|
+
url: string;
|
59
|
+
exerciseSlug: string;
|
60
|
+
};
|
package/src/models/status.ts
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
export type TStatus =
|
2
|
-
| "ready"
|
3
|
-
| "internal-error"
|
4
|
-
| "compiler-success"
|
5
|
-
| "testing-success"
|
6
|
-
| "compiling"
|
7
|
-
| "testing"
|
8
|
-
| "start_exercise"
|
9
|
-
| "initializing"
|
10
|
-
| "configuration_loaded"
|
11
|
-
| "connection_ended"
|
12
|
-
| "reset_exercise"
|
13
|
-
| "open_files"
|
14
|
-
| "open_window"
|
15
|
-
| "instructions_closed"
|
16
|
-
| "completed";
|
1
|
+
export type TStatus =
|
2
|
+
| "ready"
|
3
|
+
| "internal-error"
|
4
|
+
| "compiler-success"
|
5
|
+
| "testing-success"
|
6
|
+
| "compiling"
|
7
|
+
| "testing"
|
8
|
+
| "start_exercise"
|
9
|
+
| "initializing"
|
10
|
+
| "configuration_loaded"
|
11
|
+
| "connection_ended"
|
12
|
+
| "reset_exercise"
|
13
|
+
| "open_files"
|
14
|
+
| "open_window"
|
15
|
+
| "instructions_closed"
|
16
|
+
| "completed";
|