@learnpack/learnpack 5.0.136 → 5.0.140

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,8 +10,8 @@
10
10
  />
11
11
 
12
12
  <title>Learnpack Creator: Craft tutorials in seconds!</title>
13
- <script type="module" crossorigin src="/creator/assets/index-nI-XBrtB.js"></script>
14
- <link rel="stylesheet" crossorigin href="/creator/assets/index-1sKQbOKY.css">
13
+ <script type="module" crossorigin src="/creator/assets/index-D5Lznxst.js"></script>
14
+ <link rel="stylesheet" crossorigin href="/creator/assets/index-Cz25oPGo.css">
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -1 +1 @@
1
- {"version":"5.0.136","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.140","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.136",
4
+ "version": "5.0.140",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -33,10 +33,11 @@ function App() {
33
33
 
34
34
  useEffect(() => {
35
35
  verifyToken()
36
+ checkDescription()
36
37
  }, [])
37
38
 
38
39
  const verifyToken = async () => {
39
- const { token } = checkParams()
40
+ const { token } = checkParams(["token"])
40
41
  if (token) {
41
42
  const user = await loginWithToken(token)
42
43
  setAuth({
@@ -66,6 +67,29 @@ function App() {
66
67
  }
67
68
  }
68
69
 
70
+ const checkDescription = () => {
71
+ const { description, duration } = checkParams(["description", "duration"])
72
+ if (description) {
73
+ console.log("description", description)
74
+ setFormState({
75
+ description: description,
76
+ currentStep: "duration",
77
+ })
78
+ }
79
+ if (duration && description && !isNaN(parseInt(duration))) {
80
+ if (["30", "60", "120"].includes(duration)) {
81
+ const durationInt = parseInt(duration)
82
+ console.log("duration", durationInt)
83
+ setFormState({
84
+ duration: durationInt,
85
+ currentStep: "hasContentIndex",
86
+ })
87
+ } else {
88
+ console.log("Invalid duration received in params", duration)
89
+ }
90
+ }
91
+ }
92
+
69
93
  const handleCreateTutorial = async () => {
70
94
  cleanHistory()
71
95
  const res = await interactiveCreation({
@@ -100,9 +124,11 @@ function App() {
100
124
  {
101
125
  title: "What do you want to learn?",
102
126
  slug: "description",
103
- isCompleted: false,
127
+ isCompleted: formState.description.length > 0,
128
+ required: true,
104
129
  content: (
105
130
  <textarea
131
+ required
106
132
  placeholder="Describe your course"
107
133
  className="w-full h-24 border-2 border-gray-300 rounded-md p-2 bg-white"
108
134
  value={formState.description}
@@ -31,6 +31,12 @@ function cleanFloatString(input: string): string {
31
31
  : num.toString()
32
32
  }
33
33
 
34
+ function hasDecimalPart(input: string): boolean {
35
+ const num = parseFloat(input)
36
+ if (Number.isNaN(num)) return false
37
+ return num % 1 > 0
38
+ }
39
+
34
40
  export const LessonItem: React.FC<LessonItemProps> = ({
35
41
  lesson,
36
42
  onChange,
@@ -45,7 +51,7 @@ export const LessonItem: React.FC<LessonItemProps> = ({
45
51
  <div
46
52
  className={`flex items-center space-x-2 relative rounded-md p-3 ${
47
53
  isNew ? "border border-learnpack-blue appear" : "border border-gray-200"
48
- }`}
54
+ } ${hasDecimalPart(lesson.id.toString() || "0") ? "ml-6" : ""}`}
49
55
  >
50
56
  {isNew && <span className="red-ball"></span>}
51
57
 
@@ -1,9 +1,11 @@
1
1
  import React from "react"
2
2
  import { SVGS } from "../assets/svgs"
3
+ import { toast } from "react-hot-toast"
3
4
 
4
5
  export type Step = {
5
6
  title: string
6
7
  subtitle?: string
8
+ required?: boolean
7
9
  helpText?: string
8
10
  content: React.ReactNode
9
11
  slug: string
@@ -29,6 +31,10 @@ const StepWizard: React.FC<Props> = ({
29
31
 
30
32
  const goNext = () => {
31
33
  const index = steps.findIndex((step) => step.slug === currentStep)
34
+ if (steps[index].required && !formState[steps[index].slug]) {
35
+ toast.error("Please fill out all required fields!")
36
+ return
37
+ }
32
38
  if (index < totalSteps - 1)
33
39
  setFormState({
34
40
  ...formState,
@@ -24,12 +24,6 @@ const ContentIndexHeader = ({
24
24
  ? `I've created a detailed structure for your course: ${syllabus.courseInfo.title}`
25
25
  : "I've updated the structure based on your feedback."
26
26
 
27
- const subText = isFirst
28
- ? `It includes a mix of reading, coding exercises, and quizzes. Give
29
- it a look and let me know if it aligns with your expectations or if
30
- there are any changes you'd like to make.`
31
- : "Based on your input, here is the new syllabus, updates are highlighted in yellow"
32
-
33
27
  return (
34
28
  <div className="mt-2 ">
35
29
  <AnimatePresence mode="wait">
@@ -39,27 +33,45 @@ const ContentIndexHeader = ({
39
33
  animate={{ opacity: 1, y: 0 }}
40
34
  exit={{ opacity: 0, y: 10 }}
41
35
  transition={{ duration: 0.2 }}
42
- className="text-xs font-semibold sm:text-base md:text-lg"
36
+ className="text-lg font-semibold sm:text-lg md:text-xl xl:text-2xl"
43
37
  >
44
38
  {headerText}
45
39
  </motion.h2>
46
40
  </AnimatePresence>
47
-
48
- <AnimatePresence mode="wait">
49
- <motion.p
50
- key={subText}
51
- initial={{ opacity: 0 }}
52
- animate={{ opacity: 1 }}
53
- exit={{ opacity: 0 }}
54
- transition={{ duration: 0.2, delay: 0.1 }}
55
- className="text-xs sm:text-sm text-gray-600 mt-1 mb-5"
56
- >
57
- {subText}
58
- </motion.p>
59
- </AnimatePresence>
60
41
  </div>
61
42
  )
62
43
  }
44
+ const ContentSecondaryHeader = ({
45
+ messages,
46
+ }: // syllabus,
47
+ {
48
+ messages: TMessage[]
49
+ }) => {
50
+ const isFirst =
51
+ messages.filter((m) => m.type === "assistant" && m.content.length > 0)
52
+ .length === 2
53
+
54
+ const subText = isFirst
55
+ ? `It includes a mix of reading, coding exercises, and quizzes. Give
56
+ it a look and let me know if it aligns with your expectations or if
57
+ there are any changes you'd like to make.`
58
+ : "Based on your input, here is the new syllabus, updates are highlighted in yellow"
59
+
60
+ return (
61
+ <AnimatePresence mode="wait">
62
+ <motion.p
63
+ key={subText}
64
+ initial={{ opacity: 0 }}
65
+ animate={{ opacity: 1 }}
66
+ exit={{ opacity: 0 }}
67
+ transition={{ duration: 0.2, delay: 0.1 }}
68
+ className="text-sm sm:text-md md:text-lg text-gray-600 mb-5"
69
+ >
70
+ {subText}
71
+ </motion.p>
72
+ </AnimatePresence>
73
+ )
74
+ }
63
75
 
64
76
  export const GenerateButton = ({
65
77
  handleSubmit,
@@ -190,6 +202,7 @@ export const ContentIndex = ({
190
202
  <Loader text="Thinking..." minheight="min-h-[69vh]" />
191
203
  ) : (
192
204
  <>
205
+ <ContentSecondaryHeader messages={messages} />
193
206
  {syllabus.lessons.map((lesson, index) => (
194
207
  <div key={lesson.uid + index}>
195
208
  <LessonItem
@@ -63,7 +63,7 @@ const SyllabusEditor: React.FC = () => {
63
63
 
64
64
  useEffect(() => {
65
65
  ;(async () => {
66
- const { token } = checkParams()
66
+ const { token } = checkParams(["token"])
67
67
  if (token) {
68
68
  const user = await loginWithToken(token)
69
69
  if (user) {
@@ -54,10 +54,18 @@ export const uploadImageToBucket = async (imageUrl: string, path: string) => {
54
54
  return response.data
55
55
  }
56
56
 
57
- export const checkParams = () => {
57
+ export const checkParams = (paramsToCheck: string[]) => {
58
58
  const urlParams = new URLSearchParams(window.location.search)
59
- const token = urlParams.get("token")
60
- return { token }
59
+ const result: Record<string, string> = {}
60
+
61
+ paramsToCheck.forEach((param) => {
62
+ const value = urlParams.get(param)
63
+ if (value !== null) {
64
+ result[param] = value
65
+ }
66
+ })
67
+
68
+ return result
61
69
  }
62
70
 
63
71
  export async function getConsumables(token: string): Promise<any> {
@@ -90,10 +90,10 @@
90
90
  --text-xs--line-height: calc(1 / 0.75);
91
91
  --text-sm: 0.875rem;
92
92
  --text-sm--line-height: calc(1.25 / 0.875);
93
- --text-base: 1rem;
94
- --text-base--line-height: 1.5;
95
93
  --text-lg: 1.125rem;
96
94
  --text-lg--line-height: calc(1.75 / 1.125);
95
+ --text-xl: 1.25rem;
96
+ --text-xl--line-height: calc(1.75 / 1.25);
97
97
  --text-2xl: 1.5rem;
98
98
  --text-2xl--line-height: calc(2 / 1.5);
99
99
  --text-4xl: 2.25rem;
@@ -508,6 +508,9 @@
508
508
  .mb-6 {
509
509
  margin-bottom: calc(var(--spacing) * 6);
510
510
  }
511
+ .ml-6 {
512
+ margin-left: calc(var(--spacing) * 6);
513
+ }
511
514
  .ml-auto {
512
515
  margin-left: auto;
513
516
  }
@@ -1169,13 +1172,9 @@
1169
1172
  .sm\:p-4 {
1170
1173
  padding: calc(var(--spacing) * 4);
1171
1174
  }
1172
- .sm\:text-base {
1173
- font-size: var(--text-base);
1174
- line-height: var(--tw-leading, var(--text-base--line-height));
1175
- }
1176
- .sm\:text-sm {
1177
- font-size: var(--text-sm);
1178
- line-height: var(--tw-leading, var(--text-sm--line-height));
1175
+ .sm\:text-lg {
1176
+ font-size: var(--text-lg);
1177
+ line-height: var(--tw-leading, var(--text-lg--line-height));
1179
1178
  }
1180
1179
  }
1181
1180
  @media (min-width: 48rem) {
@@ -1189,6 +1188,10 @@
1189
1188
  font-size: var(--text-lg);
1190
1189
  line-height: var(--tw-leading, var(--text-lg--line-height));
1191
1190
  }
1191
+ .md\:text-xl {
1192
+ font-size: var(--text-xl);
1193
+ line-height: var(--tw-leading, var(--text-xl--line-height));
1194
+ }
1192
1195
  }
1193
1196
  @media (min-width: 64rem) {
1194
1197
  .lg\:relative {
@@ -1211,6 +1214,12 @@
1211
1214
  padding: calc(var(--spacing) * 8);
1212
1215
  }
1213
1216
  }
1217
+ @media (min-width: 80rem) {
1218
+ .xl\:text-2xl {
1219
+ font-size: var(--text-2xl);
1220
+ line-height: var(--tw-leading, var(--text-2xl--line-height));
1221
+ }
1222
+ }
1214
1223
  }
1215
1224
  :root {
1216
1225
  color-scheme: light dark;