@learnpack/learnpack 5.0.7 → 5.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) 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 +30 -21
  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/oclif.manifest.json +1 -1
  10. package/package.json +152 -152
  11. package/src/commands/audit.ts +449 -443
  12. package/src/commands/clean.ts +29 -29
  13. package/src/commands/download.ts +61 -61
  14. package/src/commands/login.ts +42 -42
  15. package/src/commands/logout.ts +43 -43
  16. package/src/commands/publish.ts +249 -249
  17. package/src/commands/test.ts +85 -85
  18. package/src/index.ts +1 -1
  19. package/src/managers/config/allowed_files.ts +29 -29
  20. package/src/managers/gitpod.ts +84 -84
  21. package/src/managers/server/index.ts +78 -78
  22. package/src/managers/telemetry.ts +353 -353
  23. package/src/managers/test.ts +83 -83
  24. package/src/models/audit.ts +16 -16
  25. package/src/models/config-manager.ts +23 -23
  26. package/src/models/counter.ts +11 -11
  27. package/src/models/errors.ts +22 -22
  28. package/src/models/exercise-obj.ts +29 -29
  29. package/src/models/file.ts +5 -5
  30. package/src/models/findings.ts +18 -18
  31. package/src/models/flags.ts +10 -10
  32. package/src/models/front-matter.ts +11 -11
  33. package/src/models/gitpod-data.ts +19 -19
  34. package/src/models/language.ts +4 -4
  35. package/src/models/package.ts +7 -7
  36. package/src/models/plugin-config.ts +17 -17
  37. package/src/models/success-types.ts +1 -1
  38. package/src/plugin/command/compile.ts +17 -17
  39. package/src/plugin/command/test.ts +30 -30
  40. package/src/plugin/index.ts +6 -6
  41. package/src/plugin/plugin.ts +94 -94
  42. package/src/plugin/utils.ts +87 -87
  43. package/src/types/node-fetch.d.ts +1 -1
  44. package/src/ui/download.ts +71 -71
  45. package/src/utils/BaseCommand.ts +48 -48
  46. package/src/utils/SessionCommand.ts +43 -43
  47. package/src/utils/audit.ts +393 -393
  48. package/src/utils/errors.ts +117 -117
  49. package/src/utils/exercisesQueue.ts +51 -51
  50. package/src/utils/fileQueue.ts +199 -199
  51. package/src/utils/misc.ts +23 -23
  52. package/src/utils/osOperations.ts +79 -79
  53. package/src/utils/templates/gitignore.txt +19 -19
  54. package/src/utils/templates/incremental/.learn/exercises/01-hello-world/README.es.md +24 -24
  55. package/src/utils/templates/incremental/.learn/exercises/01-hello-world/README.md +24 -24
  56. package/src/utils/templates/incremental/.vscode/schema.json +121 -121
  57. package/src/utils/templates/incremental/.vscode/settings.json +13 -13
  58. package/src/utils/templates/incremental/README.ejs +4 -4
  59. package/src/utils/templates/incremental/README.es.ejs +4 -4
  60. package/src/utils/templates/isolated/.vscode/schema.json +121 -121
  61. package/src/utils/templates/isolated/.vscode/settings.json +13 -13
  62. package/src/utils/templates/isolated/README.ejs +4 -4
  63. package/src/utils/templates/isolated/README.es.ejs +4 -4
  64. package/src/utils/templates/no-grading/README.ejs +4 -4
  65. package/src/utils/templates/no-grading/README.es.ejs +4 -4
  66. package/src/utils/validators.ts +18 -18
  67. package/src/utils/watcher.ts +27 -27
