@learnpack/learnpack 5.0.160 → 5.0.164

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.160 win32-x64 node-v22.15.0
24
+ @learnpack/learnpack/5.0.164 win32-x64 node-v22.15.0
25
25
  $ learnpack --help [COMMAND]
26
26
  USAGE
27
27
  $ learnpack COMMAND
@@ -80,7 +80,7 @@ DESCRIPTION
80
80
  12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
81
81
  ```
82
82
 
83
- _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\audit.ts)_
83
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\audit.ts)_
84
84
 
85
85
  ## `learnpack breakToken`
86
86
 
@@ -95,7 +95,7 @@ OPTIONS
95
95
  -y, --yes Skip all prompts and initialize an empty project
96
96
  ```
97
97
 
98
- _See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\breakToken.ts)_
98
+ _See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\breakToken.ts)_
99
99
 
100
100
  ## `learnpack clean`
101
101
 
@@ -110,7 +110,7 @@ DESCRIPTION
110
110
  Extra documentation goes here
111
111
  ```
112
112
 
113
- _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\clean.ts)_
113
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\clean.ts)_
114
114
 
115
115
  ## `learnpack download [PACKAGE]`
116
116
 
@@ -128,7 +128,7 @@ DESCRIPTION
128
128
  Extra documentation goes here
129
129
  ```
130
130
 
131
- _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\download.ts)_
131
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\download.ts)_
132
132
 
133
133
  ## `learnpack help [COMMAND]`
134
134
 
@@ -160,7 +160,7 @@ OPTIONS
160
160
  -y, --yes Skip all prompts and initialize an empty project
161
161
  ```
162
162
 
163
- _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\init.ts)_
163
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\init.ts)_
164
164
 
165
165
  ## `learnpack login [PACKAGE]`
166
166
 
@@ -178,7 +178,7 @@ DESCRIPTION
178
178
  Extra documentation goes here
179
179
  ```
180
180
 
181
- _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\login.ts)_
181
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\login.ts)_
182
182
 
183
183
  ## `learnpack logout [PACKAGE]`
184
184
 
@@ -196,7 +196,7 @@ DESCRIPTION
196
196
  Extra documentation goes here
197
197
  ```
198
198
 
199
- _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\logout.ts)_
199
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\logout.ts)_
200
200
 
201
201
  ## `learnpack plugins`
202
202
 
@@ -328,7 +328,7 @@ OPTIONS
328
328
  -s, --strict strict mode
329
329
  ```
330
330
 
331
- _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\publish.ts)_
331
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\publish.ts)_
332
332
 
333
333
  ## `learnpack serve`
334
334
 
@@ -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\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\serve.ts)_
348
+ _See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\serve.ts)_
349
349
 
350
350
  ## `learnpack start`
351
351
 
@@ -367,7 +367,7 @@ OPTIONS
367
367
  -y, --yes Skip all prompts and initialize an empty project
368
368
  ```
369
369
 
370
- _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\start.ts)_
370
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\start.ts)_
371
371
 
372
372
  ## `learnpack test [EXERCISESLUG]`
373
373
 
@@ -384,7 +384,7 @@ OPTIONS
384
384
  -y, --yes Skip all prompts and initialize an empty project
385
385
  ```
386
386
 
387
- _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\test.ts)_
387
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\test.ts)_
388
388
 
389
389
  ## `learnpack translate`
390
390
 
@@ -398,7 +398,7 @@ OPTIONS
398
398
  -y, --yes Skip all prompts and initialize an empty project
