@learnpack/learnpack 5.0.140 → 5.0.144
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/commands/serve.js +1 -0
- package/lib/creatorDist/assets/{index-D5Lznxst.js → index-CzMCewx6.js} +6659 -6644
- package/lib/creatorDist/assets/{index-Cz25oPGo.css → index-DSOj0E0h.css} +6 -0
- package/lib/creatorDist/index.html +7 -2
- package/lib/utils/creatorUtilities.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/serve.ts +2 -0
- package/src/creator/index.html +5 -0
- package/src/creator/src/App.tsx +61 -42
- package/src/creator/src/components/Login.tsx +2 -1
- package/src/creator/src/components/TurnstileChallenge.tsx +83 -0
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +2 -1
- package/src/creator/src/utils/constants.ts +3 -0
- package/src/creator/src/utils/store.ts +4 -0
- package/src/creatorDist/assets/{index-D5Lznxst.js → index-CzMCewx6.js} +6659 -6644
- package/src/creatorDist/assets/{index-Cz25oPGo.css → index-DSOj0E0h.css} +6 -0
- package/src/creatorDist/index.html +7 -2
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +195 -195
- package/src/ui/_app/index.html +2 -2
- package/src/ui/_app/rigo-float.gif +0 -0
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/creatorUtilities.ts +1 -1
@@ -393,6 +393,9 @@
|
|
393
393
|
.top-2 {
|
394
394
|
top: calc(var(--spacing) * 2);
|
395
395
|
}
|
396
|
+
.right-0 {
|
397
|
+
right: calc(var(--spacing) * 0);
|
398
|
+
}
|
396
399
|
.right-2 {
|
397
400
|
right: calc(var(--spacing) * 2);
|
398
401
|
}
|
@@ -704,6 +707,9 @@
|
|
704
707
|
.gap-3 {
|
705
708
|
gap: calc(var(--spacing) * 3);
|
706
709
|
}
|
710
|
+
.gap-4 {
|
711
|
+
gap: calc(var(--spacing) * 4);
|
712
|
+
}
|
707
713
|
:where(.space-y-2 > :not(:last-child)) {
|
708
714
|
--tw-space-y-reverse: 0;
|
709
715
|
margin-block-start: calc(
|
@@ -10,10 +10,15 @@
|
|
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-CzMCewx6.js"></script>
|
14
|
+
<link rel="stylesheet" crossorigin href="/creator/assets/index-DSOj0E0h.css">
|
15
15
|
</head>
|
16
16
|
<body>
|
17
17
|
<div id="root"></div>
|
18
|
+
<script
|
19
|
+
src="https://challenges.cloudflare.com/turnstile/v0/api.js"
|
20
|
+
async
|
21
|
+
defer
|
22
|
+
></script>
|
18
23
|
</body>
|
19
24
|
</html>
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"5.0.
|
1
|
+
{"version":"5.0.144","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.144",
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
6
6
|
"contributors": [
|
7
7
|
{
|
package/src/commands/serve.ts
CHANGED
@@ -136,6 +136,8 @@ export async function processExercise(
|
|
136
136
|
): Promise<string> {
|
137
137
|
// const tid = toast.loading("Generating lesson...")
|
138
138
|
const exSlug = slugify(exercise.id + "-" + exercise.title)
|
139
|
+
console.log("exSlug", exSlug)
|
140
|
+
|
139
141
|
const readmeFilename = "README.md"
|
140
142
|
const targetDir = `${exercisesDir}/${exSlug}`
|
141
143
|
|
package/src/creator/index.html
CHANGED
package/src/creator/src/App.tsx
CHANGED
@@ -12,16 +12,27 @@ import { checkParams, loginWithToken, parseLesson } from "./utils/lib"
|
|
12
12
|
import { Uploader } from "./components/Uploader"
|
13
13
|
import toast from "react-hot-toast"
|
14
14
|
import { ParamsChecker } from "./components/ParamsChecker"
|
15
|
+
import { RIGO_FLOAT_GIT } from "./utils/constants"
|
16
|
+
// import TurnstileChallenge from "./components/TurnstileChallenge"
|
17
|
+
|
15
18
|
function App() {
|
16
19
|
const navigate = useNavigate()
|
17
20
|
|
18
|
-
const {
|
21
|
+
const {
|
22
|
+
formState,
|
23
|
+
setFormState,
|
24
|
+
setAuth,
|
25
|
+
push,
|
26
|
+
cleanHistory,
|
27
|
+
setPlanToRedirect,
|
28
|
+
} = useStore(
|
19
29
|
useShallow((state) => ({
|
20
30
|
formState: state.formState,
|
21
31
|
setFormState: state.setFormState,
|
22
32
|
setAuth: state.setAuth,
|
23
33
|
push: state.push,
|
24
34
|
cleanHistory: state.cleanHistory,
|
35
|
+
setPlanToRedirect: state.setPlanToRedirect,
|
25
36
|
}))
|
26
37
|
)
|
27
38
|
|
@@ -68,7 +79,11 @@ function App() {
|
|
68
79
|
}
|
69
80
|
|
70
81
|
const checkDescription = () => {
|
71
|
-
const { description, duration } = checkParams([
|
82
|
+
const { description, duration, plan } = checkParams([
|
83
|
+
"description",
|
84
|
+
"duration",
|
85
|
+
"plan",
|
86
|
+
])
|
72
87
|
if (description) {
|
73
88
|
console.log("description", description)
|
74
89
|
setFormState({
|
@@ -88,6 +103,12 @@ function App() {
|
|
88
103
|
console.log("Invalid duration received in params", duration)
|
89
104
|
}
|
90
105
|
}
|
106
|
+
|
107
|
+
if (plan) {
|
108
|
+
setPlanToRedirect(plan)
|
109
|
+
} else {
|
110
|
+
console.debug("No plan received in params")
|
111
|
+
}
|
91
112
|
}
|
92
113
|
|
93
114
|
const handleCreateTutorial = async () => {
|
@@ -188,39 +209,41 @@ function App() {
|
|
188
209
|
slug: "hasContentIndex",
|
189
210
|
isCompleted: false,
|
190
211
|
content: (
|
191
|
-
|
192
|
-
<
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
hasContentIndex: true,
|
197
|
-
currentStep: "contentIndex",
|
198
|
-
variables: [...formState.variables, "contentIndex"],
|
199
|
-
// variables: [...formState.variables.filter((v) => v !== "hasContentIndex"), "contentIndex"],
|
200
|
-
})
|
201
|
-
}}
|
202
|
-
selected={false}
|
203
|
-
/>
|
204
|
-
<SelectableCard
|
205
|
-
title="No, help me create one"
|
206
|
-
onClick={() => {
|
207
|
-
if (!formState.contentIndex && !formState.description) {
|
208
|
-
toast.error(
|
209
|
-
"Please provide at least a description for your course!"
|
210
|
-
)
|
212
|
+
<>
|
213
|
+
<div className="flex flex-col md:flex-row gap-2 justify-center">
|
214
|
+
<SelectableCard
|
215
|
+
title="Yes"
|
216
|
+
onClick={() => {
|
211
217
|
setFormState({
|
212
|
-
|
218
|
+
hasContentIndex: true,
|
219
|
+
currentStep: "contentIndex",
|
220
|
+
variables: [...formState.variables, "contentIndex"],
|
221
|
+
// variables: [...formState.variables.filter((v) => v !== "hasContentIndex"), "contentIndex"],
|
213
222
|
})
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
223
|
+
}}
|
224
|
+
selected={false}
|
225
|
+
/>
|
226
|
+
<SelectableCard
|
227
|
+
title="No, help me create one"
|
228
|
+
onClick={() => {
|
229
|
+
if (!formState.contentIndex && !formState.description) {
|
230
|
+
toast.error(
|
231
|
+
"Please provide at least a description for your course!"
|
232
|
+
)
|
233
|
+
setFormState({
|
234
|
+
currentStep: "description",
|
235
|
+
})
|
236
|
+
return
|
237
|
+
}
|
238
|
+
setFormState({
|
239
|
+
hasContentIndex: false,
|
240
|
+
isCompleted: true,
|
241
|
+
})
|
242
|
+
}}
|
243
|
+
selected={false}
|
244
|
+
/>
|
245
|
+
</div>
|
246
|
+
</>
|
224
247
|
),
|
225
248
|
},
|
226
249
|
{
|
@@ -251,19 +274,15 @@ function App() {
|
|
251
274
|
return (
|
252
275
|
<>
|
253
276
|
<ParamsChecker />
|
277
|
+
{/* <div id="turnstile-container" style={{ display: "none" }} /> */}
|
278
|
+
|
254
279
|
{formState.isCompleted ? (
|
255
280
|
<Loader
|
256
281
|
text="Learnpack is setting up your tutorial. It may take a moment..."
|
257
|
-
icon={
|
258
|
-
<img
|
259
|
-
src={"creator/rigo-float.gif"}
|
260
|
-
alt="rigo"
|
261
|
-
className="w-20 h-20"
|
262
|
-
/>
|
263
|
-
}
|
282
|
+
icon={<img src={RIGO_FLOAT_GIT} alt="rigo" className="w-20 h-20" />}
|
264
283
|
/>
|
265
284
|
) : (
|
266
|
-
|
285
|
+
<div className="">
|
267
286
|
<StepWizard
|
268
287
|
formState={formState}
|
269
288
|
steps={buildSteps()}
|
@@ -274,7 +293,7 @@ function App() {
|
|
274
293
|
})
|
275
294
|
}}
|
276
295
|
/>
|
277
|
-
|
296
|
+
</div>
|
278
297
|
)}
|
279
298
|
</>
|
280
299
|
)
|
@@ -11,6 +11,7 @@ export default function Login({ onFinish }: { onFinish: () => void }) {
|
|
11
11
|
const [password, setPassword] = useState("")
|
12
12
|
const [isLoading, setIsLoading] = useState(false)
|
13
13
|
const [showForm, setShowForm] = useState(false)
|
14
|
+
const planToRedirect = useStore((state) => state.planToRedirect)
|
14
15
|
|
15
16
|
const { setAuth } = useStore(
|
16
17
|
useShallow((state) => ({ setAuth: state.setAuth }))
|
@@ -136,7 +137,7 @@ export default function Login({ onFinish }: { onFinish: () => void }) {
|
|
136
137
|
<div className="bg-blue-50 text-sm p-2 rounded text-left">
|
137
138
|
<p className="text-gray-700 m-0">You don't have an account?</p>
|
138
139
|
<a
|
139
|
-
href=
|
140
|
+
href={`https://4geeks.com/checkout?plan=${planToRedirect}`}
|
140
141
|
target="_blank"
|
141
142
|
className="text-blue-600 font-medium"
|
142
143
|
>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
// components/TurnstileChallenge.tsx
|
2
|
+
import { useEffect, useRef, useState } from "react"
|
3
|
+
import toast from "react-hot-toast"
|
4
|
+
|
5
|
+
interface TurnstileChallengeProps {
|
6
|
+
siteKey: string
|
7
|
+
onSuccess: (token: string) => void
|
8
|
+
onError?: () => void
|
9
|
+
autoStart?: boolean
|
10
|
+
}
|
11
|
+
|
12
|
+
declare global {
|
13
|
+
interface Window {
|
14
|
+
turnstile: any
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
const TurnstileChallenge = ({
|
19
|
+
siteKey,
|
20
|
+
onSuccess,
|
21
|
+
onError,
|
22
|
+
autoStart = true,
|
23
|
+
}: TurnstileChallengeProps) => {
|
24
|
+
const containerId = "cf-turnstile-container"
|
25
|
+
const widgetId = useRef<string | null>(null)
|
26
|
+
const [ready, setReady] = useState(false)
|
27
|
+
|
28
|
+
useEffect(() => {
|
29
|
+
const tryRender = () => {
|
30
|
+
if (!window.turnstile || !document.getElementById(containerId)) return
|
31
|
+
|
32
|
+
if (widgetId.current) return
|
33
|
+
|
34
|
+
const id = window.turnstile.render(`#${containerId}`, {
|
35
|
+
sitekey: siteKey,
|
36
|
+
callback: (token: string) => {
|
37
|
+
console.log("token to send", token)
|
38
|
+
|
39
|
+
onSuccess(token)
|
40
|
+
},
|
41
|
+
"error-callback": () => {
|
42
|
+
onError?.()
|
43
|
+
},
|
44
|
+
"refresh-callback": () => {
|
45
|
+
console.log("refresh callback CALLEd")
|
46
|
+
toast.error("Refresh callback called")
|
47
|
+
},
|
48
|
+
})
|
49
|
+
|
50
|
+
widgetId.current = id
|
51
|
+
setReady(true)
|
52
|
+
}
|
53
|
+
|
54
|
+
const interval = setInterval(() => {
|
55
|
+
if (window.turnstile && document.getElementById(containerId)) {
|
56
|
+
clearInterval(interval)
|
57
|
+
if (autoStart) tryRender()
|
58
|
+
}
|
59
|
+
}, 200)
|
60
|
+
|
61
|
+
return () => clearInterval(interval)
|
62
|
+
}, [siteKey, autoStart, onSuccess, onError])
|
63
|
+
|
64
|
+
// const reset = () => {
|
65
|
+
// if (widgetId.current && window.turnstile) {
|
66
|
+
// window.turnstile.reset(widgetId.current)
|
67
|
+
// }
|
68
|
+
// }
|
69
|
+
|
70
|
+
return (
|
71
|
+
// <div className="flex flex-col gap-4 bg-white w-full fixed bottom-0 left-0 right-0 p-4 h-full items-center justify-center">
|
72
|
+
<div className="">
|
73
|
+
{/* <h3 className="text-center text-2xl font-bold">
|
74
|
+
We must verify you are human
|
75
|
+
</h3> */}
|
76
|
+
<div id={containerId} data-refresh-timeout="auto" />
|
77
|
+
{!ready && <p className="">...</p>}
|
78
|
+
{/* <button onClick={reset}>RESET</button> */}
|
79
|
+
</div>
|
80
|
+
)
|
81
|
+
}
|
82
|
+
|
83
|
+
export default TurnstileChallenge
|
@@ -23,6 +23,7 @@ import { useNavigate } from "react-router"
|
|
23
23
|
import PreviewGenerator from "../PreviewGenerator"
|
24
24
|
import { ParamsChecker } from "../ParamsChecker"
|
25
25
|
import { slugify } from "../../utils/creatorUtils"
|
26
|
+
import { RIGO_FLOAT_GIT } from "../../utils/constants"
|
26
27
|
|
27
28
|
const SyllabusEditor: React.FC = () => {
|
28
29
|
const navigate = useNavigate()
|
@@ -168,7 +169,7 @@ const SyllabusEditor: React.FC = () => {
|
|
168
169
|
<>
|
169
170
|
<Loader
|
170
171
|
listeningTo="course-generation"
|
171
|
-
icon={<img src={
|
172
|
+
icon={<img src={RIGO_FLOAT_GIT} alt="rigo" className="w-20 h-20" />}
|
172
173
|
initialBuffer="🚀 Starting course generation..."
|
173
174
|
text="Learnpack is setting up your tutorial.
|
174
175
|
It may take a moment..."
|
@@ -1,2 +1,5 @@
|
|
1
1
|
export const RIGOBOT_HOST = "https://rigobot.herokuapp.com"
|
2
2
|
export const BREATHECODE_HOST = "https://breathecode.herokuapp.com"
|
3
|
+
|
4
|
+
export const RIGO_FLOAT_GIT =
|
5
|
+
"https://raw.githubusercontent.com/learnpack/ide/20ed3f4c3ead9b33d5d6acb20154dcd93a0ec4af/public/rigo-float.gif"
|
@@ -41,6 +41,8 @@ type Store = {
|
|
41
41
|
formState: FormState
|
42
42
|
setAuth: (auth: Auth) => void
|
43
43
|
// syllabus: Syllabus
|
44
|
+
planToRedirect: string
|
45
|
+
setPlanToRedirect: (planToRedirect: string) => void
|
44
46
|
uploadedFiles: UploadedFile[]
|
45
47
|
setUploadedFiles: (uploadedFiles: UploadedFile[]) => void
|
46
48
|
|
@@ -65,6 +67,8 @@ const useStore = create<Store>()(
|
|
65
67
|
userId: "",
|
66
68
|
user: null,
|
67
69
|
},
|
70
|
+
planToRedirect: "learnpack-creator",
|
71
|
+
setPlanToRedirect: (planToRedirect: string) => set({ planToRedirect }),
|
68
72
|
formState: {
|
69
73
|
description: "",
|
70
74
|
duration: 0,
|