@learnpack/learnpack 5.0.178 → 5.0.180
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 +32 -18
- package/lib/creatorDist/assets/{index-CrWESWmj.css → index-Bnq3eZ3T.css} +13 -3
- package/lib/creatorDist/assets/index-hhajeHFt.js +35366 -0
- package/lib/creatorDist/index.html +2 -2
- package/lib/utils/creatorSocket.d.ts +1 -0
- package/lib/utils/creatorSocket.js +24 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/serve.ts +48 -26
- package/src/creator/package-lock.json +137 -0
- package/src/creator/package.json +1 -0
- package/src/creator/src/App.tsx +77 -50
- package/src/creator/src/components/ConsumablesManager.tsx +1 -3
- package/src/creator/src/components/FileUploader.tsx +136 -44
- package/src/creator/src/components/PurposeSelector.tsx +70 -0
- package/src/creator/src/components/SelectableCard.tsx +5 -3
- package/src/creator/src/components/Uploader.tsx +12 -1
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +6 -12
- package/src/creator/src/utils/constants.ts +10 -4
- package/src/creator/src/utils/lib.ts +0 -2
- package/src/creator/src/utils/rigo.ts +9 -5
- package/src/creator/src/utils/socket.ts +61 -0
- package/src/creator/src/utils/store.ts +7 -1
- package/src/creatorDist/assets/{index-CrWESWmj.css → index-Bnq3eZ3T.css} +13 -3
- package/src/creatorDist/assets/index-hhajeHFt.js +35366 -0
- package/src/creatorDist/index.html +2 -2
- package/src/ui/_app/app.js +19 -8
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/creatorSocket.ts +30 -0
- package/lib/creatorDist/assets/index-BvrB0WCf.js +0 -32991
- package/src/creatorDist/assets/index-BvrB0WCf.js +0 -32991
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.
|
24
|
+
@learnpack/learnpack/5.0.180 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.
|
83
|
+
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
98
|
+
_See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
113
|
+
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
131
|
+
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
163
|
+
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
181
|
+
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
199
|
+
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
331
|
+
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
348
|
+
_See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
370
|
+
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
387
|
+
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/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.
|
401
|
+
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.180/src\commands\translate.ts)_
|
402
402
|
<!-- commandsstop -->
|
403
403
|
|
404
404
|
> > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
|
package/lib/commands/serve.js
CHANGED
@@ -196,6 +196,12 @@ class ServeCommand extends SessionCommand_1.default {
|
|
196
196
|
console.log("GCP_CREDENTIALS_JSON is not set");
|
197
197
|
process.exit(1);
|
198
198
|
}
|
199
|
+
let deploymentURL = process.env.DEPLOYMENT_URL;
|
200
|
+
if (!deploymentURL) {
|
201
|
+
console.log("DEPLOYMENT_URL is not set, using default value");
|
202
|
+
deploymentURL = "https://app.learnpack.co";
|
203
|
+
}
|
204
|
+
console.log("DEPLOYMENT_URL", deploymentURL);
|
199
205
|
const credentials = JSON.parse(crendsEnv);
|
200
206
|
const bucketStorage = new storage_1.Storage({
|
201
207
|
credentials,
|
@@ -350,18 +356,20 @@ class ServeCommand extends SessionCommand_1.default {
|
|
350
356
|
});
|
351
357
|
app.post("/read-document", upload.single("file"), async (req, res) => {
|
352
358
|
console.log("READING A DOCUMENT");
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
359
|
+
const publicToken = req.header("x-public-token");
|
360
|
+
if (!publicToken) {
|
361
|
+
return res.status(400).json({ error: "Public token is required" });
|
362
|
+
}
|
357
363
|
try {
|
358
364
|
// eslint-disable-next-line
|
359
365
|
// @ts-ignore
|
360
366
|
if (!req.file) {
|
361
367
|
return res.status(400).json({ error: "Missing file" });
|
362
368
|
}
|
363
|
-
|
364
|
-
const
|
369
|
+
console.log("PUBLIC TOKEN", publicToken);
|
370
|
+
const resultId = `document-read-${Date.now()}-${Math.floor(Math.random() * 1e6)}`;
|
371
|
+
const webhookUrl = `${deploymentURL}/notifications/${resultId}`;
|
372
|
+
console.log("WEBHOOK URL", webhookUrl);
|
365
373
|
// Construir form-data para enviar al servidor proxy
|
366
374
|
const formData = new FormData();
|
367
375
|
// eslint-disable-next-line
|
@@ -375,20 +383,29 @@ class ServeCommand extends SessionCommand_1.default {
|
|
375
383
|
contentType: req.file.mimetype,
|
376
384
|
});
|
377
385
|
formData.append("webhook_callback_url", webhookUrl);
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
}
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
+
try {
|
387
|
+
const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/learnpack/public/tools/read-document`, formData, {
|
388
|
+
headers: Object.assign(Object.assign({}, formData.getHeaders()), { Authorization: `Token ${publicToken.trim()}` }),
|
389
|
+
});
|
390
|
+
}
|
391
|
+
catch (error) {
|
392
|
+
console.error("❌ Error in /read-document:", error);
|
393
|
+
return res.status(500).json({ error: error.message });
|
394
|
+
}
|
395
|
+
return res.json({ notificationId: resultId, status: "PROCESSING" });
|
386
396
|
}
|
387
397
|
catch (error) {
|
388
398
|
console.error("❌ Error in /read-document:", error);
|
389
399
|
return res.status(500).json({ error: error.message });
|
390
400
|
}
|
391
401
|
});
|
402
|
+
app.post("/notifications/:id", async (req, res) => {
|
403
|
+
console.log("Receiving a webhook to notification id", req.params.id);
|
404
|
+
const { id } = req.params;
|
405
|
+
const body = req.body;
|
406
|
+
(0, creatorSocket_1.emitToNotification)(id, body);
|
407
|
+
res.json({ id, status: "SUCCESS" });
|
408
|
+
});
|
392
409
|
app.get("/check-preview-image/:slug", async (req, res) => {
|
393
410
|
const { slug } = req.params;
|
394
411
|
const file = bucket.file(`courses/${slug}/preview.png`);
|
@@ -683,10 +700,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
683
700
|
}
|
684
701
|
await uploadFileToBucket(bucket, JSON.stringify(learnJson), `${tutorialDir}/learn.json`);
|
685
702
|
console.log("🔄 Learn.json uploaded to bucket to", tutorialDir);
|
686
|
-
const lessonsPromises = syllabus.lessons.map(lesson => processExercise(bucket, rigoToken, syllabus.lessons,
|
687
|
-
"courseInfo": ${JSON.stringify(syllabus.courseInfo)},
|
688
|
-
"sources": ${JSON.stringify(syllabus.sources)}
|
689
|
-
}`, lesson, tutorialDir + "/exercises", (0, creatorUtilities_2.slugify)(syllabus.courseInfo.title)));
|
703
|
+
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)));
|
690
704
|
const readmeContents = await Promise.all(lessonsPromises);
|
691
705
|
let imagesArray = [];
|
692
706
|
for (const content of readmeContents) {
|
@@ -55,6 +55,7 @@
|
|
55
55
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
56
56
|
"Liberation Mono", "Courier New", monospace;
|
57
57
|
--color-red-50: oklch(97.1% 0.013 17.38);
|
58
|
+
--color-red-100: oklch(93.6% 0.032 17.717);
|
58
59
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
59
60
|
--color-red-600: oklch(57.7% 0.245 27.325);
|
60
61
|
--color-red-700: oklch(50.5% 0.213 27.518);
|
@@ -435,9 +436,6 @@
|
|
435
436
|
.z-1000 {
|
436
437
|
z-index: 1000;
|
437
438
|
}
|
438
|
-
.float-right {
|
439
|
-
float: right;
|
440
|
-
}
|
441
439
|
.container {
|
442
440
|
width: 100%;
|
443
441
|
}
|
@@ -868,6 +866,9 @@
|
|
868
866
|
.bg-gray-50 {
|
869
867
|
background-color: var(--color-gray-50);
|
870
868
|
}
|
869
|
+
.bg-gray-100 {
|
870
|
+
background-color: var(--color-gray-100);
|
871
|
+
}
|
871
872
|
.bg-gray-200 {
|
872
873
|
background-color: var(--color-gray-200);
|
873
874
|
}
|
@@ -880,6 +881,9 @@
|
|
880
881
|
.bg-red-50 {
|
881
882
|
background-color: var(--color-red-50);
|
882
883
|
}
|
884
|
+
.bg-red-100 {
|
885
|
+
background-color: var(--color-red-100);
|
886
|
+
}
|
883
887
|
.bg-white {
|
884
888
|
background-color: var(--color-white);
|
885
889
|
}
|
@@ -1172,6 +1176,9 @@
|
|
1172
1176
|
.hover\:text-gray-900:hover {
|
1173
1177
|
color: var(--color-gray-900);
|
1174
1178
|
}
|
1179
|
+
.hover\:text-red-500:hover {
|
1180
|
+
color: var(--color-red-500);
|
1181
|
+
}
|
1175
1182
|
.hover\:text-red-700:hover {
|
1176
1183
|
color: var(--color-red-700);
|
1177
1184
|
}
|
@@ -1200,6 +1207,9 @@
|
|
1200
1207
|
.disabled\:opacity-40:disabled {
|
1201
1208
|
opacity: 0.4;
|
1202
1209
|
}
|
1210
|
+
.disabled\:opacity-50:disabled {
|
1211
|
+
opacity: 0.5;
|
1212
|
+
}
|
1203
1213
|
@media (min-width: 40rem) {
|
1204
1214
|
.sm\:w-auto {
|
1205
1215
|
width: auto;
|