@learnpack/learnpack 5.0.70 → 5.0.72

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.
Files changed (35) hide show
  1. package/README.md +13 -13
  2. package/lib/commands/init.js +1 -1
  3. package/lib/commands/serve.js +60 -4
  4. package/lib/creatorDist/assets/{index-Dqo9u2iR.css → index-BJ2JJzVC.css} +53 -26
  5. package/lib/creatorDist/assets/{index-Chx6V3zd.js → index-CKBeex0S.js} +35878 -29623
  6. package/lib/creatorDist/index.html +2 -2
  7. package/oclif.manifest.json +1 -1
  8. package/package.json +1 -1
  9. package/src/commands/init.ts +1 -1
  10. package/src/commands/serve.ts +70 -6
  11. package/src/creator/package-lock.json +49 -0
  12. package/src/creator/package.json +1 -0
  13. package/src/creator/src/App.tsx +28 -21
  14. package/src/creator/src/assets/svgs.tsx +1 -1
  15. package/src/creator/src/components/ConsumablesManager.tsx +12 -2
  16. package/src/creator/src/components/LessonItem.tsx +3 -2
  17. package/src/creator/src/components/Loader.tsx +5 -1
  18. package/src/creator/src/components/Login.tsx +58 -151
  19. package/src/creator/src/components/Message.tsx +11 -1
  20. package/src/creator/src/components/Redirector.tsx +12 -0
  21. package/src/creator/src/components/syllabus/ContentIndex.tsx +88 -58
  22. package/src/creator/src/components/syllabus/Sidebar.tsx +3 -12
  23. package/src/creator/src/components/syllabus/SyllabusEditor.tsx +63 -7
  24. package/src/creator/src/index.css +15 -0
  25. package/src/creator/src/main.tsx +0 -1
  26. package/src/creator/src/utils/creatorUtils.ts +33 -3
  27. package/src/creator/src/utils/lib.ts +156 -2
  28. package/src/creator/src/utils/rigo.ts +3 -3
  29. package/src/creator/src/utils/store.ts +2 -1
  30. package/src/creatorDist/assets/{index-Dqo9u2iR.css → index-BJ2JJzVC.css} +53 -26
  31. package/src/creatorDist/assets/{index-Chx6V3zd.js → index-CKBeex0S.js} +35878 -29623
  32. package/src/creatorDist/index.html +2 -2
  33. package/src/ui/_app/app.css +1 -1
  34. package/src/ui/_app/app.js +529 -529
  35. package/src/ui/app.tar.gz +0 -0
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.70 win32-x64 node-v22.14.0
24
+ @learnpack/learnpack/5.0.72 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.70/src\commands\audit.ts)_
83
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\breakToken.ts)_
98
+ _See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\clean.ts)_
113
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\download.ts)_
131
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\init.ts)_
163
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\login.ts)_
181
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\logout.ts)_
199
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\publish.ts)_
331
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\serve.ts)_
348
+ _See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\start.ts)_
370
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\test.ts)_
387
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/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.70/src\commands\translate.ts)_
401
+ _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.72/src\commands\translate.ts)_
402
402
  <!-- commandsstop -->
403
403
 
