@learnpack/learnpack 5.0.298 → 5.0.300
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 +409 -409
- package/lib/commands/audit.js +15 -15
- package/lib/commands/breakToken.js +19 -19
- package/lib/commands/clean.js +3 -3
- package/lib/commands/logout.js +3 -3
- package/lib/commands/serve.js +31 -11
- package/lib/creatorDist/assets/{index-D25zkBaN.js → index-DoYRptnk.js} +11875 -11992
- package/lib/creatorDist/index.html +1 -1
- package/lib/managers/config/index.js +77 -77
- package/lib/utils/creatorUtilities.js +14 -14
- package/lib/utils/templates/isolated/exercises/01-hello-world/README.es.md +26 -26
- package/lib/utils/templates/isolated/exercises/01-hello-world/README.md +26 -26
- package/lib/utils/templates/scorm/adlcp_rootv1p2.xsd +110 -110
- package/lib/utils/templates/scorm/config/index.html +209 -209
- package/lib/utils/templates/scorm/ims_xml.xsd +1 -1
- package/lib/utils/templates/scorm/imscp_rootv1p1p2.xsd +345 -345
- package/lib/utils/templates/scorm/imsmanifest.xml +38 -38
- package/lib/utils/templates/scorm/imsmd_rootv1p2p1.xsd +573 -573
- package/package.json +1 -1
- package/src/commands/audit.ts +487 -487
- package/src/commands/breakToken.ts +67 -67
- package/src/commands/clean.ts +30 -30
- package/src/commands/logout.ts +38 -38
- package/src/commands/serve.ts +47 -25
- package/src/commands/start.ts +333 -333
- package/src/commands/translate.ts +123 -123
- package/src/creator/README.md +54 -54
- package/src/creator/package-lock.json +6621 -6621
- package/src/creator/package.json +55 -55
- package/src/creator/src/App.tsx +569 -569
- package/src/creator/src/components/FileUploader.tsx +302 -302
- package/src/creator/src/components/Icon.tsx +18 -18
- package/src/creator/src/components/LessonItem.tsx +152 -152
- package/src/creator/src/components/Login.tsx +259 -259
- package/src/creator/src/components/syllabus/ContentIndex.tsx +323 -323
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +337 -337
- package/src/creator/src/i18n.ts +28 -28
- package/src/creator/src/locales/en.json +127 -127
- package/src/creator/src/locales/es.json +127 -127
- package/src/creator/src/utils/configTypes.ts +122 -122
- package/src/creator/src/utils/constants.ts +13 -13
- package/src/creator/src/utils/creatorUtils.ts +46 -46
- package/src/creator/src/utils/eventBus.ts +2 -2
- package/src/creator/src/utils/socket.ts +61 -61
- package/src/creator/src/utils/store.ts +222 -222
- package/src/creator/src/vite-env.d.ts +1 -1
- package/src/creator/vite.config.ts +13 -13
- package/src/creatorDist/assets/{index-D25zkBaN.js → index-DoYRptnk.js} +11875 -11992
- package/src/creatorDist/index.html +1 -1
- package/src/managers/config/defaults.ts +49 -49
- package/src/managers/config/exercise.ts +364 -364
- package/src/managers/config/index.ts +775 -775
- package/src/managers/file.ts +236 -236
- package/src/managers/server/routes.ts +554 -554
- package/src/managers/telemetry.ts +188 -188
- package/src/models/action.ts +13 -13
- package/src/models/config-manager.ts +28 -28
- package/src/models/config.ts +106 -106
- package/src/models/exercise-obj.ts +30 -30
- package/src/models/session.ts +39 -39
- package/src/models/socket.ts +61 -61
- package/src/models/status.ts +16 -16
- package/src/utils/BaseCommand.ts +56 -56
- package/src/utils/audit.ts +392 -392
- package/src/utils/checkNotInstalled.ts +267 -267
- package/src/utils/convertCreds.js +34 -34
- package/src/utils/creatorUtilities.ts +504 -504
- package/src/utils/export/README.md +178 -178
- package/src/utils/incrementVersion.js +74 -74
- package/src/utils/misc.ts +58 -58
- package/src/utils/sidebarGenerator.ts +195 -195
- package/src/utils/templates/isolated/exercises/01-hello-world/README.es.md +26 -26
- package/src/utils/templates/isolated/exercises/01-hello-world/README.md +26 -26
- package/src/utils/templates/scorm/adlcp_rootv1p2.xsd +110 -110
- package/src/utils/templates/scorm/config/index.html +209 -209
- package/src/utils/templates/scorm/ims_xml.xsd +1 -1
- package/src/utils/templates/scorm/imscp_rootv1p1p2.xsd +345 -345
- package/src/utils/templates/scorm/imsmanifest.xml +38 -38
- package/src/utils/templates/scorm/imsmd_rootv1p2p1.xsd +573 -573
package/lib/commands/audit.js
CHANGED
@@ -369,21 +369,21 @@ class AuditCommand extends SessionCommand_1.default {
|
|
369
369
|
}
|
370
370
|
}
|
371
371
|
}
|
372
|
-
AuditCommand.description = `learnpack audit is the command in charge of creating an auditory of the repository
|
373
|
-
...
|
374
|
-
learnpack audit checks for the following information in a repository:
|
375
|
-
1. The configuration object has slug, repository and description. (Error)
|
376
|
-
2. The command learnpack clean has been run. (Error)
|
377
|
-
3. If a markdown or test file doesn't have any content. (Error)
|
378
|
-
4. The links are accessing to valid servers. (Error)
|
379
|
-
5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)
|
380
|
-
6. The external images are working (If they are pointing to a valid server). (Error)
|
381
|
-
7. The exercises directory names are valid. (Error)
|
382
|
-
8. If an exercise doesn't have a README file. (Error)
|
383
|
-
9. The exercises array (Of the config file) has content. (Error)
|
384
|
-
10. The exercses have the same translations. (Warning)
|
385
|
-
11. The .gitignore file exists. (Warning)
|
386
|
-
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
372
|
+
AuditCommand.description = `learnpack audit is the command in charge of creating an auditory of the repository
|
373
|
+
...
|
374
|
+
learnpack audit checks for the following information in a repository:
|
375
|
+
1. The configuration object has slug, repository and description. (Error)
|
376
|
+
2. The command learnpack clean has been run. (Error)
|
377
|
+
3. If a markdown or test file doesn't have any content. (Error)
|
378
|
+
4. The links are accessing to valid servers. (Error)
|
379
|
+
5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)
|
380
|
+
6. The external images are working (If they are pointing to a valid server). (Error)
|
381
|
+
7. The exercises directory names are valid. (Error)
|
382
|
+
8. If an exercise doesn't have a README file. (Error)
|
383
|
+
9. The exercises array (Of the config file) has content. (Error)
|
384
|
+
10. The exercses have the same translations. (Warning)
|
385
|
+
11. The .gitignore file exists. (Warning)
|
386
|
+
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
387
387
|
`;
|
388
388
|
AuditCommand.flags = {
|
389
389
|
strict: command_1.flags.boolean({
|
@@ -4,25 +4,25 @@ const command_1 = require("@oclif/command");
|
|
4
4
|
const BaseCommand_1 = require("../utils/BaseCommand");
|
5
5
|
const console_1 = require("../utils/console");
|
6
6
|
const creatorUtilities_1 = require("../utils/creatorUtilities");
|
7
|
-
const exampleMd = `# How to Install Node.js
|
8
|
-
|
9
|
-
Node.js lets you run JavaScript outside a web browser.
|
10
|
-
|
11
|
-
## Step 1: Download Node.js
|
12
|
-
|
13
|
-
Get the Node.js installer from the [official site](https://nodejs.org/en/download/).
|
14
|
-
|
15
|
-
## Step 2: Install Node.js
|
16
|
-
|
17
|
-
Open the installer and follow the steps to finish.
|
18
|
-
|
19
|
-
## Step 3: Verify the Installation
|
20
|
-
|
21
|
-
Open a terminal and type:
|
22
|
-
|
23
|
-
\`\`\`bash
|
24
|
-
node -v
|
25
|
-
\`\`\`
|
7
|
+
const exampleMd = `# How to Install Node.js
|
8
|
+
|
9
|
+
Node.js lets you run JavaScript outside a web browser.
|
10
|
+
|
11
|
+
## Step 1: Download Node.js
|
12
|
+
|
13
|
+
Get the Node.js installer from the [official site](https://nodejs.org/en/download/).
|
14
|
+
|
15
|
+
## Step 2: Install Node.js
|
16
|
+
|
17
|
+
Open the installer and follow the steps to finish.
|
18
|
+
|
19
|
+
## Step 3: Verify the Installation
|
20
|
+
|
21
|
+
Open a terminal and type:
|
22
|
+
|
23
|
+
\`\`\`bash
|
24
|
+
node -v
|
25
|
+
\`\`\`
|
26
26
|
`;
|
27
27
|
class BreakTokenCommand extends BaseCommand_1.default {
|
28
28
|
async run() {
|
package/lib/commands/clean.js
CHANGED
@@ -16,9 +16,9 @@ class CleanCommand extends SessionCommand_1.default {
|
|
16
16
|
console_1.default.success("Package cleaned successfully, ready to publish");
|
17
17
|
}
|
18
18
|
}
|
19
|
-
CleanCommand.description = `Clean the configuration object
|
20
|
-
...
|
21
|
-
Extra documentation goes here
|
19
|
+
CleanCommand.description = `Clean the configuration object
|
20
|
+
...
|
21
|
+
Extra documentation goes here
|
22
22
|
`;
|
23
23
|
CleanCommand.flags = {
|
24
24
|
// name: flags.string({char: 'n', description: 'name to print'}),
|
package/lib/commands/logout.js
CHANGED
@@ -14,9 +14,9 @@ class LogoutCommand extends SessionCommand_1.default {
|
|
14
14
|
session_1.default.destroy();
|
15
15
|
}
|
16
16
|
}
|
17
|
-
LogoutCommand.description = `Describe the command here
|
18
|
-
...
|
19
|
-
Extra documentation goes here
|
17
|
+
LogoutCommand.description = `Describe the command here
|
18
|
+
...
|
19
|
+
Extra documentation goes here
|
20
20
|
`;
|
21
21
|
LogoutCommand.flags = {
|
22
22
|
// name: flags.string({char: 'n', description: 'name to print'}),
|
package/lib/commands/serve.js
CHANGED
@@ -643,15 +643,15 @@ class ServeCommand extends SessionCommand_1.default {
|
|
643
643
|
console.log("📁 Files received:", files);
|
644
644
|
if (files && Array.isArray(files)) {
|
645
645
|
console.log("✅ Processing files for coding challenge...");
|
646
|
-
|
647
|
-
const
|
648
|
-
const
|
646
|
+
const configFile = await bucket.file(`courses/${courseSlug}/.learn/config.json`);
|
647
|
+
const [configContent] = await configFile.download();
|
648
|
+
const { exercises } = JSON.parse(configContent.toString());
|
649
|
+
const exercise = exercises[parseInt(exercisePosition)];
|
649
650
|
if (!exercise) {
|
650
651
|
console.error(`❌ Exercise not found at position ${exercisePosition}`);
|
651
652
|
return res.status(404).json({ error: "Exercise not found" });
|
652
653
|
}
|
653
|
-
const
|
654
|
-
const exerciseDir = `courses/${courseSlug}/exercises/${exSlug}`;
|
654
|
+
const exerciseDir = `courses/${courseSlug}/exercises/${exercise.slug}`;
|
655
655
|
for (const fileStr of files) {
|
656
656
|
try {
|
657
657
|
const fileObj = JSON.parse(fileStr);
|
@@ -1795,6 +1795,30 @@ class ServeCommand extends SessionCommand_1.default {
|
|
1795
1795
|
});
|
1796
1796
|
}
|
1797
1797
|
});
|
1798
|
+
app.delete("/courses/:courseSlug/exercises/:exerciseSlug/file/:filename", async (req, res) => {
|
1799
|
+
console.log("DELETE /courses/:courseSlug/exercises/:exerciseSlug/file/:filename", req.params);
|
1800
|
+
const { courseSlug, exerciseSlug, filename } = req.params;
|
1801
|
+
try {
|
1802
|
+
const filePath = `courses/${courseSlug}/exercises/${exerciseSlug}/${filename}`;
|
1803
|
+
const file = bucket.file(filePath);
|
1804
|
+
const [exists] = await file.exists();
|
1805
|
+
if (!exists) {
|
1806
|
+
return res.status(404).json({ error: "File not found" });
|
1807
|
+
}
|
1808
|
+
await file.delete();
|
1809
|
+
console.log(`✅ Deleted file: ${filePath}`);
|
1810
|
+
return res.json({
|
1811
|
+
success: true,
|
1812
|
+
message: "File deleted successfully",
|
1813
|
+
});
|
1814
|
+
}
|
1815
|
+
catch (error) {
|
1816
|
+
console.error("❌ Error deleting file:", error);
|
1817
|
+
return res.status(500).json({
|
1818
|
+
error: error.message || "Unable to delete file",
|
1819
|
+
});
|
1820
|
+
}
|
1821
|
+
});
|
1798
1822
|
const YT_REGEX = /(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]{11})/;
|
1799
1823
|
app.get("/actions/fetch/:link", async (req, res) => {
|
1800
1824
|
const { link } = req.params;
|
@@ -1830,9 +1854,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
1830
1854
|
}
|
1831
1855
|
catch (error) {
|
1832
1856
|
console.error("❌ /actions/fetch error:", error.message || error);
|
1833
|
-
res
|
1834
|
-
.status(500)
|
1835
|
-
.json({ error: error.message || "Failed to fetch link" });
|
1857
|
+
res.status(500).json({ error: error.message || "Failed to fetch link" });
|
1836
1858
|
}
|
1837
1859
|
});
|
1838
1860
|
app.delete("/packages/:slug", async (req, res) => {
|
@@ -2016,9 +2038,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
2016
2038
|
}
|
2017
2039
|
catch (error) {
|
2018
2040
|
console.error("Export error:", error);
|
2019
|
-
res
|
2020
|
-
.status(500)
|
2021
|
-
.json({ error: "Export failed", details: error.message });
|
2041
|
+
res.status(500).json({ error: "Export failed", details: error.message });
|
2022
2042
|
}
|
2023
2043
|
});
|
2024
2044
|
server.listen(PORT, () => {
|