@learnpack/learnpack 5.0.29 → 5.0.30

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.29 win32-x64 node-v20.16.0
24
+ @learnpack/learnpack/5.0.30 win32-x64 node-v20.16.0
25
25
  $ learnpack --help [COMMAND]
26
26
  USAGE
27
27
  $ learnpack COMMAND
@@ -76,7 +76,7 @@ DESCRIPTION
76
76
  12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
77
77
  ```
78
78
 
79
- _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\audit.ts)_
79
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\audit.ts)_
80
80
 
81
81
  ## `learnpack breakToken`
82
82
 
@@ -91,7 +91,7 @@ OPTIONS
91
91
  -y, --yes Skip all prompts and initialize an empty project
92
92
  ```
93
93
 
94
- _See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\breakToken.ts)_
94
+ _See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\breakToken.ts)_
95
95
 
96
96
  ## `learnpack clean`
97
97
 
@@ -106,7 +106,7 @@ DESCRIPTION
106
106
  Extra documentation goes here
107
107
  ```
108
108
 
109
- _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\clean.ts)_
109
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\clean.ts)_
110
110
 
111
111
  ## `learnpack download [PACKAGE]`
112
112
 
@@ -124,7 +124,7 @@ DESCRIPTION
124
124
  Extra documentation goes here
125
125
  ```
126
126
 
127
- _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\download.ts)_
127
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\download.ts)_
128
128
 
129
129
  ## `learnpack help [COMMAND]`
130
130
 
@@ -156,7 +156,7 @@ OPTIONS
156
156
  -y, --yes Skip all prompts and initialize an empty project
157
157
  ```
158
158
 
159
- _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\init.ts)_
159
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\init.ts)_
160
160
 
161
161
  ## `learnpack login [PACKAGE]`
162
162
 
@@ -174,7 +174,7 @@ DESCRIPTION
174
174
  Extra documentation goes here
175
175
  ```
176
176
 
177
- _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\login.ts)_
177
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\login.ts)_
178
178
 
179
179
  ## `learnpack logout [PACKAGE]`
180
180
 
@@ -192,7 +192,7 @@ DESCRIPTION
192
192
  Extra documentation goes here
193
193
  ```
194
194
 
195
- _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\logout.ts)_
195
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\logout.ts)_
196
196
 
197
197
  ## `learnpack plugins`
198
198
 
@@ -323,7 +323,7 @@ OPTIONS
323
323
  -h, --help show CLI help
324
324
  ```
325
325
 
326
- _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\publish.ts)_
326
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\publish.ts)_
327
327
 
328
328
  ## `learnpack start`
329
329
 
@@ -345,7 +345,7 @@ OPTIONS
345
345
  -y, --yes Skip all prompts and initialize an empty project
346
346
  ```
347
347
 
348
- _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\start.ts)_
348
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\start.ts)_
349
349
 
350
350
  ## `learnpack test [EXERCISESLUG]`
351
351
 
@@ -362,7 +362,7 @@ OPTIONS
362
362
  -y, --yes Skip all prompts and initialize an empty project
363
363
  ```
364
364
 
365
- _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\test.ts)_
365
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\test.ts)_
366
366
 
367
367
  ## `learnpack translate`
368
368
 
@@ -376,7 +376,7 @@ OPTIONS
376
376
  -y, --yes Skip all prompts and initialize an empty project
377
377
  ```
378
378
 
379
- _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.29/src\commands\translate.ts)_
379
+ _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.30/src\commands\translate.ts)_
380
380
  <!-- commandsstop -->
381
381
 
382
382
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
@@ -1,27 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // import {Command, flags} from '@oclif/command'
4
- // import { prompt } from "enquirer"
5
- // import fetch from 'node-fetch'
6
3
  const SessionCommand_1 = require("../utils/SessionCommand");
7
4
  const session_1 = require("../managers/session");
8
- // import Console from '../utils/console'
9
- // import { replace } from 'node-emoji'
10
- // import { validURL } from "../utils/validators"
11
- // const BaseCommand from '../utils/BaseCommand');
5
+ const console_1 = require("../utils/console");
12
6
  class LogoutCommand extends SessionCommand_1.default {
13
7
  async init() {
14
8
  const { flags } = this.parse(LogoutCommand);
15
- await this.initSession(flags);
9
+ // await this.initSession(flags)
10
+ console_1.default.debug("Logout command");
16
11
  }
17
12
  async run() {
18
13
  // const {flags, args} = this.parse(LogoutCommand)
19
14
  session_1.default.destroy();
20
15
  }
21
16
  }
22
- LogoutCommand.description = `Describe the command here
23
- ...
24
- Extra documentation goes here
17
+ LogoutCommand.description = `Describe the command here
18
+ ...
19
+ Extra documentation goes here
25
20
  `;
