@learnpack/learnpack 5.0.275 → 5.0.276

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.
Files changed (71) hide show
  1. package/README.md +409 -409
  2. package/lib/commands/audit.js +15 -15
  3. package/lib/commands/breakToken.js +19 -19
  4. package/lib/commands/clean.js +3 -3
  5. package/lib/commands/init.js +41 -41
  6. package/lib/commands/logout.js +3 -3
  7. package/lib/commands/publish.js +5 -10
  8. package/lib/commands/serve.js +3 -2
  9. package/lib/creatorDist/assets/index-BfLyIQVh.js +10343 -10224
  10. package/lib/managers/config/index.js +77 -77
  11. package/lib/utils/api.d.ts +1 -1
  12. package/lib/utils/api.js +12 -9
  13. package/lib/utils/creatorUtilities.js +14 -14
  14. package/package.json +1 -1
  15. package/src/commands/audit.ts +487 -487
  16. package/src/commands/breakToken.ts +67 -67
  17. package/src/commands/clean.ts +30 -30
  18. package/src/commands/init.ts +650 -650
  19. package/src/commands/logout.ts +38 -38
  20. package/src/commands/publish.ts +20 -25
  21. package/src/commands/serve.ts +8 -3
  22. package/src/commands/start.ts +333 -333
  23. package/src/commands/translate.ts +123 -123
  24. package/src/creator/README.md +54 -54
  25. package/src/creator/eslint.config.js +28 -28
  26. package/src/creator/src/components/syllabus/ContentIndex.tsx +312 -312
  27. package/src/creator/src/i18n.ts +28 -28
  28. package/src/creator/src/index.css +217 -217
  29. package/src/creator/src/locales/en.json +126 -126
  30. package/src/creator/src/locales/es.json +126 -126
  31. package/src/creator/src/utils/configTypes.ts +122 -122
  32. package/src/creator/src/utils/constants.ts +13 -13
  33. package/src/creator/src/utils/creatorUtils.ts +46 -46
  34. package/src/creator/src/utils/eventBus.ts +2 -2
  35. package/src/creator/src/utils/lib.ts +468 -468
  36. package/src/creator/src/utils/socket.ts +61 -61
  37. package/src/creator/src/utils/store.ts +222 -222
  38. package/src/creator/src/vite-env.d.ts +1 -1
  39. package/src/creator/vite.config.ts +13 -13
  40. package/src/creatorDist/assets/index-BfLyIQVh.js +10343 -10224
  41. package/src/managers/config/defaults.ts +49 -49
  42. package/src/managers/config/exercise.ts +364 -364
  43. package/src/managers/config/index.ts +775 -775
  44. package/src/managers/file.ts +236 -236
  45. package/src/managers/server/routes.ts +554 -554
  46. package/src/managers/session.ts +182 -182
  47. package/src/managers/telemetry.ts +188 -188
  48. package/src/models/action.ts +13 -13
  49. package/src/models/config-manager.ts +28 -28
  50. package/src/models/config.ts +106 -106
  51. package/src/models/creator.ts +47 -47
  52. package/src/models/exercise-obj.ts +30 -30
  53. package/src/models/session.ts +39 -39
  54. package/src/models/socket.ts +61 -61
  55. package/src/models/status.ts +16 -16
  56. package/src/ui/_app/app.css +1 -1
  57. package/src/ui/_app/app.js +366 -363
  58. package/src/ui/app.tar.gz +0 -0
  59. package/src/utils/BaseCommand.ts +56 -56
  60. package/src/utils/api.ts +53 -39
  61. package/src/utils/audit.ts +392 -392
  62. package/src/utils/checkNotInstalled.ts +267 -267
  63. package/src/utils/configBuilder.ts +82 -82
  64. package/src/utils/convertCreds.js +34 -34
  65. package/src/utils/creatorUtilities.ts +504 -504
  66. package/src/utils/incrementVersion.js +74 -74
  67. package/src/utils/misc.ts +58 -58
  68. package/src/utils/rigoActions.ts +500 -500
  69. package/src/utils/sidebarGenerator.ts +195 -195
  70. package/src/utils/templates/isolated/exercises/01-hello-world/README.es.md +26 -26
  71. package/src/utils/templates/isolated/exercises/01-hello-world/README.md +26 -26
