@learnpack/learnpack 5.0.9 → 5.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. package/README.md +17 -17
  2. package/bin/run +17 -17
  3. package/bin/run.cmd +3 -3
  4. package/lib/commands/audit.js +24 -27
  5. package/lib/commands/clean.js +3 -3
  6. package/lib/commands/download.js +3 -3
  7. package/lib/commands/login.js +3 -3
  8. package/lib/commands/logout.js +3 -3
  9. package/lib/commands/publish.js +8 -7
  10. package/lib/managers/config/index.d.ts +0 -10
  11. package/lib/managers/config/index.js +11 -3
  12. package/lib/managers/session.js +1 -1
  13. package/lib/utils/checkNotInstalled.js +3 -5
  14. package/oclif.manifest.json +1 -1
  15. package/package.json +152 -152
  16. package/src/commands/audit.ts +449 -449
  17. package/src/commands/clean.ts +29 -29
  18. package/src/commands/download.ts +61 -61
  19. package/src/commands/login.ts +42 -42
  20. package/src/commands/logout.ts +43 -43
  21. package/src/commands/publish.ts +9 -7
  22. package/src/commands/test.ts +85 -85
  23. package/src/index.ts +1 -1
  24. package/src/managers/config/allowed_files.ts +29 -29
  25. package/src/managers/config/index.ts +16 -6
  26. package/src/managers/gitpod.ts +84 -84
  27. package/src/managers/server/index.ts +78 -78
  28. package/src/managers/session.ts +2 -1
  29. package/src/managers/telemetry.ts +353 -353
  30. package/src/managers/test.ts +83 -83
  31. package/src/models/audit.ts +16 -16
  32. package/src/models/config-manager.ts +23 -23
  33. package/src/models/counter.ts +11 -11
  34. package/src/models/errors.ts +22 -22
  35. package/src/models/exercise-obj.ts +29 -29
  36. package/src/models/file.ts +5 -5
  37. package/src/models/findings.ts +18 -18
  38. package/src/models/flags.ts +10 -10
  39. package/src/models/front-matter.ts +11 -11
  40. package/src/models/gitpod-data.ts +19 -19
  41. package/src/models/language.ts +4 -4
  42. package/src/models/package.ts +7 -7
  43. package/src/models/plugin-config.ts +17 -17
  44. package/src/models/success-types.ts +1 -1
  45. package/src/plugin/command/compile.ts +17 -17
  46. package/src/plugin/command/test.ts +30 -30
  47. package/src/plugin/index.ts +6 -6
  48. package/src/plugin/plugin.ts +94 -94
  49. package/src/plugin/utils.ts +87 -87
  50. package/src/types/node-fetch.d.ts +1 -1
  51. package/src/ui/download.ts +71 -71
  52. package/src/utils/BaseCommand.ts +48 -48
  53. package/src/utils/SessionCommand.ts +43 -43
  54. package/src/utils/audit.ts +393 -393
  55. package/src/utils/checkNotInstalled.ts +10 -12
  56. package/src/utils/errors.ts +117 -117
  57. package/src/utils/exercisesQueue.ts +51 -51
  58. package/src/utils/fileQueue.ts +199 -199
  59. package/src/utils/misc.ts +23 -23
  60. package/src/utils/osOperations.ts +79 -79
  61. package/src/utils/templates/gitignore.txt +19 -19
  62. package/src/utils/templates/incremental/.learn/exercises/01-hello-world/README.es.md +24 -24
  63. package/src/utils/templates/incremental/.learn/exercises/01-hello-world/README.md +24 -24
  64. package/src/utils/templates/incremental/.vscode/schema.json +121 -121
  65. package/src/utils/templates/incremental/.vscode/settings.json +13 -13
  66. package/src/utils/templates/incremental/README.ejs +4 -4
  67. package/src/utils/templates/incremental/README.es.ejs +4 -4
  68. package/src/utils/templates/isolated/.vscode/schema.json +121 -121
  69. package/src/utils/templates/isolated/.vscode/settings.json +13 -13
  70. package/src/utils/templates/isolated/README.ejs +4 -4
  71. package/src/utils/templates/isolated/README.es.ejs +4 -4
  72. package/src/utils/templates/no-grading/README.ejs +4 -4
  73. package/src/utils/templates/no-grading/README.es.ejs +4 -4
  74. package/src/utils/validators.ts +18 -18
  75. package/src/utils/watcher.ts +27 -27
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.9 darwin-arm64 node-v16.20.0
24
+ @learnpack/learnpack/5.0.10 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.9/src/commands/audit.ts)_
78
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/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.9/src/commands/clean.ts)_
93
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/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.9/src/commands/download.ts)_
111
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/src\commands\download.ts)_
112
112
 
