@learnpack/learnpack 5.0.71 → 5.0.75

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 (37) hide show
  1. package/README.md +13 -13
  2. package/lib/commands/publish.js +9 -6
  3. package/lib/commands/serve.js +48 -1
  4. package/lib/creatorDist/assets/{index-k_eF99Sf.css → index-BJ2JJzVC.css} +48 -12
  5. package/lib/creatorDist/assets/{index-Dm2fdeOs.js → index-CKBeex0S.js} +36853 -30578
  6. package/lib/creatorDist/index.html +2 -2
  7. package/lib/utils/api.js +18 -7
  8. package/lib/utils/creatorUtilities.d.ts +3 -0
  9. package/lib/utils/creatorUtilities.js +3 -0
  10. package/oclif.manifest.json +1 -1
  11. package/package.json +1 -1
  12. package/src/commands/init.ts +1 -0
  13. package/src/commands/publish.ts +13 -6
  14. package/src/commands/serve.ts +57 -1
  15. package/src/creator/package-lock.json +49 -0
  16. package/src/creator/package.json +1 -0
  17. package/src/creator/src/App.tsx +27 -21
  18. package/src/creator/src/components/ConsumablesManager.tsx +12 -2
  19. package/src/creator/src/components/LessonItem.tsx +3 -2
  20. package/src/creator/src/components/Loader.tsx +5 -1
  21. package/src/creator/src/components/Login.tsx +46 -135
  22. package/src/creator/src/components/syllabus/ContentIndex.tsx +84 -46
  23. package/src/creator/src/components/syllabus/SyllabusEditor.tsx +55 -12
  24. package/src/creator/src/index.css +15 -0
  25. package/src/creator/src/utils/creatorUtils.ts +33 -3
  26. package/src/creator/src/utils/lib.ts +156 -2
  27. package/src/creator/src/utils/rigo.ts +3 -3
  28. package/src/creator/src/utils/store.ts +0 -1
  29. package/src/creatorDist/assets/{index-k_eF99Sf.css → index-BJ2JJzVC.css} +48 -12
  30. package/src/creatorDist/assets/{index-Dm2fdeOs.js → index-CKBeex0S.js} +36853 -30578
  31. package/src/creatorDist/index.html +2 -2
  32. package/src/ui/_app/app.css +1 -1
  33. package/src/ui/_app/app.js +529 -529
  34. package/src/ui/app.tar.gz +0 -0
  35. package/src/utils/api.ts +25 -7
  36. package/src/utils/creatorUtilities.ts +3 -0
  37. package/src/utils/creds.json +0 -13
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.71 win32-x64 node-v22.14.0
24
+ @learnpack/learnpack/5.0.75 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.71/src\commands\audit.ts)_
83
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\breakToken.ts)_
98
+ _See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\clean.ts)_
113
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\download.ts)_
131
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\init.ts)_
163
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\login.ts)_
181
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\logout.ts)_
199
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\publish.ts)_
331
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\serve.ts)_
348
+ _See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\start.ts)_
370
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\test.ts)_
387
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/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.71/src\commands\translate.ts)_
401
+ _See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.75/src\commands\translate.ts)_
402
402
  <!-- commandsstop -->
403
403
 
