@learnpack/learnpack 5.0.98 → 5.0.100

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 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.98 win32-x64 node-v22.15.0
24
+ @learnpack/learnpack/5.0.100 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.98/src\commands\audit.ts)_
83
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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/src\commands\breakToken.ts)_
98
+ _See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\clean.ts)_
113
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\download.ts)_
131
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\init.ts)_
163
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\login.ts)_
181
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\logout.ts)_
199
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\publish.ts)_
331
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\serve.ts)_
348
+ _See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\start.ts)_
370
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\test.ts)_
387
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/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.98/src\commands\translate.ts)_
401
+ _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.100/src\commands\translate.ts)_
402
402
  <!-- commandsstop -->
403
403
 
404
404
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
@@ -22,6 +22,17 @@ const misc_1 = require("../utils/misc");
22
22
  const configBuilder_1 = require("../utils/configBuilder");
23
23
  dotenv.config();
24
24
  const frontMatter = require("front-matter");
25
+ const fixPreviewUrl = (slug, previewUrl) => {
26
+ if (!previewUrl) {
27
+ return null;
28
+ }
29
+ if (previewUrl.startsWith("http")) {
30
+ return previewUrl;
31
+ }
32
+ const expectedUrl = `https://${slug}.learn-pack.com/preview.png`;
33
+ console.log("EXPECTED URL", expectedUrl);
34
+ return expectedUrl;
35
+ };
25
36
  class ServeCommand extends SessionCommand_1.default {
26
37
  async init() {
27
38
  const { flags } = this.parse(ServeCommand);
@@ -86,7 +97,7 @@ class ServeCommand extends SessionCommand_1.default {
86
97
  });
87
98
  stream.end(buffer);
88
99
  });