113
113
  ## `learnpack help [COMMAND]`
114
114
 
@@ -125,7 +125,7 @@ OPTIONS
125
125
  --all see all commands in CLI
126
126
  ```
127
127
 
128
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.1.0/src/commands/help.ts)_
128
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.1.0/src\commands\help.ts)_
129
129
 
130
130
  ## `learnpack init`
131
131
 
@@ -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.9/src/commands/init.ts)_
142
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/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.9/src/commands/login.ts)_
160
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/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.9/src/commands/logout.ts)_
178
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/src\commands\logout.ts)_
179
179
 
180
180
  ## `learnpack plugins`
181
181
 
@@ -192,7 +192,7 @@ EXAMPLE
192
192
  $ learnpack plugins
193
193
  ```
194
194
 
195
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src/commands/plugins/index.ts)_
195
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\index.ts)_
196
196
 
197
197
  ## `learnpack plugins:install PLUGIN...`
198
198
 
@@ -228,7 +228,7 @@ EXAMPLES
228
228
  $ learnpack plugins:install someuser/someplugin
229
229
  ```
230
230
 
231
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src/commands/plugins/install.ts)_
231
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\install.ts)_
232
232
 
233
233
  ## `learnpack plugins:link PLUGIN`
234
234
 
@@ -255,7 +255,7 @@ EXAMPLE
255
255
  $ learnpack plugins:link myplugin
256
256
  ```
257
257
 
258
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src/commands/plugins/link.ts)_
258
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\link.ts)_
259
259
 
260
260
  ## `learnpack plugins:uninstall PLUGIN...`
261
261
 
@@ -277,7 +277,7 @@ ALIASES
277
277
  $ learnpack plugins:remove
278
278
  ```
279
279
 
280
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src/commands/plugins/uninstall.ts)_
280
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\uninstall.ts)_
281
281
 
282
282
  ## `learnpack plugins:update`
283
283
 
@@ -292,7 +292,7 @@ OPTIONS
292
292
  -v, --verbose
293
293
  ```
294
294
 
295
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src/commands/plugins/update.ts)_
295
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\update.ts)_
296
296
 
297
297
  ## `learnpack publish`
298
298
 
@@ -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.9/src/commands/publish.ts)_
309
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/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.9/src/commands/start.ts)_
330
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/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.9/src/commands/test.ts)_
344
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/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.9/src/commands/translate.ts)_
355
+ _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.10/src\commands\translate.ts)_
356
356
  <!-- commandsstop -->
357
357
 
358
358
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
package/bin/run CHANGED
@@ -1,17 +1,17 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs')
4
- const path = require('path')
5
- const project = path.join(__dirname, '../tsconfig.json')
6
- const dev = fs.existsSync(project)
7
-
8
- if (dev) {
9
- require('ts-node').register({project})
10
- }
11
-
12
- require(`../${dev ? 'src' : 'lib'}`).run()
13
- .catch(require('@oclif/errors/handle'))
14
-
15
- /*require('@oclif/command').run()
16
- .then(require('@oclif/command/flush'))
17
- .catch(require('@oclif/errors/handle'))*/
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs')
4
+ const path = require('path')
5
+ const project = path.join(__dirname, '../tsconfig.json')
6
+ const dev = fs.existsSync(project)
7
+
8
+ if (dev) {
9
+ require('ts-node').register({project})
10
+ }
11
+
12
+ require(`../${dev ? 'src' : 'lib'}`).run()
13
+ .catch(require('@oclif/errors/handle'))
14
+
15
+ /*require('@oclif/command').run()
16
+ .then(require('@oclif/command/flush'))
17
+ .catch(require('@oclif/errors/handle'))*/
package/bin/run.cmd CHANGED
@@ -1,3 +1,3 @@
1
- @echo off
2
-
3
- node "%~dp0\run" %*
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
@@ -6,7 +6,6 @@ const console_1 = require("../utils/console");
6
6
  const audit_1 = require("../utils/audit");