@@ -1,29 +1,29 @@
1
- // import {flags} from '@oclif/command'
2
- import Console from "../utils/console"
3
- import SessionCommand from "../utils/SessionCommand"
4
-
5
- class CleanCommand extends SessionCommand {
6
- static description = `Clean the configuration object
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
- async init() {
16
- const { flags } = this.parse(CleanCommand)
17
- await this.initSession(flags)
18
- }
19
-
20
- async run() {
21
- const { flags } = this.parse(CleanCommand)
22
-
23
- this.configManager?.clean()
24
-
25
- Console.success("Package cleaned successfully, ready to publish")
26
- }
27
- }
28
-
29
- export default CleanCommand
1
+ // import {flags} from '@oclif/command'
2
+ import Console from "../utils/console"
3
+ import SessionCommand from "../utils/SessionCommand"
4
+
5
+ class CleanCommand extends SessionCommand {
6
+ static description = `Clean the configuration object
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
+ async init() {
16
+ const { flags } = this.parse(CleanCommand)
17
+ await this.initSession(flags)
18
+ }
19
+
20
+ async run() {
21
+ const { flags } = this.parse(CleanCommand)
22
+
23
+ this.configManager?.clean()
24
+
25
+ Console.success("Package cleaned successfully, ready to publish")
26
+ }
27
+ }
28
+
29
+ export default CleanCommand
@@ -1,61 +1,61 @@
1
- import { Command /* , flags */ } from "@oclif/command"
2
- // import fetch from 'node-fetch'
3
- import { clone } from "../managers/file"
4
- import Console from "../utils/console"
5
- import api from "../utils/api"
6
- import { askPackage } from "../ui/download"
7
- // const BaseCommand = require('../utils/BaseCommand');
8
-
9
- class DownloadCommand extends Command {
10
- static description = `Describe the command here
11
- ...
12
- Extra documentation goes here
13
- `
14
- static flags: any = {
15
- // name: flags.string({char: 'n', description: 'name to print'}),
16
- }
17
-
18
- static args = [
19
- {
20
- name: "package", // name of arg to show in help and reference with args[name]
21
- required: false, // make the arg required with `required: true`
22
- description:
23
- "The unique string that identifies this package on learnpack", // help description
24
- hidden: false, // hide this arg from help
25
- },
26
- ]
27
- // async init() {
28
- // const {flags} = this.parse(DownloadCommand)
29
- // await this.initSession(flags)
30
- // }
31
-
32
- async run() {
33
- const { /* flags, */ args } = this.parse(DownloadCommand)
34
- // start watching for file changes
35
- let _package: string = args.package
36
- if (!_package) {
37
- _package = (await askPackage()) as string
38
- }
39
-
40
- if (!_package) {
41
- return null
42
- }
43
-
44
- try {
45
- const packageInfo = await api.getAllPackages({ slug: _package })
46
- if (packageInfo.results.length === 0)
47
- Console.error(`Package ${_package} not found`)
48
- else
49
- clone(packageInfo.results[0].repository)
50
- .then(_result => {
51
- Console.success("Successfully downloaded")
52
- Console.info(
53
- `You can now CD into the folder like this: $ cd ${_package}`
54
- )
55
- })
56
- .catch(error => Console.error(error.message || error))
57
- } catch {}
58
- }
59
- }
60
-
61
- export default DownloadCommand
1
+ import { Command /* , flags */ } from "@oclif/command"
2
+ // import fetch from 'node-fetch'
3
+ import { clone } from "../managers/file"
4
+ import Console from "../utils/console"
5
+ import api from "../utils/api"
6
+ import { askPackage } from "../ui/download"
7
+ // const BaseCommand = require('../utils/BaseCommand');
8
+
9
+ class DownloadCommand extends Command {
10
+ static description = `Describe the command here
11
+ ...
12
+ Extra documentation goes here
13
+ `
14
+ static flags: any = {
15
+ // name: flags.string({char: 'n', description: 'name to print'}),
16
+ }
17
+
18
+ static args = [
19
+ {
20
+ name: "package", // name of arg to show in help and reference with args[name]
21
+ required: false, // make the arg required with `required: true`
22
+ description:
23
+ "The unique string that identifies this package on learnpack", // help description
24
+ hidden: false, // hide this arg from help
25
+ },
26
+ ]
27
+ // async init() {
28
+ // const {flags} = this.parse(DownloadCommand)
29
+ // await this.initSession(flags)
30
+ // }
31
+
32
+ async run() {
33
+ const { /* flags, */ args } = this.parse(DownloadCommand)
34
+ // start watching for file changes
35
+ let _package: string = args.package
36
+ if (!_package) {
37
+ _package = (await askPackage()) as string
38
+ }
39
+
40
+ if (!_package) {
41
+ return null
42
+ }
43
+
44
+ try {
45
+ const packageInfo = await api.getAllPackages({ slug: _package })
46
+ if (packageInfo.results.length === 0)
47
+ Console.error(`Package ${_package} not found`)
48
+ else
49
+ clone(packageInfo.results[0].repository)
50
+ .then(_result => {
51
+ Console.success("Successfully downloaded")
52
+ Console.info(
53
+ `You can now CD into the folder like this: $ cd ${_package}`
54
+ )
55
+ })
56
+ .catch(error => Console.error(error.message || error))
57
+ } catch {}
58
+ }
59
+ }
60
+
61
+ export default DownloadCommand
@@ -1,42 +1,42 @@
1
- import SessionCommand from "../utils/SessionCommand"
2
- import SessionManager from "../managers/session"
3
- import Console from "../utils/console"
4
-
5
- class LoginCommand 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(LoginCommand)
27
- await this.initSession(flags)
28
- }
29
-
30
- async run() {
31
- /* const {flags, args} = */ this.parse(LoginCommand)
32
-
33
- try {
34
- await SessionManager.login()
35
- } catch (error) {
36
- Console.error("Error trying to authenticate")
37
- Console.error((error as TypeError).message || (error as string))
38
- }
39
- }
40
- }
41
-
42
- export default LoginCommand
1
+ import SessionCommand from "../utils/SessionCommand"
2
+ import SessionManager from "../managers/session"
3
+ import Console from "../utils/console"
4
+
5
+ class LoginCommand 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(LoginCommand)
27
+ await this.initSession(flags)
28
+ }
29
+
30
+ async run() {
31
+ /* const {flags, args} = */ this.parse(LoginCommand)
32
+
33
+ try {
34
+ await SessionManager.login()
35
+ } catch (error) {
36
+ Console.error("Error trying to authenticate")
37
+ Console.error((error as TypeError).message || (error as string))
38
+ }
39
+ }
40
+ }
41
+
42
+ export default LoginCommand
@@ -1,43 +1,43 @@
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 {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