@learnpack/learnpack 5.0.106 → 5.0.110
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 +13 -13
- package/lib/creatorDist/assets/{index-Sn-039yT.js → index-D386iq2u.js} +4842 -4911
- package/lib/creatorDist/assets/{index-Cvdi97GX.css → index-VqUlNIHR.css} +0 -3
- package/lib/creatorDist/index.html +2 -2
- package/lib/utils/configBuilder.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/creator/src/App.tsx +5 -8
- package/src/creator/src/components/LessonItem.tsx +21 -20
- package/src/creator/src/components/PreviewGenerator.tsx +6 -6
- package/src/creator/src/components/syllabus/ContentIndex.tsx +19 -19
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +3 -5
- package/src/creator/src/utils/creatorUtils.ts +3 -0
- package/src/creator/src/utils/store.ts +1 -0
- package/src/creatorDist/assets/{index-Sn-039yT.js → index-D386iq2u.js} +4842 -4911
- package/src/creatorDist/assets/{index-Cvdi97GX.css → index-VqUlNIHR.css} +0 -3
- package/src/creatorDist/index.html +2 -2
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +267 -267
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/configBuilder.ts +1 -1
@@ -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-
|
14
|
-
<link rel="stylesheet" crossorigin href="/creator/assets/index-
|
13
|
+
<script type="module" crossorigin src="/creator/assets/index-D386iq2u.js"></script>
|
14
|
+
<link rel="stylesheet" crossorigin href="/creator/assets/index-VqUlNIHR.css">
|
15
15
|
</head>
|
16
16
|
<body>
|
17
17
|
<div id="root"></div>
|
@@ -43,7 +43,7 @@ async function buildConfig(bucket, courseSlug) {
|
|
43
43
|
}
|
44
44
|
const exercises = Object.values(map).map((ex, i) => (Object.assign(Object.assign({}, ex), { position: i })));
|
45
45
|
return {
|
46
|
-
config: Object.assign(
|
46
|
+
config: Object.assign({}, learnJson),
|
47
47
|
exercises,
|
48
48
|
};
|
49
49
|
}
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"5.0.
|
1
|
+
{"version":"5.0.110","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.
|
4
|
+
"version": "5.0.110",
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
6
6
|
"contributors": [
|
7
7
|
{
|
package/src/creator/src/App.tsx
CHANGED
@@ -85,6 +85,7 @@ function App() {
|
|
85
85
|
courseInfo: {
|
86
86
|
...formState,
|
87
87
|
title: res.parsed.title,
|
88
|
+
description: res.parsed.description,
|
88
89
|
},
|
89
90
|
})
|
90
91
|
navigate("/creator/syllabus")
|
@@ -131,7 +132,7 @@ function App() {
|
|
131
132
|
onClick={() => {
|
132
133
|
setFormState({
|
133
134
|
duration: 30,
|
134
|
-
currentStep: "
|
135
|
+
currentStep: "hasContentIndex",
|
135
136
|
})
|
136
137
|
}}
|
137
138
|
selected={formState.duration === 30}
|
@@ -142,7 +143,7 @@ function App() {
|
|
142
143
|
onClick={() => {
|
143
144
|
setFormState({
|
144
145
|
duration: 60,
|
145
|
-
currentStep: "
|
146
|
+
currentStep: "hasContentIndex",
|
146
147
|
})
|
147
148
|
}}
|
148
149
|
selected={formState.duration === 60}
|
@@ -153,7 +154,7 @@ function App() {
|
|
153
154
|
onClick={() => {
|
154
155
|
setFormState({
|
155
156
|
duration: 120,
|
156
|
-
currentStep: "
|
157
|
+
currentStep: "hasContentIndex",
|
157
158
|
})
|
158
159
|
}}
|
159
160
|
selected={formState.duration === 120}
|
@@ -193,8 +194,7 @@ function App() {
|
|
193
194
|
),
|
194
195
|
},
|
195
196
|
{
|
196
|
-
title:
|
197
|
-
"Any materials to get this course started?",
|
197
|
+
title: "Any materials to get this course started?",
|
198
198
|
slug: "contentIndex",
|
199
199
|
isCompleted: false,
|
200
200
|
content: (
|
@@ -260,9 +260,6 @@ function App() {
|
|
260
260
|
/>
|
261
261
|
) : (
|
262
262
|
<>
|
263
|
-
{/* <div className="flex flex-col gap-4">
|
264
|
-
<h1 className="text-2xl font-bold">{formState.sources?.length}</h1>
|
265
|
-
</div> */}
|
266
263
|
<StepWizard
|
267
264
|
formState={formState}
|
268
265
|
steps={buildSteps()}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { useState, useRef } from "react"
|
2
|
-
import { SVGS } from "../assets/svgs"
|
1
|
+
// import { useState, useRef } from "react"
|
2
|
+
// import { SVGS } from "../assets/svgs"
|
3
3
|
|
4
4
|
export interface Lesson {
|
5
5
|
id: string
|
@@ -17,23 +17,23 @@ interface LessonItemProps {
|
|
17
17
|
onRemove: () => void
|
18
18
|
}
|
19
19
|
|
20
|
-
function cleanFloatString(input: string): string {
|
21
|
-
|
22
|
-
|
20
|
+
// function cleanFloatString(input: string): string {
|
21
|
+
// const num = parseFloat(input)
|
22
|
+
// const isInteger = Number.isInteger(num)
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
24
|
+
// return isInteger
|
25
|
+
// ? Math.floor(num).toString().padStart(2, "0")
|
26
|
+
// : num.toString()
|
27
|
+
// }
|
28
28
|
|
29
29
|
export const LessonItem: React.FC<LessonItemProps> = ({
|
30
30
|
lesson,
|
31
|
-
onChange,
|
32
|
-
onRemove,
|
31
|
+
// onChange,
|
32
|
+
// onRemove,
|
33
33
|
isNew,
|
34
34
|
}) => {
|
35
|
-
const inputRef = useRef<HTMLInputElement>(null)
|
36
|
-
const [isEditing, setIsEditing] = useState(false)
|
35
|
+
// const inputRef = useRef<HTMLInputElement>(null)
|
36
|
+
// const [isEditing, setIsEditing] = useState(false)
|
37
37
|
|
38
38
|
return (
|
39
39
|
<div
|
@@ -42,12 +42,12 @@ export const LessonItem: React.FC<LessonItemProps> = ({
|
|
42
42
|
}`}
|
43
43
|
>
|
44
44
|
{isNew && <span className="red-ball"></span>}
|
45
|
-
<span className="index-circle">{cleanFloatString(lesson.id)}</span>
|
46
|
-
<span className="text-gray-500 text-sm">
|
45
|
+
{/* <span className="index-circle">{cleanFloatString(lesson.id)}</span> */}
|
46
|
+
{/* <span className="text-gray-500 text-sm">
|
47
47
|
{lesson.type[0] + lesson.type.slice(1).toLowerCase()} ●
|
48
|
-
</span>
|
48
|
+
</span> */}
|
49
49
|
|
50
|
-
{isEditing ? (
|
50
|
+
{/* {isEditing ? (
|
51
51
|
<input
|
52
52
|
defaultValue={lesson.title}
|
53
53
|
ref={inputRef}
|
@@ -61,13 +61,14 @@ export const LessonItem: React.FC<LessonItemProps> = ({
|
|
61
61
|
/>
|
62
62
|
) : (
|
63
63
|
<span className="flex-1 text-sm text-gray-800">{lesson.title}</span>
|
64
|
-
)}
|
64
|
+
)} */}
|
65
|
+
<span className="flex-1 text-sm text-gray-800">{lesson.title}</span>
|
65
66
|
|
66
67
|
<span className="text-sm text-gray-600 bg-blue-100 px-2 py-1 rounded-full">
|
67
68
|
{lesson.duration} min
|
68
69
|
</span>
|
69
70
|
|
70
|
-
<button
|
71
|
+
{/* <button
|
71
72
|
onClick={() => {
|
72
73
|
setIsEditing(!isEditing)
|
73
74
|
if (inputRef.current) {
|
@@ -83,7 +84,7 @@ export const LessonItem: React.FC<LessonItemProps> = ({
|
|
83
84
|
className="text-red-500 hover:text-red-700 cursor-pointer"
|
84
85
|
>
|
85
86
|
{SVGS.trash}
|
86
|
-
</button>
|
87
|
+
</button> */}
|
87
88
|
</div>
|
88
89
|
)
|
89
90
|
}
|
@@ -10,7 +10,7 @@ import { eventBus } from "../utils/eventBus"
|
|
10
10
|
function proxify(link: string) {
|
11
11
|
// Validar que el enlace no sea vacío
|
12
12
|
if (!link) {
|
13
|
-
|
13
|
+
return "https://placehold.co/100x100"
|
14
14
|
}
|
15
15
|
|
16
16
|
const encodedUrl = btoa(link)
|
@@ -34,10 +34,10 @@ const PreviewGenerator: React.FC = () => {
|
|
34
34
|
html2canvas(previewElement, {
|
35
35
|
useCORS: true,
|
36
36
|
}).then(async (canvas) => {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
// const anchor = document.createElement("a")
|
38
|
+
// anchor.href = canvas.toDataURL("image/png")
|
39
|
+
// anchor.download = "preview.png"
|
40
|
+
// anchor.click()
|
41
41
|
|
42
42
|
const imageUrl = canvas.toDataURL("image/png")
|
43
43
|
|
@@ -59,7 +59,7 @@ const PreviewGenerator: React.FC = () => {
|
|
59
59
|
<div
|
60
60
|
id="preview"
|
61
61
|
style={{
|
62
|
-
width: "
|
62
|
+
width: "1200px",
|
63
63
|
height: "630px",
|
64
64
|
background: "white",
|
65
65
|
}}
|
@@ -5,7 +5,7 @@ import { SVGS } from "../../assets/svgs"
|
|
5
5
|
import { TMessage } from "../Message"
|
6
6
|
import Loader from "../Loader"
|
7
7
|
import { motion, AnimatePresence } from "framer-motion"
|
8
|
-
import { randomUUID } from "../../utils/creatorUtils"
|
8
|
+
// import { randomUUID } from "../../utils/creatorUtils"
|
9
9
|
import toast from "react-hot-toast"
|
10
10
|
|
11
11
|
const ContentIndexHeader = ({
|
@@ -127,22 +127,22 @@ export const ContentIndex = ({
|
|
127
127
|
})
|
128
128
|
}
|
129
129
|
|
130
|
-
const addLessonAfter = (index: number, id: string) => {
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
}
|
130
|
+
// const addLessonAfter = (index: number, id: string) => {
|
131
|
+
// const newLesson: Lesson = {
|
132
|
+
// id: (parseFloat(id) + 0.1).toFixed(1),
|
133
|
+
// title: "Hello World",
|
134
|
+
// uid: randomUUID(),
|
135
|
+
// type: "READ",
|
136
|
+
// duration: 2,
|
137
|
+
// description: "Hello World",
|
138
|
+
// }
|
139
|
+
// const updated = [...syllabus.lessons]
|
140
|
+
// updated.splice(index + 1, 0, newLesson)
|
141
|
+
// push({
|
142
|
+
// ...syllabus,
|
143
|
+
// lessons: updated,
|
144
|
+
// })
|
145
|
+
// }
|
146
146
|
|
147
147
|
useEffect(() => {
|
148
148
|
const container = containerRef.current
|
@@ -205,7 +205,7 @@ export const ContentIndex = ({
|
|
205
205
|
)
|
206
206
|
)}
|
207
207
|
/>
|
208
|
-
<div className="relative h-6">
|
208
|
+
{/* <div className="relative h-6">
|
209
209
|
<div className="absolute left-1/2 -translate-x-1/2 -top-3">
|
210
210
|
<button
|
211
211
|
onClick={() => addLessonAfter(index, lesson.id)}
|
@@ -214,7 +214,7 @@ export const ContentIndex = ({
|
|
214
214
|
+
|
215
215
|
</button>
|
216
216
|
</div>
|
217
|
-
</div>
|
217
|
+
</div> */}
|
218
218
|
</div>
|
219
219
|
))}
|
220
220
|
{syllabus.lessons.length > 0 && (
|
@@ -199,12 +199,12 @@ const SyllabusEditor: React.FC = () => {
|
|
199
199
|
window.location.href = `/preview/${slugify(
|
200
200
|
syllabus.courseInfo.title
|
201
201
|
)}?token=${auth.bcToken}`
|
202
|
-
setIsGenerating(false)
|
202
|
+
// setIsGenerating(false)
|
203
203
|
}
|
204
204
|
|
205
205
|
if (!syllabus) return null
|
206
206
|
|
207
|
-
console.log(auth.user)
|
207
|
+
// console.log(auth.user)
|
208
208
|
|
209
209
|
return isGenerating ? (
|
210
210
|
<>
|
@@ -234,9 +234,7 @@ It may take a moment..."
|
|
234
234
|
sendPrompt={sendPrompt}
|
235
235
|
handleSubmit={handleSubmit}
|
236
236
|
/>
|
237
|
-
|
238
|
-
Mostrar modal de Login
|
239
|
-
</button>
|
237
|
+
|
240
238
|
<ContentIndex
|
241
239
|
handleSubmit={handleSubmit}
|
242
240
|
messages={messages}
|
@@ -17,11 +17,14 @@ export const slugify = (text: string) => {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
export const createLearnJson = (courseInfo: FormState) => {
|
20
|
+
console.log("courseInfo to create learn json", courseInfo)
|
21
|
+
|
20
22
|
const learnJson = {
|
21
23
|
slug: slugify(courseInfo.title as string),
|
22
24
|
title: {
|
23
25
|
us: courseInfo.title,
|
24
26
|
},
|
27
|
+
technologies: courseInfo.technologies || [],
|
25
28
|
difficulty: "beginner",
|
26
29
|
description: {
|
27
30
|
us: courseInfo.description,
|