@learnpack/learnpack 5.0.100 → 5.0.108

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.100 win32-x64 node-v22.15.0
24
+ @learnpack/learnpack/5.0.108 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.100/src\commands\audit.ts)_
83
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\breakToken.ts)_
98
+ _See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\clean.ts)_
113
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\download.ts)_
131
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\init.ts)_
163
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\login.ts)_
181
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\logout.ts)_
199
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\publish.ts)_
331
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\serve.ts)_
348
+ _See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\start.ts)_
370
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\test.ts)_
387
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/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.100/src\commands\translate.ts)_
401
+ _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.108/src\commands\translate.ts)_
402
402
  <!-- commandsstop -->
403
403
 
404
404
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@oclif/command");
4
+ // import * as ytdl from "ytdl-core"
5
+ const youtube_transcript_1 = require("youtube-transcript");
4
6
  const express = require("express");
5
7
  const cors = require("cors");
6
8
  const path = require("path");
7
9
  const os = require("os");
8
10
  const archiver = require("archiver");
9
11
  const mkdirp = require("mkdirp");
12
+ const html_to_text_1 = require("html-to-text");
10
13
  const rimraf = require("rimraf");
11
14
  const SessionCommand_1 = require("../utils/SessionCommand");
12
15
  const storage_1 = require("@google-cloud/storage");
@@ -33,6 +36,11 @@ const fixPreviewUrl = (slug, previewUrl) => {
33
36
  console.log("EXPECTED URL", expectedUrl);
34
37
  return expectedUrl;
35
38
  };
39
+ const getTitleFromHTML = (html) => {
40
+ const titleRegex = /<title>(.*?)<\/title>/;
41
+ const titleMatch = html.match(titleRegex);
42
+ return titleMatch ? titleMatch[1] : null;
43
+ };
36
44
  class ServeCommand extends SessionCommand_1.default {
37
45
  async init() {
38
46
  const { flags } = this.parse(ServeCommand);
@@ -419,6 +427,45 @@ class ServeCommand extends SessionCommand_1.default {
419
427
  return res.status(500).json({ error: error.message });
420
428
  }
421
429
  });