399
399
  ```
400
400
 
401
- _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.160/src\commands\translate.ts)_
401
+ _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.164/src\commands\translate.ts)_
402
402
  <!-- commandsstop -->
403
403
 
404
404
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
@@ -631,8 +631,16 @@ class ServeCommand extends SessionCommand_1.default {
631
631
  if (!rigoToken || !bcToken) {
632
632
  return res.status(400).json({ error: "Missing tokens" });
633
633
  }
634
- const tutorialDir = "courses/" + (0, creatorUtilities_2.slugify)(syllabus.courseInfo.title);
634
+ const slug = (0, creatorUtilities_2.slugify)(syllabus.courseInfo.title);
635
+ const tutorialDir = `courses/${slug}`;
635
636
  const learnJson = (0, exports.createLearnJson)(syllabus.courseInfo);
637
+ try {
638
+ await api_1.default.createRigoPackage(rigoToken, slug, learnJson);
639
+ }
640
+ catch (error) {
641
+ console.error("Failed to create Rigo package:", error);
642
+ return res.status(400).json({ error: "Failed to create Rigo package" });
643
+ }
636
644
  await uploadFileToBucket(bucket, JSON.stringify(learnJson), `${tutorialDir}/learn.json`);
637
645
  console.log("🔄 Learn.json uploaded to bucket to", tutorialDir);
638
646
  const lessonsPromises = syllabus.lessons.map(lesson => processExercise(bucket, rigoToken, syllabus.lessons, JSON.stringify(syllabus.courseInfo), lesson, tutorialDir + "/exercises", (0, creatorUtilities_2.slugify)(syllabus.courseInfo.title)));
@@ -75758,60 +75758,61 @@ const VQ = (n, e) =>
75758
75758
  a = Un((l) => l.setAuth),
75759
75759
  s = t[t.length - 2]
75760
75760
  return te.jsxs("div", {
75761
- className:
75762
- "flex flex-col space-y-2 sm:flex-row sm:space-y-0 sm:space-x-4 justify-end mt-6",
75763
75761
  children: [
75764
- s &&
75765
- s.lessons.length > 0 &&
75766
- te.jsxs("button", {
75767
- onClick: () => {
75768
- i(), Br.success("Changes reverted!")
75769
- },
75770
- className:
75771
- "w-full sm:w-auto text-gray-500 bg-gray-200 rounded px-4 py-2 hover:bg-gray-300 flex items-center justify-center gap-2 cursor-pointer",
75772
- children: [Cn.undo, "Revert changes"],
75773
- }),
75774
- r.user &&
75775
- te.jsxs("div", {
75776
- className:
75777
- "text-sm text-gray-500 bg-gray-200 rounded px-4 py-2 flex items-center justify-center flex-col",
75778
- children: [
75779
- te.jsxs("span", {
75780
- children: [
75781
- "Creating the course as ",
75782
- te.jsx("strong", { children: r.user.first_name }),
75783
- ],
75784
- }),
75785
- te.jsxs("span", {
75786
- children: [
75787
- "or",
75788
- " ",
75789
- te.jsx("button", {
75790
- className:
75791
- "text-sm text-gray-500 bg-gray-200 rounded hover:bg-gray-300 items-center justify-center cursor-pointer ",
75792
- onClick: () => {
75793
- a({ rigoToken: "", bcToken: "", userId: "", user: null }),
75794
- e()
75795
- },
75796
- children: te.jsx("strong", {
75797
- children: "login as someone else",
75798
- }),
75799
- }),
75800
- ],
75801
- }),
75802
- ],
75803
- }),
75804
- te.jsxs("button", {
75805
- onClick: n,
75762
+ te.jsxs("div", {
75806
75763
  className:
75807
- "w-full sm:w-auto bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700 flex items-center justify-center gap-2 cursor-pointer",
75764
+ "flex flex-col space-y-2 sm:flex-row sm:space-y-0 sm:space-x-4 justify-end mt-6",
75808
75765
  children: [
75809
- te.jsx("span", {
75810
- children: "I'm ready. Create the course for me!",
75766
+ s &&
75767
+ s.lessons.length > 0 &&
75768
+ te.jsxs("button", {
75769
+ onClick: () => {
75770
+ i(), Br.success("Changes reverted!")
75771
+ },
75772
+ className:
75773
+ "w-full sm:w-auto text-gray-500 bg-gray-200 rounded px-4 py-2 hover:bg-gray-300 flex items-center justify-center gap-2 cursor-pointer",
75774
+ children: [Cn.undo, "Revert changes"],
75775
+ }),
75776
+ te.jsxs("button", {
75777
+ onClick: n,
75778
+ className:
75779
+ "w-full sm:w-auto bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700 flex items-center justify-center gap-2 cursor-pointer",
75780
+ children: [
75781
+ te.jsx("span", {
75782
+ children: "I'm ready. Create the course for me!",
75783
+ }),
75784
+ Cn.rigoSoftBlue,
75785
+ ],
75811
75786
  }),
75812
- Cn.rigoSoftBlue,
75813
75787
  ],
75814
75788
  }),
75789
+ te.jsx("div", {
75790
+ className: "mt-2 justify-end flex",
75791
+ children:
75792
+ r.user &&
75793
+ te.jsxs("div", {
75794
+ className:
75795
+ "text-sm text-gray-500 rounded px-4 py-2 flex items-center justify-center gap-1 ",
75796
+ children: [
75797
+ te.jsxs("span", {
75798
+ children: [
75799
+ "Creating the course as ",
75800
+ te.jsx("strong", { children: r.user.first_name }),
75801
+ " or",
75802
+ ],
75803
+ }),
75804
+ te.jsx("button", {
75805
+ className:
75806
+ "text-sm rounded items-center justify-center cursor-pointer text-blue-600",
75807
+ onClick: () => {
75808
+ a({ rigoToken: "", bcToken: "", userId: "", user: null }),
75809
+ e()
75810
+ },
75811
+ children: "login as someone else",
75812
+ }),
75813
+ ],
75814
+ }),
75815
+ }),
75815
75816
  ],
75816
75817
  })
75817
75818
  },
@@ -10,7 +10,7 @@
10
10
  />
11
11
 
12
12
  <title>Learnpack Creator: Craft tutorials in seconds!</title>
13
- <script type="module" crossorigin src="/creator/assets/index-BG3HTk_l.js"></script>
13
+ <script type="module" crossorigin src="/creator/assets/index-B28ZWIPl.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/creator/assets/index-C_YTggyk.css">
15
15
  </head>
16
16
  <body>
@@ -50,5 +50,6 @@ declare const _default: {
50
50
  updateAsset: (token: string, assetSlug: string, asset: Partial<TAssetMissing>) => Promise<any>;
51
51
  getCategories: (token: string) => Promise<any>;
52
52
  updateRigoAssetID: (token: string, slug: string, asset_id: number) => Promise<any>;
53
+ createRigoPackage: (token: string, slug: string, config: any) => Promise<any>;
53
54
  };
54
55
  export default _default;
package/lib/utils/api.js CHANGED
@@ -427,6 +427,20 @@ const updateRigoAssetID = async (token, slug, asset_id) => {
427
427
  throw error;
428
428
  }
429
429
  };
430
+ const createRigoPackage = async (token, slug, config) => {
431
+ const url = `${exports.RIGOBOT_HOST}/v1/learnpack/package`;
432
+ const headers = {
433
+ Authorization: `Token ${token}`,
434
+ };
435
+ try {
436
+ const response = await axios_1.default.post(url, { slug, config }, { headers });
437
+ return response.data;
438
+ }
439
+ catch (error) {
440
+ console.error("Failed to create Rigo package:", error);
441
+ throw error;
442
+ }
443
+ };
430
444
  exports.default = {
431
445
  login,
432
446
  publish,
@@ -443,4 +457,5 @@ exports.default = {
443
457
  updateAsset,
444
458
  getCategories,
445
459
  updateRigoAssetID,
460
+ createRigoPackage,
446
461
  };
@@ -1 +1 @@
1
- {"version":"5.0.160","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":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false}},"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":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Runs a small server to build tutorials","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"},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","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.164","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":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false}},"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":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Runs a small server to build tutorials","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"},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","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.160",
4
+ "version": "5.0.164",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -51,6 +51,7 @@
51
51
  "markdown-it": "^14.1.0",
52
52
  "mkdirp": "^3.0.1",
53
53
  "moment": "^2.27.0",
54
+ "multer": "^2.0.0",
54
55
  "node-emoji": "^1.10.0",
55
56
  "node-fetch": "^2.7.0",
56
57
  "node-persist": "^3.1.0",
@@ -35,7 +35,7 @@ import {
35
35
  // import { handleAssetCreation } from "./publish"
36
36
  import axios from "axios"
37
37
  import * as FormData from "form-data"
38
- import { RIGOBOT_HOST } from "../utils/api"
38
+ import api, { RIGOBOT_HOST } from "../utils/api"
39
39
  import { createUploadMiddleware, minutesToISO8601Duration } from "../utils/misc"
40
40
  import { buildConfig, ConfigResponse } from "../utils/configBuilder"
41
41
  import { checkReadability, slugify } from "../utils/creatorUtilities"
@@ -916,9 +916,18 @@ export default class ServeCommand extends SessionCommand {
916
916
  return res.status(400).json({ error: "Missing tokens" })
917
917
  }
918
918
 
919
- const tutorialDir = "courses/" + slugify(syllabus.courseInfo.title)
919
+ const slug = slugify(syllabus.courseInfo.title)
920
920
 
921
+ const tutorialDir = `courses/${slug}`
921
922
  const learnJson = createLearnJson(syllabus.courseInfo)
923
+
924
+ try {
925
+ await api.createRigoPackage(rigoToken, slug, learnJson)
926
+ } catch (error) {
927
+ console.error("Failed to create Rigo package:", error)
928
+ return res.status(400).json({ error: "Failed to create Rigo package" })
929
+ }
930
+
922
931
  await uploadFileToBucket(
923
932
  bucket,
924
933
  JSON.stringify(learnJson),
@@ -86,31 +86,40 @@ export const GenerateButton = ({
86
86
  const setAuth = useStore((state) => state.setAuth)
87
87
  const prev = history[history.length - 2]
88
88
  return (
89
- <div className="flex flex-col space-y-2 sm:flex-row sm:space-y-0 sm:space-x-4 justify-end mt-6">
90
- {prev && prev.lessons.length > 0 && (
89
+ <div>
90
+ <div className="flex flex-col space-y-2 sm:flex-row sm:space-y-0 sm:space-x-4 justify-end mt-6">
91
+ {prev && prev.lessons.length > 0 && (
92
+ <button
93
+ onClick={() => {
94
+ undo()
95
+ toast.success("Changes reverted!")
96
+ }}
97
+ className="w-full sm:w-auto text-gray-500 bg-gray-200 rounded px-4 py-2 hover:bg-gray-300 flex items-center justify-center gap-2 cursor-pointer"
98
+ >
99
+ {SVGS.undo}
100
+ Revert changes
101
+ </button>
102
+ )}
103
+
91
104
  <button
92
- onClick={() => {
93
- undo()
94
- toast.success("Changes reverted!")
95
- }}
96
- className="w-full sm:w-auto text-gray-500 bg-gray-200 rounded px-4 py-2 hover:bg-gray-300 flex items-center justify-center gap-2 cursor-pointer"
105
+ onClick={handleSubmit}
106
+ className="w-full sm:w-auto bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700 flex items-center justify-center gap-2 cursor-pointer"
97
107
  >
98
- {SVGS.undo}
99
- Revert changes
108
+ <span>I'm ready. Create the course for me!</span>
109
+ {SVGS.rigoSoftBlue}
100
110
  </button>
101
- )}
102
- {auth.user && (
103
- <div
104
- // onClick={handleSubmit}
105
- className="text-sm text-gray-500 bg-gray-200 rounded px-4 py-2 flex items-center justify-center flex-col"
106
- >
107
- <span>
108
- Creating the course as <strong>{auth.user.first_name}</strong>
109
- </span>
110
- <span>
111
- or{" "}
111
+ </div>
112
+ <div className="mt-2 justify-end flex">
113
+ {auth.user && (
114
+ <div
115
+ // onClick={handleSubmit}
116
+ className="text-sm text-gray-500 rounded px-4 py-2 flex items-center justify-center gap-1 "
117
+ >
118
+ <span>
119
+ Creating the course as <strong>{auth.user.first_name}</strong> or
120
+ </span>
112
121
  <button
113
- className="text-sm text-gray-500 bg-gray-200 rounded hover:bg-gray-300 items-center justify-center cursor-pointer "
122
+ className="text-sm rounded items-center justify-center cursor-pointer text-blue-600"
114
123
  onClick={() => {
115
124
  setAuth({
116
125
  rigoToken: "",
@@ -121,18 +130,11 @@ export const GenerateButton = ({
121
130
  openLogin()
122
131
  }}
123
132
  >
124
- <strong>login as someone else</strong>
133
+ login as someone else
125
134
  </button>
126
- </span>
127
- </div>
128
- )}
129
- <button
130
- onClick={handleSubmit}
131
- className="w-full sm:w-auto bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700 flex items-center justify-center gap-2 cursor-pointer"
132
- >
133
- <span>I'm ready. Create the course for me!</span>
134
- {SVGS.rigoSoftBlue}
135
- </button>
135
+ </div>
136
+ )}
137
+ </div>
136
138
  </div>
137
139
  )
138
140
  }
@@ -75758,60 +75758,61 @@ const VQ = (n, e) =>
75758
75758
  a = Un((l) => l.setAuth),
75759
75759
  s = t[t.length - 2]
75760
75760
  return te.jsxs("div", {
75761
- className:
75762
- "flex flex-col space-y-2 sm:flex-row sm:space-y-0 sm:space-x-4 justify-end mt-6",
75763
75761
  children: [
75764
- s &&
75765
- s.lessons.length > 0 &&
75766
- te.jsxs("button", {
75767
- onClick: () => {
75768
- i(), Br.success("Changes reverted!")
75769
- },
75770
- className:
75771
- "w-full sm:w-auto text-gray-500 bg-gray-200 rounded px-4 py-2 hover:bg-gray-300 flex items-center justify-center gap-2 cursor-pointer",
75772
- children: [Cn.undo, "Revert changes"],
75773
- }),
75774
- r.user &&
75775
- te.jsxs("div", {
75776
- className:
75777
- "text-sm text-gray-500 bg-gray-200 rounded px-4 py-2 flex items-center justify-center flex-col",
75778
- children: [
75779
- te.jsxs("span", {
75780
- children: [
75781
- "Creating the course as ",
75782
- te.jsx("strong", { children: r.user.first_name }),
75783
- ],
75784
- }),
75785
- te.jsxs("span", {
75786
- children: [
75787
- "or",
75788
- " ",
75789
- te.jsx("button", {
75790
- className:
75791
- "text-sm text-gray-500 bg-gray-200 rounded hover:bg-gray-300 items-center justify-center cursor-pointer ",
75792
- onClick: () => {
75793
- a({ rigoToken: "", bcToken: "", userId: "", user: null }),
75794
- e()
75795
- },
75796
- children: te.jsx("strong", {
75797
- children: "login as someone else",
75798
- }),
75799
- }),
75800
- ],
75801
- }),
75802
- ],
75803
- }),
75804
- te.jsxs("button", {
75805
- onClick: n,
75762
+ te.jsxs("div", {
75806
75763
  className:
75807
- "w-full sm:w-auto bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700 flex items-center justify-center gap-2 cursor-pointer",
75764
+ "flex flex-col space-y-2 sm:flex-row sm:space-y-0 sm:space-x-4 justify-end mt-6",
75808
75765
  children: [
75809
- te.jsx("span", {
75810
- children: "I'm ready. Create the course for me!",
75766
+ s &&
75767
+ s.lessons.length > 0 &&
75768
+ te.jsxs("button", {
75769
+ onClick: () => {
75770
+ i(), Br.success("Changes reverted!")
75771
+ },
75772
+ className:
75773
+ "w-full sm:w-auto text-gray-500 bg-gray-200 rounded px-4 py-2 hover:bg-gray-300 flex items-center justify-center gap-2 cursor-pointer",
75774
+ children: [Cn.undo, "Revert changes"],
75775
+ }),
75776
+ te.jsxs("button", {
75777
+ onClick: n,
75778
+ className:
75779
+ "w-full sm:w-auto bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700 flex items-center justify-center gap-2 cursor-pointer",
75780
+ children: [
75781
+ te.jsx("span", {
75782
+ children: "I'm ready. Create the course for me!",
75783
+ }),
75784
+ Cn.rigoSoftBlue,
75785
+ ],
75811
75786
  }),
75812
- Cn.rigoSoftBlue,
75813
75787
  ],
75814
75788
  }),
75789
+ te.jsx("div", {
75790
+ className: "mt-2 justify-end flex",
75791
+ children:
75792
+ r.user &&
75793
+ te.jsxs("div", {
75794
+ className:
75795
+ "text-sm text-gray-500 rounded px-4 py-2 flex items-center justify-center gap-1 ",
75796
+ children: [
75797
+ te.jsxs("span", {
75798
+ children: [
75799
+ "Creating the course as ",
75800
+ te.jsx("strong", { children: r.user.first_name }),
75801
+ " or",
75802
+ ],
75803
+ }),
75804
+ te.jsx("button", {
75805
+ className:
75806
+ "text-sm rounded items-center justify-center cursor-pointer text-blue-600",
75807
+ onClick: () => {
75808
+ a({ rigoToken: "", bcToken: "", userId: "", user: null }),
75809
+ e()
75810
+ },
75811
+ children: "login as someone else",
75812
+ }),
75813
+ ],
75814
+ }),
75815
+ }),
75815
75816
  ],
75816
75817
  })
75817
75818
  },
@@ -10,7 +10,7 @@
10
10
  />
11
11
 
12
12
  <title>Learnpack Creator: Craft tutorials in seconds!</title>
13
- <script type="module" crossorigin src="/creator/assets/index-BG3HTk_l.js"></script>
13
+ <script type="module" crossorigin src="/creator/assets/index-B28ZWIPl.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/creator/assets/index-C_YTggyk.css">
15
15
  </head>
16
16
  <body>
package/src/utils/api.ts CHANGED
@@ -544,6 +544,20 @@ const updateRigoAssetID = async (
544
544
  }
545
545
  }
546
546
 
547
+ const createRigoPackage = async (token: string, slug: string, config: any) => {
548
+ const url = `${RIGOBOT_HOST}/v1/learnpack/package`
549
+ const headers = {
550
+ Authorization: `Token ${token}`,
551
+ }
552
+ try {
553
+ const response = await axios.post(url, { slug, config }, { headers })
554
+ return response.data
555
+ } catch (error) {
556
+ console.error("Failed to create Rigo package:", error)
557
+ throw error
558
+ }
559
+ }
560
+
547
561
  export default {
548
562
  login,
549
563
  publish,
@@ -560,4 +574,5 @@ export default {
560
574
  updateAsset,
561
575
  getCategories,
562
576
  updateRigoAssetID,
577
+ createRigoPackage,
563
578
  }