404
404
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
@@ -132,7 +132,7 @@ class BuildCommand extends SessionCommand_1.default {
132
132
  await api_1.default.validateToken(sessionPayload.token) :
133
133
  false;
134
134
  if (!sessionExists || !isValidBreathecodeToken || !isValidToken) {
135
- 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");
135
+ 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");
136
136
  try {
137
137
  sessionPayload = await session_1.default.login();
138
138
  }
@@ -156,9 +156,11 @@ class BuildCommand extends SessionCommand_1.default {
156
156
  (_c = this.configManager) === null || _c === void 0 ? void 0 : _c.buildIndex();
157
157
  }
158
158
  const academies = await api_1.default.listUserAcademies(sessionPayload.token);
159
- // // console.log(academies, "academies")
159
+ if (academies.length === 0) {
160
+ console_1.default.error("It seems you cannot publish tutorials. Make sure you creator subscription is up to date here: https://4geeks.com/profile/subscriptions. If you believe there is an issue you can always contact support@4geeks.com");
161
+ process.exit(1);
162
+ }
160
163
  const { academy, category } = await selectAcademy(academies, sessionPayload.token);
161
- // Read learn.json to get the slug
162
164
  const learnJsonPath = path.join(process.cwd(), "learn.json");
163
165
  if (!fs.existsSync(learnJsonPath)) {
164
166
  this.error("learn.json not found");
@@ -231,9 +233,10 @@ class BuildCommand extends SessionCommand_1.default {
231
233
  if (fs.existsSync(manifestPWA)) {
232
234
  let manifestPWAContent = fs.readFileSync(manifestPWA, "utf-8");
233
235
  manifestPWAContent = manifestPWAContent.replace("{{course_title}}", learnJson.title.us);
234
- const courseShortName = await (0, rigoActions_1.generateCourseShortName)(rigoToken, {
235
- learnJSON: JSON.stringify(learnJson),
236
- });
236
+ const courseShortName = { answer: "testing-tutorial" };
237
+ // const courseShortName = await generateCourseShortName(rigoToken, {
238
+ // learnJSON: JSON.stringify(learnJson),
239
+ // })
237
240
  manifestPWAContent = manifestPWAContent.replace("{{course_app_name}}", courseShortName.answer);
238
241
  fs.writeFileSync(buildManifestPWA, manifestPWAContent);
239
242
  }
@@ -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,6 +76,35 @@ 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
+ });
79
108
  app.get("/create", (req, res) => {
80
109
  console.log("GET /create");
81
110
  res.redirect("/creator/");
@@ -158,6 +187,24 @@ class ServeCommand extends SessionCommand_1.default {
158
187
  const { attributes, body } = frontMatter(contentBuffer[0].toString());
159
188
  res.send({ attributes, body });
160
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
+ });
161
208
  app.put("/exercise/:slug/file/:fileName", express.text(), async (req, res) => {
162
209
  const { slug, fileName } = req.params;
163
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;
@@ -371,6 +371,9 @@
371
371
  .relative {
372
372
  position: relative;
373
373
  }
374
+ .inset-0 {
375
+ inset: calc(var(--spacing) * 0);
376
+ }
374
377
  .-top-1 {
375
378
  top: calc(var(--spacing) * -1);
376
379
  }
@@ -419,6 +422,9 @@
419
422
  .z-50 {
420
423
  z-index: 50;
421
424
  }
425
+ .z-1000 {
426
+ z-index: 1000;
427
+ }
422
428
  .container {
423
429
  width: 100%;
424
430
  }
@@ -453,9 +459,6 @@
453
459
  .mx-2 {
454
460
  margin-inline: calc(var(--spacing) * 2);
455
461
  }
456
- .mx-auto {
457
- margin-inline: auto;
458
- }
459
462
  .mt-1 {
460
463
  margin-top: calc(var(--spacing) * 1);
461
464
  }
@@ -468,9 +471,6 @@
468
471
  .mt-6 {
469
472
  margin-top: calc(var(--spacing) * 6);
470
473
  }
471
- .mt-10 {
472
- margin-top: calc(var(--spacing) * 10);
473
- }
474
474
  .mr-1 {
475
475
  margin-right: calc(var(--spacing) * 1);
476
476
  }
@@ -519,8 +519,8 @@
519
519
  .h-40 {
520
520
  height: calc(var(--spacing) * 40);
521
521
  }
522
- .h-50 {
523
- height: calc(var(--spacing) * 50);
522
+ .h-60 {
523
+ height: calc(var(--spacing) * 60);
524
524
  }
525
525
  .h-\[85\%\] {
526
526
  height: 85%;
@@ -537,6 +537,9 @@
537
537
  .max-h-\[300px\] {
538
538
  max-height: 300px;
539
539
  }
540
+ .min-h-\[70vh\] {
541
+ min-height: 70vh;
542
+ }
540
543
  .min-h-screen {
541
544
  min-height: 100vh;
542
545
  }
@@ -718,6 +721,18 @@
718
721
  .border-transparent {
719
722
  border-color: #0000;
720
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
+ }
721
736
  .bg-blue-50 {
722
737
  background-color: var(--color-blue-50);
723
738
  }
@@ -745,9 +760,6 @@
745
760
  .bg-white {
746
761
  background-color: var(--color-white);
747
762
  }
748
- .bg-yellow-50 {
749
- background-color: var(--color-yellow-50);
750
- }
751
763
  .bg-gradient-to-t {
752
764
  --tw-gradient-position: to top in oklab;
753
765
  background-image: linear-gradient(var(--tw-gradient-stops));
@@ -906,6 +918,17 @@
906
918
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow),
907
919
  var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
908
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
+ }
909
932
  .transition-all {
910
933
  transition-property: all;
911
934
  transition-timing-function: var(
@@ -1082,6 +1105,19 @@ h1 {
1082
1105
  .blue-on-hover:hover svg path {
1083
1106
  fill: var(--learnpack-blue);
1084
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
+ }
1085
1121
  @property --tw-translate-x {
1086
1122
  syntax: "*";
1087
1123
  inherits: false;