430
+ const YT_REGEX = /(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]{11})/;
431
+ app.get("/actions/fetch/:link", async (req, res) => {
432
+ const { link } = req.params;
433
+ try {
434
+ // 1) Decode the URL
435
+ const decoded = Buffer.from(link, "base64url").toString("utf-8");
436
+ const ytMatch = decoded.match(YT_REGEX);
437
+ if (ytMatch) {
438
+ const videoId = ytMatch[1];
439
+ // fetch metadata
440
+ const items = await youtube_transcript_1.YoutubeTranscript.fetchTranscript(videoId);
441
+ const transcript = items.map(i => i.text).join(" ");
442
+ const { data: meta } = await axios_1.default.get("https://www.youtube.com/oembed", {
443
+ params: { url: decoded, format: "json" },
444
+ });
445
+ return res.json({
446
+ url: decoded,
447
+ title: meta.title,
448
+ author: meta.author_name,
449
+ thumbnail: meta.thumbnail_url,
450
+ transcript,
451
+ });
452
+ }
453
+ const response = await axios_1.default.get(decoded, { responseType: "text" });
454
+ const html = response.data;
455
+ const title = getTitleFromHTML(html);
456
+ console.log("TITLE", title);
457
+ const text = (0, html_to_text_1.convert)(html);
458
+ return res.json({
459
+ url: decoded,
460
+ text,
461
+ title,
462
+ });
463
+ }
464
+ catch (error) {
465
+ console.error("❌ /actions/fetch error:", error.message || error);
466
+ res.status(500).json({ error: error.message || "Failed to fetch link" });
467
+ }
468
+ });
422
469
  app.delete("/packages/:slug", async (req, res) => {
423
470
  console.log("DELETE /packages/:slug");
424
471
  const { slug } = req.params;
@@ -26,6 +26,7 @@
26
26
  --tw-gradient-from-position: 0%;
27
27
  --tw-gradient-via-position: 50%;
28
28
  --tw-gradient-to-position: 100%;
29
+ --tw-leading: initial;
29
30
  --tw-font-weight: initial;
30
31
  --tw-shadow: 0 0 #0000;
31
32
  --tw-shadow-color: initial;
@@ -53,7 +54,9 @@
53
54
  "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
54
55
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
55
56
  "Liberation Mono", "Courier New", monospace;
57
+ --color-red-50: oklch(97.1% 0.013 17.38);
56
58
  --color-red-500: oklch(63.7% 0.237 25.331);
59
+ --color-red-600: oklch(57.7% 0.245 27.325);
57
60
  --color-red-700: oklch(50.5% 0.213 27.518);
58
61
  --color-sky-500: oklch(68.5% 0.169 237.323);
59
62
  --color-sky-600: oklch(58.8% 0.158 241.966);
@@ -67,6 +70,7 @@
67
70
  --color-blue-800: oklch(42.4% 0.199 265.638);
68
71
  --color-blue-900: oklch(37.9% 0.146 265.522);
69
72
  --color-gray-50: oklch(98.5% 0.002 247.839);
73
+ --color-gray-100: oklch(96.7% 0.003 264.542);
70
74
  --color-gray-200: oklch(92.8% 0.006 264.531);
71
75
  --color-gray-300: oklch(87.2% 0.01 258.338);
72
76
  --color-gray-400: oklch(70.7% 0.022 261.325);
@@ -78,7 +82,9 @@
78
82
  --color-black: #000;
79
83
  --color-white: #fff;
80
84
  --spacing: 0.25rem;
85
+ --container-xs: 20rem;
81
86
  --container-sm: 24rem;
87
+ --container-md: 28rem;
82
88
  --container-xl: 36rem;
83
89
  --text-xs: 0.75rem;
84
90
  --text-xs--line-height: calc(1 / 0.75);
@@ -99,6 +105,7 @@
99
105
  --radius-lg: 0.5rem;
100
106
  --radius-xl: 0.75rem;
101
107
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
108
+ --animate-spin: spin 1s linear infinite;
102
109
  --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
103
110
  --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
104
111
  --default-transition-duration: 0.15s;
@@ -462,6 +469,9 @@
462
469
  .mx-2 {
463
470
  margin-inline: calc(var(--spacing) * 2);
464
471
  }
472
+ .mx-auto {
473
+ margin-inline: auto;
474
+ }
465
475
  .-mt-5 {
466
476
  margin-top: calc(var(--spacing) * -5);
467
477
  }
@@ -519,12 +529,18 @@
519
529
  .h-2 {
520
530
  height: calc(var(--spacing) * 2);
521
531
  }
532
+ .h-5 {
533
+ height: calc(var(--spacing) * 5);
534
+ }
522
535
  .h-6 {
523
536
  height: calc(var(--spacing) * 6);
524
537
  }
525
538
  .h-10 {
526
539
  height: calc(var(--spacing) * 10);
527
540
  }
541
+ .h-12 {
542
+ height: calc(var(--spacing) * 12);
543
+ }
528
544
  .h-15 {
529
545
  height: calc(var(--spacing) * 15);
530
546
  }
@@ -567,12 +583,18 @@
567
583
  .w-4\/5 {
568
584
  width: 80%;
569
585
  }
586
+ .w-5 {
587
+ width: calc(var(--spacing) * 5);
588
+ }
570
589
  .w-6 {
571
590
  width: calc(var(--spacing) * 6);
572
591
  }
573
592
  .w-10 {
574
593
  width: calc(var(--spacing) * 10);
575
594
  }
595
+ .w-12 {
596
+ width: calc(var(--spacing) * 12);
597
+ }
576
598
  .w-15 {
577
599
  width: calc(var(--spacing) * 15);
578
600
  }
@@ -588,12 +610,18 @@
588
610
  .max-w-\[700px\] {
589
611
  max-width: 700px;
590
612
  }
613
+ .max-w-md {
614
+ max-width: var(--container-md);
615
+ }
591
616
  .max-w-sm {
592
617
  max-width: var(--container-sm);
593
618
  }
594
619
  .max-w-xl {
595
620
  max-width: var(--container-xl);
596
621
  }
622
+ .max-w-xs {
623
+ max-width: var(--container-xs);
624
+ }
597
625
  .flex-1 {
598
626
  flex: 1;
599
627
  }
@@ -622,6 +650,12 @@
622
650
  .animate-pulse {
623
651
  animation: var(--animate-pulse);
624
652
  }
653
+ .animate-spin {
654
+ animation: var(--animate-spin);
655
+ }
656
+ .cursor-not-allowed {
657
+ cursor: not-allowed;
658
+ }
625
659
  .cursor-pointer {
626
660
  cursor: pointer;
627
661
  }
@@ -631,9 +665,6 @@
631
665
  .flex-col {
632
666
  flex-direction: column;
633
667
  }
634
- .flex-row {
635
- flex-direction: row;
636
- }
637
668
  .items-center {
638
669
  align-items: center;
639
670
  }
@@ -649,6 +680,9 @@
649
680
  .justify-end {
650
681
  justify-content: flex-end;
651
682
  }
683
+ .justify-start {
684
+ justify-content: flex-start;
685
+ }
652
686
  .gap-1 {
653
687
  gap: calc(var(--spacing) * 1);
654
688
  }
@@ -789,6 +823,12 @@
789
823
  .bg-gray-300 {
790
824
  background-color: var(--color-gray-300);
791
825
  }
826
+ .bg-gray-400 {
827
+ background-color: var(--color-gray-400);
828
+ }
829
+ .bg-red-50 {
830
+ background-color: var(--color-red-50);
831
+ }
792
832
  .bg-sky-500 {
793
833
  background-color: var(--color-sky-500);
794
834
  }
@@ -817,6 +857,9 @@
817
857
  var(--tw-gradient-to) var(--tw-gradient-to-position)
818
858
  );
819
859
  }
