@learnpack/learnpack 5.0.12 → 5.0.14

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/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @learnpack/learnpack
21
21
  $ learnpack COMMAND
22
22
  running command...
23
23
  $ learnpack (-v|--version|version)
24
- @learnpack/learnpack/5.0.12 win32-x64 node-v20.16.0
24
+ @learnpack/learnpack/5.0.14 win32-x64 node-v20.16.0
25
25
  $ learnpack --help [COMMAND]
26
26
  USAGE
27
27
  $ learnpack COMMAND
@@ -75,7 +75,7 @@ DESCRIPTION
75
75
  12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
76
76
  ```
77
77
 
78
- _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\audit.ts)_
78
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\audit.ts)_
79
79
 
80
80
  ## `learnpack clean`
81
81
 
@@ -90,7 +90,7 @@ DESCRIPTION
90
90
  Extra documentation goes here
91
91
  ```
92
92
 
93
- _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\clean.ts)_
93
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\clean.ts)_
94
94
 
95
95
  ## `learnpack download [PACKAGE]`
96
96
 
@@ -108,7 +108,7 @@ DESCRIPTION
108
108
  Extra documentation goes here
109
109
  ```
110
110
 
111
- _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\download.ts)_
111
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\download.ts)_
112
112
 
113
113
  ## `learnpack help [COMMAND]`
114
114
 
@@ -139,7 +139,7 @@ OPTIONS
139
139
  -h, --grading show CLI help
140
140
  ```
141
141
 
142
- _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\init.ts)_
142
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\init.ts)_
143
143
 
144
144
  ## `learnpack login [PACKAGE]`
145
145
 
@@ -157,7 +157,7 @@ DESCRIPTION
157
157
  Extra documentation goes here
158
158
  ```
159
159
 
160
- _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\login.ts)_
160
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\login.ts)_
161
161
 
162
162
  ## `learnpack logout [PACKAGE]`
163
163
 
@@ -175,7 +175,7 @@ DESCRIPTION
175
175
  Extra documentation goes here
176
176
  ```
177
177
 
178
- _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\logout.ts)_
178
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\logout.ts)_
179
179
 
180
180
  ## `learnpack plugins`
181
181
 
@@ -306,7 +306,7 @@ OPTIONS
306
306
  -h, --help show CLI help
307
307
  ```
308
308
 
309
- _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\publish.ts)_
309
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\publish.ts)_
310
310
 
311
311
  ## `learnpack start`
312
312
 
@@ -327,7 +327,7 @@ OPTIONS
327
327
  -w, --watch Watch for file changes
328
328
  ```
329
329
 
330
- _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\start.ts)_
330
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\start.ts)_
331
331
 
332
332
  ## `learnpack test [EXERCISESLUG]`
333
333
 
@@ -341,7 +341,7 @@ ARGUMENTS
341
341
  EXERCISESLUG The name of the exercise to test
342
342
  ```
343
343
 
344
- _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\test.ts)_
344
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\test.ts)_
345
345
 
346
346
  ## `learnpack translate`
347
347
 
@@ -352,7 +352,7 @@ USAGE
352
352
  $ learnpack translate
353
353
  ```
354
354
 
355
- _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.12/src\commands\translate.ts)_
355
+ _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.14/src\commands\translate.ts)_
356
356
  <!-- commandsstop -->
357
357
 
358
358
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
@@ -68,8 +68,8 @@ class StartCommand extends SessionCommand_1.default {
68
68
  ai_interactions: [],
69
69
  compilations: [],
70
70
  tests: [],
71
- is_testeable: e.graded || false,
72
71
  quiz_submissions: [],
72
+ is_testeable: e.graded || false,
73
73
  }));
74
74
  if (path && steps.length > 0) {
75
75
  telemetry_1.default.start(agent, steps, path, tutorialSlug);
@@ -142,11 +142,15 @@ class StartCommand extends SessionCommand_1.default {
142
142
  telemetry: telemetry_1.default,
143
143
  });
