@learnpack/learnpack 5.0.94 → 5.0.98
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 +28 -43
- package/lib/creatorDist/assets/{index-EA507Y8n.js → index-DayC-cyC.js} +2845 -2842
- package/lib/creatorDist/index.html +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/serve.ts +40 -54
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +14 -11
- package/src/creatorDist/assets/{index-EA507Y8n.js → index-DayC-cyC.js} +2845 -2842
- package/src/creatorDist/index.html +1 -1
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +278 -278
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/creds.json +13 -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.
|
24
|
+
@learnpack/learnpack/5.0.98 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.98/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.98/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.98/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.98/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.98/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.98/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.98/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.98/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.98/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.98/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.98/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.98/src\commands\translate.ts)_
|
402
402
|
<!-- commandsstop -->
|
403
403
|
|
404
404
|
> > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
|
package/lib/commands/serve.js
CHANGED
@@ -151,49 +151,6 @@ class ServeCommand extends SessionCommand_1.default {
|
|
151
151
|
res.status(500).json({ error: error.message });
|
152
152
|
}
|
153
153
|
});
|
154
|
-
// app.get("/config", async (req, res) => {
|
155
|
-
// const courseSlug = req.query.slug
|
156
|
-
// const files = await listFilesWithPrefix(`courses/${courseSlug}`)
|
157
|
-
// const learnJson = files.find((file) => file.name.endsWith("learn.json"))
|
158
|
-
// const learnJsonContent = await learnJson?.download()
|
159
|
-
// const learnJsonParsed = JSON.parse(learnJsonContent?.toString() || "{}")
|
160
|
-
// const exerciseMap: ExerciseMap = {}
|
161
|
-
// // Agrupar archivos por ejercicio
|
162
|
-
// for (const file of files) {
|
163
|
-
// const pathParts = file.name.split("/")
|
164
|
-
// const isExercise = pathParts.includes("exercises")
|
165
|
-
// if (!isExercise) continue
|
166
|
-
// const slug = pathParts[pathParts.indexOf("exercises") + 1]
|
167
|
-
// if (!exerciseMap[slug]) {
|
168
|
-
// exerciseMap[slug] = {
|
169
|
-
// title: slug,
|
170
|
-
// slug: slug,
|
171
|
-
// graded: false,
|
172
|
-
// files: [],
|
173
|
-
// translations: {},
|
174
|
-
// }
|
175
|
-
// }
|
176
|
-
// const fileName = pathParts.at(-1)
|
177
|
-
// // Traducciones
|
178
|
-
// const readmeMatch = fileName?.match(/^readme(?:\.([a-z]{2}))?\.md$/i)
|
179
|
-
// if (readmeMatch) {
|
180
|
-
// const lang = readmeMatch[1] || "us"
|
181
|
-
// exerciseMap[slug].translations[lang] = fileName || ""
|
182
|
-
// } else {
|
183
|
-
// exerciseMap[slug].files.push(fileName || "")
|
184
|
-
// }
|
185
|
-
// }
|
186
|
-
// const exercises = Object.values(exerciseMap).map((ex, index) => ({
|
187
|
-
// ...ex,
|
188
|
-
// position: index,
|
189
|
-
// }))
|
190
|
-
// res.set("X-Creator-Web", "true")
|
191
|
-
// res.set("Access-Control-Expose-Headers", "X-Creator-Web")
|
192
|
-
// res.send({
|
193
|
-
// config: { ...learnJsonParsed, title: { us: courseSlug } },
|
194
|
-
// exercises,
|
195
|
-
// })
|
196
|
-
// })
|
197
154
|
app.get("/exercise/:slug/readme", async (req, res) => {
|
198
155
|
console.log("GET /exercise/:slug/readme");
|
199
156
|
const { slug } = req.params;
|
@@ -453,6 +410,34 @@ class ServeCommand extends SessionCommand_1.default {
|
|
453
410
|
return res.status(500).json({ error: error.message });
|
454
411
|
}
|
455
412
|
});
|
413
|
+
app.delete("/packages/:slug", async (req, res) => {
|
414
|
+
console.log("DELETE /packages/:slug");
|
415
|
+
const { slug } = req.params;
|
416
|
+
const rigoToken = req.header("x-rigo-token");
|
417
|
+
if (!rigoToken) {
|
418
|
+
return res.status(400).json({ error: "x-rigo-token is required" });
|
419
|
+
}
|
420
|
+
const isValid = await (0, rigoActions_1.isValidRigoToken)(rigoToken);
|
421
|
+
if (!isValid) {
|
422
|
+
return res.status(400).json({ error: "Invalid RigoToken" });
|
423
|
+
}
|
424
|
+
const filePrefix = `courses/${slug}/`;
|
425
|
+
try {
|
426
|
+
const [files] = await bucket.getFiles({ prefix: filePrefix });
|
427
|
+
if (files.length === 0) {
|
428
|
+
return res
|
429
|
+
.status(404)
|
430
|
+
.json({ error: "No package found with the given slug" });
|
431
|
+
}
|
432
|
+
await Promise.all(files.map(file => file.delete()));
|
433
|
+
console.log(`✅ Successfully deleted package from GCP: ${slug}`);
|
434
|
+
return res.json({ message: `Package ${slug} deleted successfully` });
|
435
|
+
}
|
436
|
+
catch (error) {
|
437
|
+
console.error("❌ Error deleting package:", error);
|
438
|
+
return res.status(500).json({ error: "Failed to delete the package" });
|
439
|
+
}
|
440
|
+
});
|
456
441
|
app.listen(PORT, () => {
|
457
442
|
console.log(`🚀 Creator UI server running at http://localhost:${PORT}/creator`);
|
458
443
|
});
|