package/src/ui/app.tar.gz CHANGED
Binary file
@@ -1,56 +1,56 @@
1
- import { Command, flags } from "@oclif/command"
2
- import Console from "./console"
3
- import { createInterface } from "readline"
4
- // import SessionManager from '../managers/session'
5
-
6
- class BaseCommand extends Command {
7
- async catch(err: any) {
8
- Console.debug("COMMAND CATCH", err)
9
-
10
- throw err
11
- }
12
-
13
- async init() {
14
- const { flags, args } = this.parse(BaseCommand)
15
- Console.debug("COMMAND INIT")
16
- Console.debug("These are your flags: ", flags)
17
- Console.debug("These are your args: ", args)
18
-
19
- // quick fix for listening to the process termination on windows
20
- if (process.platform === "win32") {
21
- const rl = createInterface({
22
- input: process.stdin,
23
- output: process.stdout,
24
- })
25
-
26
- rl.on("SIGINT", function () {
27
- // process.emit('SIGINT')
28
- // process.emit('SIGINT')
29
- })
30
- }
31
-
32
- process.on("SIGINT", function () {
33
- Console.debug("Terminated (SIGINT)")
34
- process.exit()
35
- })
36
- }
37
-
38
- async finally() {
39
- Console.debug("COMMAND FINALLY")
40
- // called after run and catch regardless of whether or not the command errored
41
- }
42
-
43
- static flags = {
44
- yes: flags.boolean({
45
- char: "y",
46
- description: "Skip all prompts and initialize an empty project",
47
- default: false,
48
- }),
49
- }
50
-
51
- async run() {
52
- // console.log('running my command')
53
- }
54
- }
55
-
56
- export default BaseCommand
1
+ import { Command, flags } from "@oclif/command"
2
+ import Console from "./console"
3
+ import { createInterface } from "readline"
4
+ // import SessionManager from '../managers/session'
5
+
6
+ class BaseCommand extends Command {
7
+ async catch(err: any) {
8
+ Console.debug("COMMAND CATCH", err)
9
+
10
+ throw err
11
+ }
12
+
13
+ async init() {
14
+ const { flags, args } = this.parse(BaseCommand)
15
+ Console.debug("COMMAND INIT")
16
+ Console.debug("These are your flags: ", flags)
17
+ Console.debug("These are your args: ", args)
18
+
19
+ // quick fix for listening to the process termination on windows
20
+ if (process.platform === "win32") {
21
+ const rl = createInterface({
22
+ input: process.stdin,
23
+ output: process.stdout,
24
+ })
25
+
26
+ rl.on("SIGINT", function () {
27
+ // process.emit('SIGINT')
28
+ // process.emit('SIGINT')
29
+ })
30
+ }
31
+
32
+ process.on("SIGINT", function () {
33
+ Console.debug("Terminated (SIGINT)")
34
+ process.exit()
35
+ })
36
+ }
37
+
38
+ async finally() {
39
+ Console.debug("COMMAND FINALLY")
40
+ // called after run and catch regardless of whether or not the command errored
41
+ }
42
+
43
+ static flags = {
44
+ yes: flags.boolean({
45
+ char: "y",
46
+ description: "Skip all prompts and initialize an empty project",
47
+ default: false,
48
+ }),
49
+ }
50
+
51
+ async run() {
52
+ // console.log('running my command')
53
+ }
54
+ }
55
+
56
+ export default BaseCommand
package/src/utils/api.ts CHANGED
@@ -14,17 +14,17 @@ export const RIGOBOT_REALTIME_HOST = "https://chat.4geeks.com"
14
14
  // "https://8000-charlytoc-rigobot-bmwdeam7cev.ws-us118.gitpod.io"
15
15
 
16
16
  // eslint-disable-next-line
17
- const _fetch = require("node-fetch")
17
+ const _fetch = require("node-fetch");
18
18
 
19
19
  interface IHeaders {
20
- "Content-Type"?: string
21
- Authorization?: string
20
+ "Content-Type"?: string;
21
+ Authorization?: string;
22
22
  }
23
23
 
24
24
  interface IOptions {
25
- headers?: IHeaders
26
- method?: string
27
- body?: string
25
+ headers?: IHeaders;
26
+ method?: string;
27
+ body?: string;
28
28
  }