89
- app.post("/upload-image", express.json(), async (req, res) => {
100
+ app.post("/upload-image", express.json({ limit: "20mb" }), async (req, res) => {
90
101
  const { image_url, destination } = req.body;
91
102
  if (!image_url || !destination) {
92
103
  return res
@@ -96,9 +107,9 @@ class ServeCommand extends SessionCommand_1.default {
96
107
  try {
97
108
  const response = await fetch(image_url);
98
109
  if (!response.ok) {
99
- return res
100
- .status(400)
101
- .json({ error: `Failed to download image: ${response.statusText}` });
110
+ return res.status(400).json({
111
+ error: `Failed to download image: ${response.statusText}`,
112
+ });
102
113
  }
103
114
  const contentType = response.headers.get("content-type") || "application/octet-stream";
104
115
  const buffer = await response.arrayBuffer();
@@ -309,7 +320,6 @@ class ServeCommand extends SessionCommand_1.default {
309
320
  });
310
321
  app.post("/actions/publish/:slug", async (req, res) => {
311
322
  try {
312
- // 1) Extraer token y body
313
323
  const { slug } = req.params;
314
324
  const rigoToken = req.header("x-rigo-token");
315
325
  const bcToken = req.header("x-breathecode-token");
@@ -349,12 +359,11 @@ class ServeCommand extends SessionCommand_1.default {
349
359
  .replace(/{{title}}/g, config.title.us)
350
360
  .replace(/<title>.*<\/title>/, `<title>${config.title.us}</title>`)
351
361
  .replace(/{{description}}/g, config.description.us)
352
- .replace(/{{preview}}/g, config.preview ||
362
+ .replace(/{{preview}}/g, fixPreviewUrl(slug, config.preview) ||
353
363
  "https://raw.githubusercontent.com/learnpack/ide/master/public/learnpack.svg")
354
364
  .replace(/{{slug}}/g, slug)
355
365
  .replace(/{{duration}}/g, (0, misc_1.minutesToISO8601Duration)(config.duration));
356
366
  fs.writeFileSync(path.join(buildRoot, "index.html"), idxHtml);
357
- // 6) Inyectar placeholders en manifest.webmanifest
358
367
  const mfTpl = fs.readFileSync(path.join(uiSrc, "manifest.webmanifest"), "utf-8");
359
368
  const mf = mfTpl
360
369
  .replace(/{{course_title}}/g, config.title.us)
@@ -438,6 +447,24 @@ class ServeCommand extends SessionCommand_1.default {
438
447
  return res.status(500).json({ error: "Failed to delete the package" });
439
448
  }
440
449
  });
450
+ app.get("/proxy", async (req, res) => {
451
+ const { url } = req.query;
452
+ if (!url) {
453
+ return res.status(400).json({ error: "URL is required" });
454
+ }
455
+ try {
456
+ const decodedUrl = Buffer.from(url, "base64url").toString("utf-8");
457
+ const response = await axios_1.default.get(decodedUrl, {
458
+ responseType: "arraybuffer",
459
+ });
460
+ res.set(response.headers);
461
+ res.status(response.status).send(response.data);
462
+ }
463
+ catch (error) {
464
+ console.error("Error in /proxy:", error);
465
+ res.status(500).json({ error: "Failed to fetch the resource" });
466
+ }
467
+ });
441
468
  app.listen(PORT, () => {
442
469
  console.log(`🚀 Creator UI server running at http://localhost:${PORT}/creator`);
443
470
  });
@@ -88,6 +88,8 @@
88
88
  --text-base--line-height: 1.5;
89
89
  --text-lg: 1.125rem;
90
90
  --text-lg--line-height: calc(1.75 / 1.125);
91
+ --text-2xl: 1.5rem;
92
+ --text-2xl--line-height: calc(2 / 1.5);
91
93
  --text-4xl: 2.25rem;
92
94
  --text-4xl--line-height: calc(2.5 / 2.25);
93
95
  --font-weight-medium: 500;
@@ -460,15 +462,24 @@
460
462
  .mx-2 {
461
463
  margin-inline: calc(var(--spacing) * 2);
462
464
  }
465
+ .-mt-5 {
466
+ margin-top: calc(var(--spacing) * -5);
467
+ }
463
468
  .mt-1 {
464
469
  margin-top: calc(var(--spacing) * 1);
465
470
  }
466
471
  .mt-2 {
467
472
  margin-top: calc(var(--spacing) * 2);
468
473
  }
474
+ .mt-3 {
475
+ margin-top: calc(var(--spacing) * 3);
476
+ }
469
477
  .mt-4 {
470
478
  margin-top: calc(var(--spacing) * 4);
471
479
  }
480
+ .mt-5 {
481
+ margin-top: calc(var(--spacing) * 5);
482
+ }
472
483
  .mt-6 {
473
484
  margin-top: calc(var(--spacing) * 6);
474
485
  }
@@ -487,6 +498,9 @@
487
498
  .mb-6 {
488
499
  margin-bottom: calc(var(--spacing) * 6);
489
500
  }
501
+ .ml-auto {
502
+ margin-left: auto;
503
+ }
490
504
  .block {
491
505
  display: block;
492
506
  }
@@ -508,6 +522,9 @@
508
522
  .h-6 {
509
523
  height: calc(var(--spacing) * 6);
510
524
  }
525
+ .h-10 {
526
+ height: calc(var(--spacing) * 10);
527
+ }
511
528
  .h-15 {
512
529
  height: calc(var(--spacing) * 15);
513
530
  }
@@ -553,6 +570,9 @@
553
570
  .w-6 {
554
571
  width: calc(var(--spacing) * 6);
555
572
  }
573
+ .w-10 {
574
+ width: calc(var(--spacing) * 10);
575
+ }
556
576
  .w-15 {
557
577
  width: calc(var(--spacing) * 15);
558
578
  }
@@ -806,6 +826,9 @@
806
826
  .p-3 {
807
827
  padding: calc(var(--spacing) * 3);
808
828
  }
829
+ .p-4 {
830
+ padding: calc(var(--spacing) * 4);
831
+ }
809
832
  .p-6 {
810
833
  padding: calc(var(--spacing) * 6);
811
834
  }
@@ -848,6 +871,10 @@
848
871
  .font-sans {
849
872
  font-family: var(--font-sans);
850
873
  }
874
+ .text-2xl {
875
+ font-size: var(--text-2xl);
876
+ line-height: var(--tw-leading, var(--text-2xl--line-height));
877
+ }
851
878
  .text-4xl {
852
879
  font-size: var(--text-4xl);
853
880
  line-height: var(--tw-leading, var(--text-4xl--line-height));