26
21
  LogoutCommand.flags = {
27
22
  // name: flags.string({char: 'n', description: 'name to print'}),
@@ -94,14 +94,11 @@ class StartCommand extends SessionCommand_1.default {
94
94
  });
95
95
  socket_1.default.on("open_window", (data) => {
96
96
  console_1.default.debug("Opening window: ", data);
97
- console.log("config.os", config.os);
98
97
  // cli.open(data.url); This uses XDG under the ground
99
98
  if (config.os !== "linux" || (config.os === "linux" && hasXDG)) {
100
- console.log("Opening window with XDG");
101
99
  osOperations_1.eventManager.enqueue(dispatcher.events.OPEN_WINDOW, data);
102
100
  }
103
101
  else {
104
- console.log("Opening window without XDG");
105
102
  dispatcher.enqueue(dispatcher.events.OPEN_WINDOW, data);
106
103
  }
107
104
  socket_1.default.log("open_window", "", undefined, data.url);
@@ -372,6 +372,31 @@ exports.default = async ({ grading, mode, disableGrading, version, }) => {
372
372
  [(0, exercise_1.exercise)(((_b = configObj === null || configObj === void 0 ? void 0 : configObj.config) === null || _b === void 0 ? void 0 : _b.exercisesPath) || "", 0, configObj)];
373
373
  this.save();
374
374
  },
375
+ createExercise: (slug, content, language) => {
376
+ var _a;
377
+ try {
378
+ const dirPath = `${(_a = configObj.config) === null || _a === void 0 ? void 0 : _a.exercisesPath}/${slug}`;
379
+ if (!fs.existsSync(dirPath))
380
+ fs.mkdirSync(dirPath, { recursive: true });
381
+ const isEnglish = language === "us" || language === "en";
382
+ const fileName = isEnglish ? "README.md" : `README.${language}.md`;
383
+ fs.writeFileSync(`${dirPath}/${fileName}`, content);
384
+ return true;
385
+ }
386
+ catch (error) {
387
+ console_1.default.error("Error creating exercise: ", error);
388
+ return false;
389
+ }
390
+ },
391
+ deleteExercise: (slug) => {
392
+ var _a;
393
+ const dirPath = `${(_a = configObj.config) === null || _a === void 0 ? void 0 : _a.exercisesPath}/${slug}`;
394
+ if (fs.existsSync(dirPath)) {
395
+ fs.rmSync(dirPath, { recursive: true, force: true });
396
+ return true;
397
+ }
398
+ return false;
399
+ },
375
400
  watchIndex: function (onChange) {
376
401
  var _a;
377
402
  if (configObj.config && !configObj.config.exercisesPath)
@@ -423,66 +448,66 @@ function deepMerge(...sources) {
423
448
  return acc;
424
449
  }
425
450
  const buildAgentWarning = (current, suggested) => {
426
- const message = `# Agent mismatch!\n
427
-
428
- In LearnPack, the agent is in charge of running the LearnPack interface.
429
-
430
- You're currently using LearnPack through \`${current}\` but the suggested agent is \`${suggested}\`.
431
-
432
- We recommend strongly recommend changing your agent.
433
-
434
- ${stepsToChangeAgent(suggested)}
451
+ const message = `# Agent mismatch!\n
452
+
453
+ In LearnPack, the agent is in charge of running the LearnPack interface.
454
+
455
+ You're currently using LearnPack through \`${current}\` but the suggested agent is \`${suggested}\`.
456
+
457
+ We recommend strongly recommend changing your agent.
458
+
459
+ ${stepsToChangeAgent(suggested)}
435
460
  `;
436
461
  return message;
437
462
  };
438
463
  const stepsToChangeAgent = (agent) => {
439
464
  if (agent === "vscode") {
440
- return `
441
- # Steps to Change Agent to VSCode
442
-
443
- 1. **Install VSCode**:
444
- - Visit the [VSCode website](https://code.visualstudio.com/Download) and download the latest version.
445
- - Follow the installation instructions for your operating system.
446
-
447
- 2. **Install LearnPack VSCode Extension**:
448
- - Open VSCode.
449
- - Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing \`Ctrl+Shift+X\`.
450
- - Search for "LearnPack" and click "Install".
451
- - If the extension is already installed but disabled, enable it.
452
-
453
- 3. **Run LearnPack in VSCode**:
454
- - Open your terminal in VSCode.
455
- - Navigate to your LearnPack project directory.
456
- - Run the following command:
457
- \`\`\`sh
458
- learnpack start
459
- \`\`\`
460
-
461
- We strongly recommend using VSCode for a better learning experience.
465
+ return `
466
+ # Steps to Change Agent to VSCode
467
+
468
+ 1. **Install VSCode**:
469
+ - Visit the [VSCode website](https://code.visualstudio.com/Download) and download the latest version.
470
+ - Follow the installation instructions for your operating system.
471
+
472
+ 2. **Install LearnPack VSCode Extension**:
473
+ - Open VSCode.
474
+ - Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing \`Ctrl+Shift+X\`.
475
+ - Search for "LearnPack" and click "Install".
476
+ - If the extension is already installed but disabled, enable it.
477
+
478
+ 3. **Run LearnPack in VSCode**:
479
+ - Open your terminal in VSCode.
480
+ - Navigate to your LearnPack project directory.
481
+ - Run the following command:
482
+ \`\`\`sh
483
+ learnpack start
484
+ \`\`\`
485
+
486
+ We strongly recommend using VSCode for a better learning experience.
462
487
  `;
463
488
  }
464
489
  if (agent === "os") {
465
- return `
466
- # Steps to Change Agent to OS
467
-
468
- This learning package was designed to run outside of VSCode. We strongly recommend closing VSCode and running the package independently.
469
-
470
- 1. **Close VSCode**:
471
- - Save your work and close the VSCode application.
472
-
473
- 2. **Open a New Terminal**:
474
- - Open a terminal or command prompt on your operating system.
475
-
476
- 3. **Navigate to Your LearnPack Project Directory**:
477
- - Use the \`cd\` command to navigate to the directory where your LearnPack project is located.
478
-
479
- 4. **Run LearnPack**:
480
- - Run the following command to start LearnPack:
481
- \`\`\`sh
482
- learnpack start
483
- \`\`\`
484
-
485
- We strongly recommend running the package independently for a better learning experience.
490
+ return `
491
+ # Steps to Change Agent to OS
492
+
493
+ This learning package was designed to run outside of VSCode. We strongly recommend closing VSCode and running the package independently.
494
+
495
+ 1. **Close VSCode**:
496
+ - Save your work and close the VSCode application.
497
+
498
+ 2. **Open a New Terminal**:
499
+ - Open a terminal or command prompt on your operating system.
500
+
501
+ 3. **Navigate to Your LearnPack Project Directory**:
502
+ - Use the \`cd\` command to navigate to the directory where your LearnPack project is located.
503
+
504
+ 4. **Run LearnPack**:
505
+ - Run the following command to start LearnPack:
506
+ \`\`\`sh
507
+ learnpack start
508
+ \`\`\`
509
+
510
+ We strongly recommend running the package independently for a better learning experience.
486
511
  `;
487
512
  }
488
513
  return "";
@@ -508,31 +533,31 @@ const isExtensionInstalled = (extensionName) => {
508
533
  const result = shell.exec("code --list-extensions", { silent: true });
509
534
  return result.stdout.split("\n").includes(extensionName);
510
535
  };
511
- const EXTENSION_INSTALLATION_STEPS = `
512
- # Steps to Install LearnPack VSCode Extension
513
-
514
- 1. **Open VSCode**:
515
- - Launch the Visual Studio Code application on your computer.
516
-
517
- 2. **Go to Extensions View**:
518
- - Click on the Extensions icon in the Activity Bar on the side of the window.
519
- - Alternatively, you can open the Extensions view by pressing \`Ctrl+Shift+X\`.
520
-
521
- 3. **Search for LearnPack**:
522
- - In the Extensions view, type "LearnPack" into the search bar.
523
-
524
- 4. **Install the Extension**:
525
- - Find the "LearnPack" extension in the search results and click the "Install" button.
526
- - If the extension is already installed but disabled, click the "Enable" button.
527
-
528
- 5. **Verify Installation**:
529
- - Once installed, you can verify the installation by running the following command in the terminal:
530
- \`\`\`sh
531
- code --list-extensions | grep learn-pack.learnpack-vscode
532
- \`\`\`
533
- - If the extension is listed, it means the installation was successful.
534
-
535
- We strongly recommend using the LearnPack extension in VSCode for a better learning experience.
536
+ const EXTENSION_INSTALLATION_STEPS = `
537
+ # Steps to Install LearnPack VSCode Extension
538
+
539
+ 1. **Open VSCode**:
540
+ - Launch the Visual Studio Code application on your computer.
541
+
542
+ 2. **Go to Extensions View**:
543
+ - Click on the Extensions icon in the Activity Bar on the side of the window.
544
+ - Alternatively, you can open the Extensions view by pressing \`Ctrl+Shift+X\`.
545
+
546
+ 3. **Search for LearnPack**:
547
+ - In the Extensions view, type "LearnPack" into the search bar.
548
+
549
+ 4. **Install the Extension**:
550
+ - Find the "LearnPack" extension in the search results and click the "Install" button.
551
+ - If the extension is already installed but disabled, click the "Enable" button.
552
+
553
+ 5. **Verify Installation**:
554
+ - Once installed, you can verify the installation by running the following command in the terminal:
555
+ \`\`\`sh
556
+ code --list-extensions | grep learn-pack.learnpack-vscode
557
+ \`\`\`
558
+ - If the extension is listed, it means the installation was successful.
559
+
560
+ We strongly recommend using the LearnPack extension in VSCode for a better learning experience.
536
561
  `;
537
562
  /**
538
563
  * Installs the LearnPack VSCode extension if the 'code' command is available.
@@ -92,7 +92,7 @@ const download = (url, dest) => {
92
92
  });
93
93
  file.on("error", err => {
94
94
  file.close();
95
- if (err.code === "EEXIST") {
95
+ if (err.name === "EEXIST") {
96
96
  console_1.default.debug("File already exists");
97
97
  resolve("File already exists");
98
98
  }
@@ -265,6 +265,36 @@ async function default_1(app, configObject, configManager) {
265
265
  res.end();
266
266
  }
267
267
  }));
268
+ app.delete("/exercise/:slug/delete", withHandler(async (req, res) => {
269
+ const exerciseDeleted = configManager.deleteExercise(req.params.slug);
270
+ if (exerciseDeleted) {
271
+ configManager.buildIndex();
272
+ res.json({ status: "ok" });
273
+ }
274
+ else {
275
+ res.status(500).json({ error: "Failed to delete exercise" });
276
+ }
277
+ }));
278
+ app.post("/exercise/:slug/create", jsonBodyParser, withHandler(async (req, res) => {
279
+ const { title, readme, language } = req.body;
280
+ const { slug } = req.params;
281
+ if (!title || !readme || !language) {
282
+ return res.status(400).json({ error: "Missing required fields" });
283
+ }
284
+ try {
285
+ const exerciseCreated = await configManager.createExercise(slug, readme, language);
286
+ if (exerciseCreated) {
287
+ configManager.buildIndex();
288
+ res.json({ status: "ok" });
289
+ }
290
+ else {
291
+ res.status(500).json({ error: "Failed to create exercise" });
292
+ }
293
+ }
294
+ catch (_a) {
295
+ res.status(500).json({ error: "Failed to create exercise" });
296
+ }
297
+ }));
268
298
  const textBodyParser = bodyParser.text();
269
299
  app.put("/exercise/:slug/file/:fileName", textBodyParser, withHandler((req, res) => {
270
300
  const exercise = configManager.getExercise(req.params.slug);
@@ -134,6 +134,9 @@ const Session = {
134
134
  }
135
135
  },
136
136
  destroy: async function () {
137
+ if (!this.sessionStarted) {
138
+ await this.initialize();
139
+ }
137
140
  await storage.clear();
138
141
  this.token = null;
139
142
  console_1.default.success("You have logged out");
@@ -13,6 +13,8 @@ export interface IConfigManager {
13
13
  getExercise: (slug: string | undefined) => IExercise;
14
14
  startExercise: (slug: string) => IExercise;
15
15
  reset: (slug: string) => void;
16
+ createExercise: (slug: string, content: string, language: string) => boolean;
17
+ deleteExercise: (slug: string) => boolean;
16
18
  buildIndex: () => boolean | void;
17
19
  watchIndex: (onChange: (...args: Array<any>) => void) => void;
18
20
  save: () => void;
@@ -1 +1 @@
1
- {"version":"5.0.29","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":[]},"breakToken":{"id":"breakToken","description":"Break the token","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"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":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"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":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"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":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"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":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[]}}}
1
+ {"version":"5.0.30","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":[]},"breakToken":{"id":"breakToken","description":"Break the token","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"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":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"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":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"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":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"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":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"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.29",
4
+ "version": "5.0.30",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -64,7 +64,7 @@
64
64
  "@types/js-yaml": "^4.0.9",
65
65
  "@types/mocha": "^5",
66
66
  "@types/mock-fs": "^4.13.1",
67
- "@types/node": "^10.17.60",
67
+ "@types/node": "^22.13.5",
68
68
  "@types/node-persist": "^3.1.2",
69
69
  "@types/prompts": "^2.0.14",
70
70
  "@types/shelljs": "^0.8.9",
@@ -1,43 +1,38 @@
1
- // import {Command, flags} from '@oclif/command'
2
- // import { prompt } from "enquirer"
3
- // import fetch from 'node-fetch'
4
- import SessionCommand from "../utils/SessionCommand"
5
- import SessionManager from "../managers/session"
6
- // import Console from '../utils/console'
7
- // import { replace } from 'node-emoji'
8
- // import { validURL } from "../utils/validators"
9
- // const BaseCommand from '../utils/BaseCommand');
10
-
11
- class LogoutCommand extends SessionCommand {
12
- static description = `Describe the command here
13
- ...
14
- Extra documentation goes here
15
- `
16
-
17
- static flags: any = {
18
- // name: flags.string({char: 'n', description: 'name to print'}),
19
- }
20
-
21
- static args = [
22
- {
23
- name: "package", // name of arg to show in help and reference with args[name]
24
- required: false, // make the arg required with `required: true`
25
- description:
26
- "The unique string that identifies this package on learnpack", // help description
27
- hidden: false, // hide this arg from help
28
- },
29
- ]
30
-
31
- async init() {
32
- const { flags } = this.parse(LogoutCommand)
33
- await this.initSession(flags)
34
- }
35
-
36
- async run() {
37
- // const {flags, args} = this.parse(LogoutCommand)
38
-
39
- SessionManager.destroy()
40
- }
41
- }
42
-
43
- export default LogoutCommand
1
+ import SessionCommand from "../utils/SessionCommand"
2
+ import SessionManager from "../managers/session"
3
+ import Console from "../utils/console"
4
+
5
+ class LogoutCommand extends SessionCommand {
6
+ static description = `Describe the command here
7
+ ...
8
+ Extra documentation goes here
9
+ `
10
+
11
+ static flags: any = {
12
+ // name: flags.string({char: 'n', description: 'name to print'}),
13
+ }
14
+
15
+ static args = [
16
+ {
17
+ name: "package", // name of arg to show in help and reference with args[name]
18
+ required: false, // make the arg required with `required: true`
19
+ description:
20
+ "The unique string that identifies this package on learnpack", // help description
21
+ hidden: false, // hide this arg from help
22
+ },
23
+ ]
24
+
25
+ async init() {
26
+ const { flags } = this.parse(LogoutCommand)
27
+ // await this.initSession(flags)
28
+ Console.debug("Logout command")
29
+ }
30
+
31
+ async run() {
32
+ // const {flags, args} = this.parse(LogoutCommand)
33
+
34
+ SessionManager.destroy()
35
+ }
36
+ }
37
+
38
+ export default LogoutCommand
@@ -189,14 +189,11 @@ export default class StartCommand extends SessionCommand {
189
189
 
190
190
  socket.on("open_window", (data: TOpenWindowData) => {
191
191
  Console.debug("Opening window: ", data)
192
- console.log("config.os", config.os)
193
192
 
194
193
  // cli.open(data.url); This uses XDG under the ground
195
194
  if (config.os !== "linux" || (config.os === "linux" && hasXDG)) {
196
- console.log("Opening window with XDG")
197
195
  eventManager.enqueue(dispatcher.events.OPEN_WINDOW, data)
198
196
  } else {
199
- console.log("Opening window without XDG")
200
197
  dispatcher.enqueue(dispatcher.events.OPEN_WINDOW, data)
201
198
  }
202
199