144
144
  });
145
- socket_1.default.on("quiz_submission", (data) => {
146
- const { stepPosition, event, eventData } = data;
147
- telemetry_1.default.registerStepEvent(stepPosition, event, eventData);
148
- });
149
- socket_1.default.on("ai_interaction", (data) => {
145
+ // socket.on("quiz_submission", (data: any) => {
146
+ // const { stepPosition, event, eventData } = data
147
+ // TelemetryManager.registerStepEvent(stepPosition, event, eventData)
148
+ // })
149
+ // socket.on("ai_interaction", (data: any) => {
150
+ // const { stepPosition, event, eventData } = data
151
+ // TelemetryManager.registerStepEvent(stepPosition, event, eventData)
152
+ // })
153
+ socket_1.default.on("telemetry_event", (data) => {
150
154
  const { stepPosition, event, eventData } = data;
151
155
  telemetry_1.default.registerStepEvent(stepPosition, event, eventData);
152
156
  });
@@ -130,6 +130,11 @@ async function default_1(app, configObject, configManager) {
130
130
  res.status(500).json({ error: "Internal server error" });
131
131
  }
132
132
  }));
133
+ app.get("/telemetry/step/:stepPosition", (req, res) => {
134
+ const stepPosition = parseInt(req.params.stepPosition);
135
+ const step = telemetry_1.default.getStep(stepPosition);
136
+ res.json(step);
137
+ });
133
138
  app.get("/check/rigo/status", withHandler(async (_, res) => {
134
139
  const payload = await session_1.default.getPayload();
135
140
  if (payload && payload.rigobot && payload.rigobot.key) {
@@ -61,7 +61,7 @@ export interface ITelemetryJSONSchema {
61
61
  steps: Array<TStep>;
62
62
  workout_session: TWorkoutSession[];
63
63
  }
64
- type TStepEvent = "compile" | "test" | "ai_interaction" | "open_step" | "quiz_submission";
64
+ export type TStepEvent = "compile" | "test" | "ai_interaction" | "open_step" | "quiz_submission";
65
65
  export type TTelemetryUrls = {
66
66
  streaming?: string;
67
67
  batch?: string;
@@ -87,6 +87,7 @@ interface ITelemetryManager {
87
87
  setStudent: (student: TStudent) => void;
88
88
  save: () => void;
89
89
  retrieve: () => Promise<ITelemetryJSONSchema | null>;
90
+ getStep: (stepPosition: number) => TStep | null;
90
91
  }
91
92
  declare const TelemetryManager: ITelemetryManager;
92
93
  export default TelemetryManager;
@@ -198,6 +198,10 @@ const TelemetryManager = {
198
198
  });
199
199
  });
200
200
  },
201
+ getStep: function (stepPosition) {
202
+ var _a;
203
+ return ((_a = this.current) === null || _a === void 0 ? void 0 : _a.steps[stepPosition]) || null;
204
+ },
201
205
  submit: async function () {
202
206
  console_1.default.debug("Submitting telemetry...");
203
207
  if (!this.current) {
@@ -160,6 +160,7 @@ const checkNotInstalledDependencies = async (neededPlugins) => {
160
160
  await installDependencies(jsPluginsDependencies, "npm");
161
161
  }
162
162
  if (pytestNeeded) {
163
+ await exec("python.exe -m pip install --upgrade pip");
163
164
  const { stdout, stderr } = await exec("pip list");
164
165
  if (stderr) {
165
166
  console_1.default.error(`Error executing pip list. Use debug for more info`);
@@ -1 +1 @@
1
- {"version":"5.0.12","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]},"translate":{"id":"translate","description":"List all the lessons, the user is able of select many of them to translate to the given languages","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]}}}
1
+ {"version":"5.0.14","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]},"translate":{"id":"translate","description":"List all the lessons, the user is able of select many of them to translate to the given languages","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@learnpack/learnpack",
3
3
  "description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
4
- "version": "5.0.12",
4
+ "version": "5.0.14",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -148,7 +148,7 @@ export default class StartCommand extends SessionCommand {
148
148
  const path = configObject.config?.dirPath || ""
149
149
  const tutorialSlug = configObject.config?.slug || ""
150
150
 
151
- const steps = configObject.exercises.map(
151
+ const steps: TStep[] = configObject.exercises.map(
152
152
  (e: IExercise, index): TStep => ({
153
153
  slug: e.slug,
154
154
  position: e.position || index,
@@ -156,8 +156,8 @@ export default class StartCommand extends SessionCommand {
156
156
  ai_interactions: [],
157
157
  compilations: [],
158
158
  tests: [],
159
- is_testeable: e.graded || false,
160
159
  quiz_submissions: [],
160
+ is_testeable: e.graded || false,
161
161
  })
162
162
  )
163
163
  if (path && steps.length > 0) {
@@ -249,13 +249,19 @@ export default class StartCommand extends SessionCommand {
249
249
  })
250
250
  })
251
251
 
252
- socket.on("quiz_submission", (data: any) => {
253
- const { stepPosition, event, eventData } = data
254
- TelemetryManager.registerStepEvent(stepPosition, event, eventData)
255
- })
252
+ // socket.on("quiz_submission", (data: any) => {
253
+ // const { stepPosition, event, eventData } = data
254
+ // TelemetryManager.registerStepEvent(stepPosition, event, eventData)
255
+ // })
256
+
257
+ // socket.on("ai_interaction", (data: any) => {
258
+ // const { stepPosition, event, eventData } = data
259
+ // TelemetryManager.registerStepEvent(stepPosition, event, eventData)
260
+ // })
256
261
 
257
- socket.on("ai_interaction", (data: any) => {
262
+ socket.on("telemetry_event", (data: any) => {
258
263
  const { stepPosition, event, eventData } = data
264
+
259
265
  TelemetryManager.registerStepEvent(stepPosition, event, eventData)
260
266
  })
261
267
 
@@ -170,6 +170,12 @@ export default async function (
170
170
  })
171
171
  )
172
172
 
173
+ app.get("/telemetry/step/:stepPosition", (req, res) => {
174
+ const stepPosition = parseInt(req.params.stepPosition)
175
+ const step = TelemetryManager.getStep(stepPosition)
176
+ res.json(step)
177
+ })
178
+
173
179
  app.get(
174
180
  "/check/rigo/status",
175
181
  withHandler(async (_: express.Request, res: express.Response) => {
@@ -87,7 +87,7 @@ export interface ITelemetryJSONSchema {
87
87
  // number and start another session
88
88
  }
89
89
 
90
- type TStepEvent =
90
+ export type TStepEvent =
91
91
  | "compile"
92
92
  | "test"
93
93
  | "ai_interaction"
@@ -130,6 +130,7 @@ interface ITelemetryManager {
130
130
  setStudent: (student: TStudent) => void
131
131
  save: () => void
132
132
  retrieve: () => Promise<ITelemetryJSONSchema | null>
133
+ getStep: (stepPosition: number) => TStep | null
133
134
  }
134
135
 
135
136
  const TelemetryManager: ITelemetryManager = {
@@ -358,6 +359,10 @@ const TelemetryManager: ITelemetryManager = {
358
359
  })
359
360
  },
360
361
 
362
+ getStep: function (stepPosition: number) {
363
+ return this.current?.steps[stepPosition] || null
364
+ },
365
+
361
366
  submit: async function () {
362
367
  Console.debug("Submitting telemetry...")
363
368
 
@@ -222,6 +222,8 @@ return true
222
222
  }
223
223
 
224
224
  if (pytestNeeded) {
225
+ await exec("python.exe -m pip install --upgrade pip")
226
+
225
227
  const { stdout, stderr } = await exec("pip list")
226
228
  if (stderr) {
227
229
  Console.error(`Error executing pip list. Use debug for more info`)