860
+ .object-cover {
861
+ object-fit: cover;
862
+ }
820
863
  .p-1 {
821
864
  padding: calc(var(--spacing) * 1);
822
865
  }
@@ -891,6 +934,10 @@
891
934
  font-size: var(--text-xs);
892
935
  line-height: var(--tw-leading, var(--text-xs--line-height));
893
936
  }
937
+ .leading-none {
938
+ --tw-leading: 1;
939
+ line-height: 1;
940
+ }
894
941
  .font-bold {
895
942
  --tw-font-weight: var(--font-weight-bold);
896
943
  font-weight: var(--font-weight-bold);
@@ -939,6 +986,9 @@
939
986
  .text-red-500 {
940
987
  color: var(--color-red-500);
941
988
  }
989
+ .text-red-600 {
990
+ color: var(--color-red-600);
991
+ }
942
992
  .text-sky-600 {
943
993
  color: var(--color-sky-600);
944
994
  }
@@ -948,9 +998,21 @@
948
998
  .uppercase {
949
999
  text-transform: uppercase;
950
1000
  }
1001
+ .opacity-25 {
1002
+ opacity: 0.25;
1003
+ }
951
1004
  .opacity-30 {
952
1005
  opacity: 0.3;
953
1006
  }
1007
+ .opacity-75 {
1008
+ opacity: 0.75;
1009
+ }
1010
+ .shadow-lg {
1011
+ --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, #0000001a),
1012
+ 0 4px 6px -4px var(--tw-shadow-color, #0000001a);
1013
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow),
1014
+ var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1015
+ }
954
1016
  .shadow-md {
955
1017
  --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, #0000001a),
956
1018
  0 2px 4px -2px var(--tw-shadow-color, #0000001a);
@@ -992,6 +1054,14 @@
992
1054
  );
993
1055
  transition-duration: var(--tw-duration, var(--default-transition-duration));
994
1056
  }
1057
+ .transition-shadow {
1058
+ transition-property: box-shadow;
1059
+ transition-timing-function: var(
1060
+ --tw-ease,
1061
+ var(--default-transition-timing-function)
1062
+ );
1063
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
1064
+ }
995
1065
  .transition-transform {
996
1066
  transition-property: transform, translate, scale, rotate;
997
1067
  transition-timing-function: var(
@@ -1040,6 +1110,18 @@
1040
1110
  var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1041
1111
  }
1042
1112
  }
1113
+ .focus\:ring-2:focus {
1114
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0
1115
+ calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
1116
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow),
1117
+ var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1118
+ }
1119
+ .focus\:ring-blue-200:focus {
1120
+ --tw-ring-color: var(--color-blue-200);
1121
+ }
1122
+ .disabled\:bg-gray-100:disabled {
1123
+ background-color: var(--color-gray-100);
1124
+ }
1043
1125
  .disabled\:opacity-40:disabled {
1044
1126
  opacity: 0.4;
1045
1127
  }
@@ -1151,6 +1233,9 @@ h1 {
1151
1233
  .bg-learnpack-blue {
1152
1234
  background-color: var(--soft-blue);
1153
1235
  }
1236
+ .bg-learnpack {
1237
+ background-color: var(--learnpack-blue);
1238
+ }
1154
1239
  .bg-gray-blue {
1155
1240
  background-color: #e7f1ff;
1156
1241
  }
@@ -1180,9 +1265,6 @@ h1 {
1180
1265
  display: flex;
1181
1266
  }
1182
1267
  @keyframes spin {
1183
- 0% {
1184
- transform: rotate(0);
1185
- }
1186
1268
  to {
1187
1269
  transform: rotate(360deg);
1188
1270
  }
@@ -1353,6 +1435,10 @@ h1 {
1353
1435
  inherits: false;
1354
1436
  initial-value: 100%;
1355
1437
  }
1438
+ @property --tw-leading {
1439
+ syntax: "*";
1440
+ inherits: false;
1441
+ }
1356
1442
  @property --tw-font-weight {
1357
1443
  syntax: "*";
1358
1444
  inherits: false;