@learnpack/learnpack 5.0.164 → 5.0.166

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.
@@ -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-B28ZWIPl.js"></script>
13
+ <script type="module" crossorigin src="/creator/assets/index-4XkqESUr.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/creator/assets/index-C_YTggyk.css">
15
15
  </head>
16
16
  <body>
@@ -1 +1 @@
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":[]}}}
1
+ {"version":"5.0.166","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.164",
4
+ "version": "5.0.166",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -262,14 +262,8 @@ interface Lesson {
262
262
  }
263
263
 
264
264
  interface ParsedLink {
265
- url: string
266
- title?: string
267
- text?: string
268
- transcript?: string
269
- description?: string
270
- author?: string
271
- duration?: number
272
- thumbnail?: string
265
+ name: string
266
+ text: string
273
267
  }
274
268
  type FormState = {
275
269
  description: string
@@ -288,6 +282,7 @@ type FormState = {
288
282
  type Syllabus = {
289
283
  lessons: Lesson[]
290
284
  courseInfo: FormState
285
+ sources: ParsedLink[]
291
286
  }
292
287
 
293
288
  const fixPreviewUrl = (slug: string, previewUrl: string) => {
@@ -940,7 +935,10 @@ export default class ServeCommand extends SessionCommand {
940
935
  bucket,
941
936
  rigoToken,
942
937
  syllabus.lessons,
943
- JSON.stringify(syllabus.courseInfo),
938
+ `{
939
+ "courseInfo": ${JSON.stringify(syllabus.courseInfo)},
940
+ "sources": ${JSON.stringify(syllabus.sources)}
941
+ }`,
944
942
  lesson,
945
943
  tutorialDir + "/exercises",
946
944
  slugify(syllabus.courseInfo.title)
@@ -122,6 +122,7 @@ ${
122
122
  title: res.parsed.title,
123
123
  description: res.parsed.description,
124
124
  },
125
+ sources: uploadedFiles,
125
126
  })
126
127
  navigate("/creator/syllabus")
127
128
  setFormState({
@@ -132,6 +133,12 @@ ${
132
133
  contentIndex: "",
133
134
  isCompleted: false,
134
135
  currentStep: "description",
136
+ variables: [
137
+ "description",
138
+ "duration",
139
+ "hasContentIndex",
140
+ "verifyHuman",
141
+ ],
135
142
  })
136
143
  } catch (error) {
137
144
  console.error(error)
@@ -360,9 +360,9 @@ export const SVGS = {
360
360
  <g
361
361
  id="Icons"
362
362
  stroke="none"
363
- stroke-width="1"
363
+ strokeWidth="1"
364
364
  fill="none"
365
- fill-rule="evenodd"
365
+ fillRule="evenodd"
366
366
  >
367
367
  <g id="Color-" transform="translate(-401.000000, -860.000000)">
368
368
  <g id="Google" transform="translate(401.000000, 860.000000)">
@@ -9,6 +9,8 @@ import {
9
9
  checkParams,
10
10
  loginWithToken,
11
11
  createCourse,
12
+ isSlugAvailable,
13
+ reWriteTitle,
12
14
  } from "../../utils/lib"
13
15
 
14
16
  import Loader from "../Loader"
@@ -76,8 +78,27 @@ const SyllabusEditor: React.FC = () => {
76
78
  }
77
79
  }
78
80
  })()
81
+ checkSlug()
79
82
  }, [])
80
83
 
84
+ const checkSlug = async () => {
85
+ const slug = slugify(syllabus.courseInfo.title || "")
86
+ const isAvailable = await isSlugAvailable(slug)
87
+ if (!isAvailable) {
88
+ const newTitle = await reWriteTitle(
89
+ syllabus.courseInfo.title || "",
90
+ auth.rigoToken
91
+ )
92
+ push({
93
+ ...syllabus,
94
+ courseInfo: {
95
+ ...syllabus.courseInfo,
96
+ title: newTitle,
97
+ },
98
+ })
99
+ }
100
+ }
101
+
81
102
  const sendPrompt = async (prompt: string) => {
82
103
  setIsThinking(true)
83
104
 
@@ -153,6 +174,9 @@ const SyllabusEditor: React.FC = () => {
153
174
  toast.error("You don't have enough credits to generate a course!")
154
175
  return
155
176
  }
177
+ syllabus.sources = uploadedFiles
178
+ console.log(syllabus)
179
+
156
180
  setIsGenerating(true)
157
181
  createCourse(syllabus, tokenToUse, auth.bcToken)
158
182
 
@@ -318,3 +318,49 @@ export const createCourse = async (
318
318
  )
319
319
  return response.data
320
320
  }
321
+
322
+ interface SlugAvailabilityResponse {
323
+ slug: string
324
+ available: boolean
325
+ }
326
+
327
+ export const isSlugAvailable = async (slug: string): Promise<boolean> => {
328
+ try {
329
+ const url = `${RIGOBOT_HOST}/v1/learnpack/check-slug-availability?slug=${encodeURIComponent(
330
+ slug
331
+ )}`
332
+ const response = await axios.get<SlugAvailabilityResponse>(url)
333
+ return response.data.available
334
+ } catch (error) {
335
+ console.error("Error checking slug availability:", error)
336
+ throw error
337
+ }
338
+ }
339
+
340
+ export const reWriteTitle = async (title: string, token: string) => {
341
+ // We hav in the parsed the newTitle
342
+ try {
343
+ const response = await axios.post(
344
+ `${RIGOBOT_HOST}/v1/prompting/completion/1050/`,
345
+ {
346
+ inputs: {
347
+ current_title: title,
348
+ },
349
+ include_purpose_objective: false,
350
+ execute_async: false,
351
+ },
352
+ {
353
+ headers: {
354
+ "Content-Type": "application/json",
355
+ Authorization: "Token " + token,
356
+ },
357
+ }
358
+ )
359
+ console.log("RESPONSE", response.data)
360
+ return response.data.parsed.newTitle
361
+ } catch (error) {
362
+ console.error("Error rewriting title:", error)
363
+ // Return the title as it is with a random number of 4 characters
364
+ return `${title} ${Math.random().toString(36).substring(2, 6)}`
365
+ }
366
+ }
@@ -27,6 +27,7 @@ type Auth = {
27
27
  export type Syllabus = {
28
28
  lessons: Lesson[]
29
29
  courseInfo: FormState
30
+ sources: ParsedFile[]
30
31
  }
31
32
 
32
33
  type Consumables = {