@learnpack/learnpack 4.0.6 → 4.0.8
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 +1 -2
- package/lib/managers/config/defaults.d.ts +6 -0
- package/lib/managers/config/defaults.js +6 -0
- package/lib/managers/config/index.js +173 -11
- package/lib/managers/server/routes.js +2 -1
- package/lib/managers/socket.js +1 -1
- package/lib/models/config.d.ts +11 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/start.ts +3 -5
- package/src/managers/config/defaults.ts +49 -43
- package/src/managers/config/index.ts +211 -13
- package/src/managers/server/routes.ts +327 -330
- package/src/managers/socket.ts +2 -6
- package/src/models/config.ts +72 -68
package/src/managers/socket.ts
CHANGED
@@ -144,11 +144,7 @@ actions = [actions]
|
|
144
144
|
files: Array<string> | null = null,
|
145
145
|
exercises: Array<string> | null = null
|
146
146
|
) {
|
147
|
-
this.emit(
|
148
|
-
"reload",
|
149
|
-
files?.join("") || "" /* TODO: Check it out this */,
|
150
|
-
exercises!
|
151
|
-
)
|
147
|
+
this.emit("reload", files?.join("") || "", exercises!)
|
152
148
|
},
|
153
149
|
openWindow: function (url = "") {
|
154
150
|
queue.dispatcher().enqueue(queue.events.OPEN_WINDOW, url)
|
@@ -195,7 +191,7 @@ actions = [actions]
|
|
195
191
|
}
|
196
192
|
|
197
193
|
// eslint-disable-next-line
|
198
|
-
this.config?.disabledActions?.forEach((a) => this.removeAllowed(a))
|
194
|
+
this.config?.disabledActions?.forEach((a) => this.removeAllowed(a))
|
199
195
|
|
200
196
|
this.socket?.emit("compiler", {
|
201
197
|
action,
|
package/src/models/config.ts
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
import { IExercise } from "./exercise-obj"
|
2
2
|
import { TTelemetryUrls } from "../managers/telemetry"
|
3
3
|
|
4
|
-
export type TGrading = "isolated" | "incremental" | "no-grading"
|
4
|
+
export type TGrading = "isolated" | "incremental" | "no-grading"
|
5
5
|
|
6
|
-
export type TMode = "preview" | "extension"
|
6
|
+
export type TMode = "preview" | "extension"
|
7
7
|
|
8
|
-
export type TConfigAction =
|
9
|
-
| "test"
|
10
|
-
| "build"
|
11
|
-
| "tutorial"
|
12
|
-
| "reset"
|
13
|
-
| "generate";
|
8
|
+
export type TConfigAction = "test" | "build" | "tutorial" | "reset" | "generate"
|
14
9
|
|
15
|
-
export type TConfigObjAttributes = "config" | "exercises" | "grading"
|
10
|
+
export type TConfigObjAttributes = "config" | "exercises" | "grading"
|
16
11
|
|
17
12
|
export type TCompiler =
|
18
13
|
| "webpack"
|
@@ -21,82 +16,91 @@ export type TCompiler =
|
|
21
16
|
| "html"
|
22
17
|
| "node"
|
23
18
|
| "python"
|
24
|
-
| "css"
|
19
|
+
| "css"
|
25
20
|
|
26
21
|
export interface IConfigPath {
|
27
|
-
base: string
|
22
|
+
base: string
|
28
23
|
}
|
29
24
|
|
30
|
-
type TAgent = "vscode" | "os";
|
31
|
-
|
32
25
|
export interface IEditor {
|
33
|
-
mode?: TMode
|
34
|
-
version
|
35
|
-
agent?: TAgent
|
36
|
-
hideTerminal?: boolean
|
26
|
+
mode?: TMode
|
27
|
+
version?: string
|
28
|
+
agent?: TAgent
|
29
|
+
hideTerminal?: boolean
|
37
30
|
}
|
38
31
|
|
39
32
|
export interface TEntries {
|
40
|
-
python3?: string
|
41
|
-
html?: string
|
42
|
-
node?: string
|
43
|
-
react?: string
|
44
|
-
java?: string
|
33
|
+
python3?: string
|
34
|
+
html?: string
|
35
|
+
node?: string
|
36
|
+
react?: string
|
37
|
+
java?: string
|
45
38
|
}
|
46
39
|
|
47
40
|
export interface IConfig {
|
48
|
-
os: string
|
49
|
-
port?: string
|
50
|
-
repository?: string
|
51
|
-
description?: string
|
52
|
-
slug?: string
|
53
|
-
dirPath: string
|
54
|
-
preview?: string
|
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
|
67
|
-
actions: Array<string
|
68
|
-
autoPlay: boolean
|
69
|
-
projectType?: string
|
41
|
+
os: string
|
42
|
+
port?: string
|
43
|
+
repository?: string
|
44
|
+
description?: string
|
45
|
+
slug?: string
|
46
|
+
dirPath: string
|
47
|
+
preview?: string // Picture thumbnail
|
48
|
+
entries: TEntries
|
49
|
+
grading: TGrading
|
50
|
+
configPath: string
|
51
|
+
translations: Array<string>
|
52
|
+
outputPath?: string
|
53
|
+
editor: IEditor
|
54
|
+
language: string
|
55
|
+
title: string
|
56
|
+
duration: number
|
57
|
+
difficulty?: string
|
58
|
+
exercisesPath: string
|
59
|
+
disableGrading: boolean // TODO: Deprecate
|
60
|
+
actions: Array<string> // TODO: Deprecate
|
61
|
+
autoPlay: boolean
|
62
|
+
projectType?: string
|
70
63
|
// 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
|
-
variables?: TVariables
|
64
|
+
contact?: string
|
65
|
+
disabledActions?: Array<TConfigAction>
|
66
|
+
compiler: TCompiler
|
67
|
+
compilers: Array<TCompiler>
|
68
|
+
publicPath: string
|
69
|
+
publicUrl?: string
|
70
|
+
bugsLink?: string
|
71
|
+
videoSolutions?: boolean
|
72
|
+
skills: Array<string>
|
73
|
+
telemetry?: TTelemetryUrls
|
74
|
+
variables?: TVariables
|
75
|
+
suggestions: TSuggestions
|
76
|
+
warnings: TWarnings
|
77
|
+
runHook: (...agrs: Array<any>) => void
|
78
|
+
testingFinishedCallback: (arg: any | undefined) => void
|
79
|
+
}
|
80
|
+
export type TAgent = "os" | "vscode" | null
|
81
|
+
|
82
|
+
type TSuggestions = {
|
83
|
+
agent: TAgent
|
84
|
+
}
|
82
85
|
|
83
|
-
|
84
|
-
|
86
|
+
type TWarnings = {
|
87
|
+
agent?: string
|
88
|
+
extension?: string
|
85
89
|
}
|
86
90
|
|
87
91
|
type TVariable = {
|
88
|
-
type: "command" | "string"
|
89
|
-
source: string
|
90
|
-
}
|
92
|
+
type: "command" | "string"
|
93
|
+
source: string
|
94
|
+
}
|
91
95
|
type TVariables = {
|
92
|
-
[key: string]: TVariable | string
|
93
|
-
}
|
96
|
+
[key: string]: TVariable | string
|
97
|
+
}
|
94
98
|
|
95
99
|
export interface IConfigObj {
|
96
|
-
session?: number
|
97
|
-
currentExercise?: any
|
98
|
-
config?: IConfig
|
99
|
-
exercises?: Array<IExercise
|
100
|
-
confPath?: IConfigPath
|
101
|
-
address?: string
|
100
|
+
session?: number
|
101
|
+
currentExercise?: any
|
102
|
+
config?: IConfig
|
103
|
+
exercises?: Array<IExercise>
|
104
|
+
confPath?: IConfigPath
|
105
|
+
address?: string // Maybe
|
102
106
|
}
|