7
7
  const SessionCommand_1 = require("../utils/SessionCommand");
8
8
  const path = require("path");
9
- const index_1 = require("../managers/config/index");
10
9
  // eslint-disable-next-line
11
10
  const fetch = require("node-fetch");
12
11
  class AuditCommand extends SessionCommand_1.default {
@@ -17,17 +16,6 @@ class AuditCommand extends SessionCommand_1.default {
17
16
  async run() {
18
17
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
19
18
  console_1.default.log("Running command audit...");
20
- // Checking the "learn.json" file:
21
- let learnjson;
22
- try {
23
- const configPath = (0, index_1.getConfigPath)().config;
24
- const learnJsonContent = fs.readFileSync(configPath);
25
- learnjson = JSON.parse(learnJsonContent.toString());
26
- }
27
- catch (_error) {
28
- console_1.default.error("Invalid JSON syntax in learn.json file:", _error.message);
29
- process.exit(1);
30
- }
31
19
  // Get configuration object.
32
20
  let config = (_a = this.configManager) === null || _a === void 0 ? void 0 : _a.get();
33
21
  if (config) {
@@ -248,6 +236,15 @@ class AuditCommand extends SessionCommand_1.default {
248
236
  }
249
237
  else {
250
238
  // This is the audit code for Projects
239
+ // Checking the "learn.json" file:
240
+ let learnjson;
241
+ try {
242
+ learnjson = JSON.parse(fs.readFileSync("./learn.json").toString());
243
+ }
244
+ catch (_error) {
245
+ console_1.default.error("Invalid JSON syntax in learn.json file:", _error.message);
246
+ process.exit(1);
247
+ }
251
248
  if (!learnjson) {
252
249
  console_1.default.error("There is no learn.json file located in the root of the project.");
253
250
  process.exit(1);
@@ -332,21 +329,21 @@ class AuditCommand extends SessionCommand_1.default {
332
329
  }
333
330
  }
334
331
  }
335
- AuditCommand.description = `learnpack audit is the command in charge of creating an auditory of the repository
336
- ...
337
- learnpack audit checks for the following information in a repository:
338
- 1. The configuration object has slug, repository and description. (Error)
339
- 2. The command learnpack clean has been run. (Error)
340
- 3. If a markdown or test file doesn't have any content. (Error)
341
- 4. The links are accessing to valid servers. (Error)
342
- 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)
343
- 6. The external images are working (If they are pointing to a valid server). (Error)
344
- 7. The exercises directory names are valid. (Error)
345
- 8. If an exercise doesn't have a README file. (Error)
346
- 9. The exercises array (Of the config file) has content. (Error)
347
- 10. The exercses have the same translations. (Warning)
348
- 11. The .gitignore file exists. (Warning)
349
- 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
332
+ AuditCommand.description = `learnpack audit is the command in charge of creating an auditory of the repository
333
+ ...
334
+ learnpack audit checks for the following information in a repository:
335
+ 1. The configuration object has slug, repository and description. (Error)
336
+ 2. The command learnpack clean has been run. (Error)
337
+ 3. If a markdown or test file doesn't have any content. (Error)
338
+ 4. The links are accessing to valid servers. (Error)
339
+ 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)
340
+ 6. The external images are working (If they are pointing to a valid server). (Error)
341
+ 7. The exercises directory names are valid. (Error)
342
+ 8. If an exercise doesn't have a README file. (Error)
343
+ 9. The exercises array (Of the config file) has content. (Error)
344
+ 10. The exercses have the same translations. (Warning)
345
+ 11. The .gitignore file exists. (Warning)
346
+ 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
350
347
  `;
351
348
  AuditCommand.flags = {
352
349
  // name: flags.string({char: 'n', description: 'name to print'}),
@@ -15,9 +15,9 @@ class CleanCommand extends SessionCommand_1.default {
15
15
  console_1.default.success("Package cleaned successfully, ready to publish");
16
16
  }
17
17
  }
18
- CleanCommand.description = `Clean the configuration object
19
- ...
20
- Extra documentation goes here
18
+ CleanCommand.description = `Clean the configuration object
19
+ ...
20
+ Extra documentation goes here
21
21
  `;
22
22
  CleanCommand.flags = {
23
23
  // name: flags.string({char: 'n', description: 'name to print'}),
@@ -37,9 +37,9 @@ class DownloadCommand extends command_1.Command {
37
37
  catch (_a) { }
38
38
  }
39
39
  }
40
- DownloadCommand.description = `Describe the command here
41
- ...
42
- Extra documentation goes here
40
+ DownloadCommand.description = `Describe the command here
41
+ ...
42
+ Extra documentation goes here
43
43
  `;
44
44
  DownloadCommand.flags = {
45
45
  // name: flags.string({char: 'n', description: 'name to print'}),
@@ -19,9 +19,9 @@ class LoginCommand extends SessionCommand_1.default {
19
19
  }
20
20
  }
21
21
  }
22
- LoginCommand.description = `Describe the command here
23
- ...
24
- Extra documentation goes here
22
+ LoginCommand.description = `Describe the command here
23
+ ...
24
+ Extra documentation goes here
25
25
  `;
26
26
  LoginCommand.flags = {
27
27
  // name: flags.string({char: 'n', description: 'name to print'}),
@@ -19,9 +19,9 @@ class LogoutCommand extends SessionCommand_1.default {
19
19
  session_1.default.destroy();
20
20
  }
21
21
  }
22
- LogoutCommand.description = `Describe the command here
23
- ...
24
- Extra documentation goes here
22
+ LogoutCommand.description = `Describe the command here
23
+ ...
24
+ Extra documentation goes here
25
25
  `;
26
26
  LogoutCommand.flags = {
27
27
  // name: flags.string({char: 'n', description: 'name to print'}),
@@ -22,16 +22,10 @@ class BuildCommand extends SessionCommand_1.default {
22
22
  await this.initSession(flags);
23
23
  }
24
24
  async run() {
25
- var _a, _b;
25
+ var _a, _b, _c;
26
26
  const buildDir = path.join(process.cwd(), "build");
27
27
  // this.configManager?.clean()
28
28
  const configObject = (_a = this.configManager) === null || _a === void 0 ? void 0 : _a.get();
29
- // Console.success("Package cleaned successfully, ready to publish")
30
- if (configObject) {
31
- // build exerises
32
- console_1.default.debug("Building exercises");
33
- (_b = this.configManager) === null || _b === void 0 ? void 0 : _b.buildIndex();
34
- }
35
29
  let sessionPayload = await session_1.default.getPayload();
36
30
  if (!sessionPayload || !sessionPayload.rigobot) {
37
31
  console_1.default.error("You must be logged in to upload a LearnPack package");
@@ -44,6 +38,13 @@ class BuildCommand extends SessionCommand_1.default {
44
38
  }
45
39
  }
46
40
  const rigoToken = sessionPayload.rigobot.key;
41
+ if (configObject) {
42
+ console_1.default.info("Cleaning configuration files");
43
+ (_b = this.configManager) === null || _b === void 0 ? void 0 : _b.clean();
44
+ // build exerises
45
+ console_1.default.debug("Building exercises");
46
+ (_c = this.configManager) === null || _c === void 0 ? void 0 : _c.buildIndex();
47
+ }
47
48
  // const rigoToken = "417d612d226a1606ad3a4e94b1881a9f0124b667"
48
49
  // Read learn.json to get the slug
49
50
  const learnJsonPath = path.join(process.cwd(), "learn.json");
@@ -1,13 +1,3 @@
1
1
  import { IConfigManagerAttributes, IConfigManager } from "../../models/config-manager";
2
- /**
3
- * Retrieves the configuration path for the learnpack package.
4
- *
5
- * @returns An object containing the configuration file path and the base directory.
6
- * @throws NotFoundError if the learn.json file is not found in the current folder.
7
- */
8
- export declare const getConfigPath: () => {
9
- config: string;
10
- base: string;
11
- };
12
2
  declare const _default: ({ grading, mode, disableGrading, version, }: IConfigManagerAttributes) => Promise<IConfigManager>;
13
3
  export default _default;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfigPath = void 0;
4
3
  const path = require("path");
5
4
  const fs = require("fs");
6
5
  const shell = require("shelljs");
@@ -34,7 +33,6 @@ const getConfigPath = () => {
34
33
  throw (0, errors_1.NotFoundError)("learn.json file not found on current folder, is this a learnpack package?");
35
34
  return { config, base: ".learn" };
36
35
  };
37
- exports.getConfigPath = getConfigPath;
38
36
  const getExercisesPath = (base) => {
39
37
  const possibleFileNames = ["./exercises", base + "/exercises", "./"];
40
38
  return possibleFileNames.find(file => fs.existsSync(file)) || null;
@@ -63,7 +61,7 @@ const getCodespacesNamespace = () => {
63
61
  };
64
62
  exports.default = async ({ grading, mode, disableGrading, version, }) => {
65
63
  var _a, _b, _c, _d, _e, _f;
66
- const confPath = (0, exports.getConfigPath)();
64
+ const confPath = getConfigPath();
67
65
  console_1.default.debug("This is the config path: ", confPath);
68
66
  let configObj = {};
69
67
  if (confPath) {
@@ -276,6 +274,16 @@ exports.default = async ({ grading, mode, disableGrading, version, }) => {
276
274
  (0, file_1.rmSync)(configObj.config.dirPath + "/reports");
277
275
  (0, file_1.rmSync)(configObj.config.dirPath + "/.session");
278
276
  (0, file_1.rmSync)(configObj.config.dirPath + "/resets");
277
+ // clean __pycache__ folder
278
+ (0, file_1.rmSync)(configObj.config.dirPath + "/../__pycache__");
279
+ // clean the __pycache__ for each exercise it exists
280
+ if (configObj.exercises) {
281
+ for (const e of configObj.exercises) {
282
+ if (fs.existsSync(e.path + "/__pycache__")) {
283
+ (0, file_1.rmSync)(e.path + "/__pycache__");
284
+ }
285
+ }
286
+ }
279
287
  // clean tag gz
280
288
  if (fs.existsSync(configObj.config.dirPath + "/app.tar.gz"))
281
289
  fs.unlinkSync(configObj.config.dirPath + "/app.tar.gz");
@@ -93,7 +93,7 @@ const Session = {
93
93
  if (data) {
94
94
  console_1.default.debug("Login successfull");
95
95
  // cli.log(data)
96
- this.start({ token: data.token, payload: data });
96
+ await this.start({ token: data.token, payload: data });
97
97
  return data;
98
98
  }
99
99
  },
@@ -125,10 +125,7 @@ const installDependencies = async (deps, packageManager) => {
125
125
  };
126
126
  const checkNotInstalledDependencies = async (neededPlugins) => {
127
127
  console_1.default.info("Checking needed dependencies...");
128
- const jsPluginsDependencies = [
129
- "jest@29.7.0",
130
- "jest-environment-jsdom@29.7.0",
131
- ];
128
+ const jsPluginsDependencies = ["jest@29.7.0", "jest-environment-jsdom@29.7.0"];
132
129
  const pyPluginsDependencies = ["pytest==6.2.5", "pytest-testdox", "mock"];
133
130
  const npmLsCommand = "npm ls jest jest-environment-jsdom -g";
134
131
  let pytestNeeded = false;
@@ -139,7 +136,7 @@ const checkNotInstalledDependencies = async (neededPlugins) => {
139
136
  neededPlugins.includes("@learnpack/node")) {
140
137
  jestNeeded = true;
141
138
  }
142
- if ("@learnpack/python" in neededPlugins) {
139
+ if (neededPlugins.includes("@learnpack/python")) {
143
140
  pytestNeeded = true;
144
141
  }
145
142
  if (jestNeeded) {
@@ -162,6 +159,7 @@ const checkNotInstalledDependencies = async (neededPlugins) => {
162
159
  await installDependencies(jsPluginsDependencies, "npm");
163
160
  }
164
161
  if (pytestNeeded) {
162
+ console.log("Trying to install pytest dependencies");
165
163
  const { stdout, stderr } = await exec("pip list");
166
164
  if (stderr) {
167
165
  console_1.default.error(`Error executing pip list. Use debug for more info`);
@@ -1 +1 @@
1
- {"version":"5.0.9","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.10","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":[]}}}