29
29
 
30
30
  const fetch = async (
@@ -206,8 +206,8 @@ const getAllPackages = async ({
206
206
  lang = "",
207
207
  slug = "",
208
208
  }: {
209
- lang?: string
210
- slug?: string
209
+ lang?: string;
210
+ slug?: string;
211
211
  }) => {
212
212
  try {
213
213
  cli.action.start("Downloading packages...")
@@ -306,7 +306,7 @@ type TConsumableSlug =
306
306
  | "ai-compilation"
307
307
  | "ai-tutorial-generation"
308
308
  | "ai-generation"
309
- | "learnpack-publish"
309
+ | "learnpack-publish";
310
310
 
311
311
  export const countConsumables = (
312
312
  consumables: any,
@@ -345,10 +345,10 @@ export const getConsumable = async (
345
345
  }
346
346
 
347
347
  export interface TAcademy {
348
- id: number
349
- name: string
350
- slug: string
351
- timezone: string
348
+ id: number;
349
+ name: string;
350
+ slug: string;
351
+ timezone: string;
352
352
  }
353
353
 
354
354
  const neededPermissions = [
@@ -416,20 +416,20 @@ export const validateToken = async (token: string) => {
416
416
  }
417
417
 
418
418
  type TAssetMissing = {
419
- slug: string
420
- title: string
421
- lang: string
422
- url: string
423
- description: string
424
- learnpack_deploy_url: string
425
- technologies: string[]
426
- category: number
427
- owner: number
428
- author: number
429
- preview: string
430
- readme_raw: string
431
- all_translations: string[]
432
- }
419
+ slug: string;
420
+ title: string;
421
+ lang: string;
422
+ url: string;
423
+ description: string;
424
+ learnpack_deploy_url: string;
425
+ technologies: string[];
426
+ category: number | string;
427
+ owner: number;
428
+ author: number;
429
+ preview: string;
430
+ readme_raw: string;
431
+ all_translations: string[];
432
+ };
433
433
 
434
434
  export const createAsset = async (token: string, asset: TAssetMissing) => {
435
435
  const body = {
@@ -536,13 +536,20 @@ const updateRigoAssetID = async (
536
536
  slug: string,
537
537
  asset_id: number
538
538
  ) => {
539
+ const cleanToken = token.replace(/[\n\r]/g, "")
540
+
539
541
  const url = `${RIGOBOT_HOST}/v1/learnpack/package/${slug}/`
540
- const headers = {
541
- Authorization: "Token " + token.trim(),
542
- }
543
- console.log("HEADERS", headers)
542
+
544
543
  try {
545
- const response = await axios.put(url, { asset_id }, { headers })
544
+ const response = await axios.put(
545
+ url,
546
+ { asset_id },
547
+ {
548
+ headers: {
549
+ Authorization: "Token " + cleanToken,
550
+ },
551
+ }
552
+ )
546
553
  return response.data
547
554
  } catch (error) {
548
555
  console.error("Failed to update Rigo package:", error)
@@ -552,11 +559,18 @@ const updateRigoAssetID = async (
552
559
 
553
560
  const createRigoPackage = async (token: string, slug: string, config: any) => {
554
561
  const url = `${RIGOBOT_HOST}/v1/learnpack/package`
555
- const headers = {
556
- Authorization: "Token " + token.trim(),
557
- }
562
+ const cleanToken = token.replace(/[\n\r]/g, "")
563
+
558
564
  try {
559
- const response = await axios.post(url, { slug, config }, { headers })
565
+ const response = await axios.post(
566
+ url,
567
+ { slug, config },
568
+ {
569
+ headers: {
570
+ Authorization: "Token " + cleanToken,
571
+ },
572
+ }
573
+ )
560
574
  return response.data
561
575
  } catch (error) {
562
576
  console.error("Failed to create Rigo package:", error)
@@ -565,9 +579,9 @@ const createRigoPackage = async (token: string, slug: string, config: any) => {
565
579
  }
566
580
 
567
581
  type TTechnology = {
568
- slug: string
569
- lang: string
570
- }
582
+ slug: string;
583
+ lang: string;
584
+ };
571
585
 
572
586
  let technologiesCache: TTechnology[] = []
573
587