404
404
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
@@ -167,7 +167,7 @@ const handleAILogic = async (tutorialDir, packageInfo) => {
167
167
  await api_1.default.validateToken(sessionPayload.token) :
168
168
  false;
169
169
  if (!sessionExists || !isValidBreathecodeToken || !isValidToken) {
170
- console_1.default.info("Almost there! First you need to login with 4Geeks.com to use AI Generation tool for creators. You can create a new account here: https://4geeks.com/creators");
170
+ console_1.default.info("Almost there! First you need to login with 4Geeks.com to use AI Generation tool for creators. You can create a new account here: https://4geeks.com/checkout?plan=4geeks-creator");
171
171
  try {
172
172
  sessionPayload = await session_1.default.login();
173
173
  }
@@ -27,7 +27,7 @@ class ServeCommand extends SessionCommand_1.default {
27
27
  const bucketStorage = new storage_1.Storage({
28
28
  credentials,
29
29
  });
30
- const bucket = bucketStorage.bucket(process.env.GCP_BUCKET_NAME || "learnpack-creator");
30
+ const bucket = bucketStorage.bucket(process.env.GCP_BUCKET_NAME || "learnpack-packages");
31
31
  async function listFilesWithPrefix(prefix) {
32
32
  const [files] = await bucket.getFiles({ prefix });
33
33
  return files;
@@ -76,11 +76,49 @@ class ServeCommand extends SessionCommand_1.default {
76
76
  });
77
77
  stream.end(buffer);
78
78
  });
79
+ app.post("/upload-image", express.json(), async (req, res) => {
80
+ const { image_url, destination } = req.body;
81
+ if (!image_url || !destination) {
82
+ return res
83
+ .status(400)
84
+ .json({ error: "image_url and destination are required" });
85
+ }
86
+ try {
87
+ const response = await fetch(image_url);
88
+ if (!response.ok) {
89
+ return res
90
+ .status(400)
91
+ .json({ error: `Failed to download image: ${response.statusText}` });
92
+ }
93
+ const contentType = response.headers.get("content-type") || "application/octet-stream";
94
+ const buffer = await response.arrayBuffer();
95
+ const file = bucket.file(destination);
96
+ await file.save(Buffer.from(buffer), {
97
+ resumable: false,
98
+ contentType,
99
+ });
100
+ console.log(`✅ Image uploaded to ${file.name}`);
101
+ res.json({ message: "Image uploaded successfully", path: file.name });
102
+ }
103
+ catch (error) {
104
+ console.error("❌ upload-image error:", error);
105
+ res.status(500).json({ error: error.message });
106
+ }
107
+ });
108
+ app.get("/create", (req, res) => {
109
+ console.log("GET /create");
110
+ res.redirect("/creator/");
111
+ });
79
112
  app.get("/", async (req, res) => {
80
- // The the ui/_app/index.html
81
113
  console.log("GET /");
82
- const file = path.resolve(__dirname, "../ui/_app/index.html");
83
- res.sendFile(file);
114
+ const slug = req.query.slug;
115
+ if (slug) {
116
+ const file = path.resolve(__dirname, "../ui/_app/index.html");
117
+ res.sendFile(file);
118
+ }
119
+ else {
120
+ res.redirect("https://learnpack.co");
121
+ }
84
122
  });
85
123
  app.get("/config", async (req, res) => {
86
124
  const courseSlug = req.query.slug;
@@ -149,6 +187,24 @@ class ServeCommand extends SessionCommand_1.default {
149
187
  const { attributes, body } = frontMatter(contentBuffer[0].toString());
150
188
  res.send({ attributes, body });
151
189
  });
190
+ app.get("/.learn/assets/:file", async (req, res) => {
191
+ console.log("GET /.learn/assets/:file", req.params.file);
192
+ const { file } = req.params;
193
+ const courseSlug = req.query.slug;
194
+ if (!courseSlug) {
195
+ return res.status(400).send("Course slug is required");
196
+ }
197
+ const filePath = `courses/${courseSlug}/.learn/assets/${file}`;
198
+ const fileRef = bucket.file(filePath);
199
+ const [exists] = await fileRef.exists();
200
+ if (!exists) {
201
+ return res.status(404).send("File not found");
202
+ }
203
+ const fileStream = fileRef.createReadStream();
204
+ res.set("Content-Type", "application/octet-stream");
205
+ res.set("Content-Disposition", `attachment; filename="${file}"`);
206
+ fileStream.pipe(res);
207
+ });
152
208
  app.put("/exercise/:slug/file/:fileName", express.text(), async (req, res) => {
153
209
  const { slug, fileName } = req.params;
154
210
  const query = req.query;
@@ -57,7 +57,6 @@
57
57
  --color-red-300: oklch(80.8% 0.114 19.571);
58
58
  --color-red-500: oklch(63.7% 0.237 25.331);
59
59
  --color-red-700: oklch(50.5% 0.213 27.518);
60
- --color-yellow-50: oklch(98.7% 0.026 102.212);
61
60
  --color-sky-500: oklch(68.5% 0.169 237.323);
62
61
  --color-sky-600: oklch(58.8% 0.158 241.966);
63
62
  --color-blue-50: oklch(97% 0.014 254.604);
@@ -78,6 +77,7 @@
78
77
  --color-gray-700: oklch(37.3% 0.034 259.733);
79
78
  --color-gray-800: oklch(27.8% 0.033 256.848);
80
79
  --color-gray-900: oklch(21% 0.034 264.665);
80
+ --color-black: #000;
81
81
  --color-white: #fff;
82
82
  --spacing: 0.25rem;
83
83
  --container-sm: 24rem;
@@ -86,8 +86,6 @@
86
86
  --text-sm--line-height: calc(1.25 / 0.875);
87
87
  --text-lg: 1.125rem;
88
88
  --text-lg--line-height: calc(1.75 / 1.125);
89
- --text-xl: 1.25rem;
90
- --text-xl--line-height: calc(1.75 / 1.25);
91
89
  --text-4xl: 2.25rem;
92
90
  --text-4xl--line-height: calc(2.5 / 2.25);
93
91
  --font-weight-medium: 500;
@@ -373,6 +371,9 @@
373
371
  .relative {
374
372
  position: relative;
375
373
  }
374
+ .inset-0 {
375
+ inset: calc(var(--spacing) * 0);
376
+ }
376
377
  .-top-1 {
377
378
  top: calc(var(--spacing) * -1);
378
379
  }
@@ -421,6 +422,9 @@
421
422
  .z-50 {
422
423
  z-index: 50;
423
424
  }
425
+ .z-1000 {
426
+ z-index: 1000;
427
+ }
424
428
  .container {
425
429
  width: 100%;
426
430
  }
@@ -455,9 +459,6 @@
455
459
  .mx-2 {
456
460
  margin-inline: calc(var(--spacing) * 2);
457
461
  }
458
- .mx-auto {
459
- margin-inline: auto;
460
- }
461
462
  .mt-1 {
462
463
  margin-top: calc(var(--spacing) * 1);
463
464
  }
@@ -470,9 +471,6 @@
470
471
  .mt-6 {
471
472
  margin-top: calc(var(--spacing) * 6);
472
473
  }
473
- .mt-10 {
474
- margin-top: calc(var(--spacing) * 10);
475
- }
476
474
  .mr-1 {
477
475
  margin-right: calc(var(--spacing) * 1);
478
476
  }
@@ -521,8 +519,11 @@
521
519
  .h-40 {
522
520
  height: calc(var(--spacing) * 40);
523
521
  }
524
- .h-\[70\%\] {
525
- height: 70%;
522
+ .h-60 {
523
+ height: calc(var(--spacing) * 60);
524
+ }
525
+ .h-\[85\%\] {
526
+ height: 85%;
526
527
  }
527
528
  .h-full {
528
529
  height: 100%;
@@ -530,12 +531,15 @@
530
531
  .h-screen {
531
532
  height: 100vh;
532
533
  }
533
- .max-h-\[70vh\] {
534
- max-height: 70vh;
534
+ .max-h-\[80vh\] {
535
+ max-height: 80vh;
535
536
  }
536
537
  .max-h-\[300px\] {
537
538
  max-height: 300px;
538
539
  }
540
+ .min-h-\[70vh\] {
541
+ min-height: 70vh;
542
+ }
539
543
  .min-h-screen {
540
544
  min-height: 100vh;
541
545
  }
@@ -717,6 +721,18 @@
717
721
  .border-transparent {
718
722
  border-color: #0000;
719
723
  }
724
+ .bg-black\/50 {
725
+ background-color: #00000080;
726
+ }
727
+ @supports (color: color-mix(in lab, red, red)) {
728
+ .bg-black\/50 {
729
+ background-color: color-mix(
730
+ in oklab,
731
+ var(--color-black) 50%,
732
+ transparent
733
+ );
734
+ }
735
+ }
720
736
  .bg-blue-50 {
721
737
  background-color: var(--color-blue-50);
722
738
  }
@@ -744,9 +760,6 @@
744
760
  .bg-white {
745
761
  background-color: var(--color-white);
746
762
  }
747
- .bg-yellow-50 {
748
- background-color: var(--color-yellow-50);
749
- }
750
763
  .bg-gradient-to-t {
751
764
  --tw-gradient-position: to top in oklab;
752
765
  background-image: linear-gradient(var(--tw-gradient-stops));
@@ -829,10 +842,6 @@
829
842
  font-size: var(--text-sm);
830
843
  line-height: var(--tw-leading, var(--text-sm--line-height));
831
844
  }
832
- .text-xl {
833
- font-size: var(--text-xl);
834
- line-height: var(--tw-leading, var(--text-xl--line-height));
835
- }
836
845
  .text-\[10px\] {
837
846
  font-size: 10px;
838
847
  }
@@ -897,12 +906,6 @@
897
906
  .opacity-30 {
898
907
  opacity: 0.3;
899
908
  }
900
- .shadow {
901
- --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, #0000001a),
902
- 0 1px 2px -1px var(--tw-shadow-color, #0000001a);
903
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow),
904
- var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
905
- }
906
909
  .shadow-md {
907
910
  --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, #0000001a),
908
911
  0 2px 4px -2px var(--tw-shadow-color, #0000001a);
@@ -915,6 +918,17 @@
915
918
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow),
916
919
  var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
917
920
  }
921
+ .transition {
922
+ transition-property: color, background-color, border-color, outline-color,
923
+ text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via,
924
+ --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate,
925
+ filter, -webkit-backdrop-filter, backdrop-filter;
926
+ transition-timing-function: var(
927
+ --tw-ease,
928
+ var(--default-transition-timing-function)
929
+ );
930
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
931
+ }
918
932
  .transition-all {
919
933
  transition-property: all;
920
934
  transition-timing-function: var(
@@ -1091,6 +1105,19 @@ h1 {
1091
1105
  .blue-on-hover:hover svg path {
1092
1106
  fill: var(--learnpack-blue);
1093
1107
  }
1108
+ .border-learnpack-blue {
1109
+ border-color: var(--learnpack-blue);
1110
+ }
1111
+ .red-ball {
1112
+ background-color: #eb5757;
1113
+ border: 2px solid #fff;
1114
+ border-radius: 50%;
1115
+ width: 16px;
1116
+ height: 16px;
1117
+ position: absolute;
1118
+ top: -10px;
1119
+ left: 10px;
1120
+ }
1094
1121
  @property --tw-translate-x {
1095
1122
  syntax: "*";
1096
1123
  inherits: false;